summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Li <davidxli@google.com>2011-01-24 11:13:48 -0800
committerDavid Li <davidxli@google.com>2011-01-24 11:13:48 -0800
commit16ea2fadf3b2cded5d50c95dbf6613c8d939e19b (patch)
treeb18654525a485b45db8fc04de742f1bb54ea5c7e
parentb286f63e168037c1dbf9a10614dd6a1cd6b9ef69 (diff)
Remove unnecessary files.
-rw-r--r--src/glsl/.dir-locals.el3
-rw-r--r--src/glsl/.gitignore2
-rw-r--r--src/glsl/Makefile186
-rw-r--r--src/glsl/Makefile.template50
-rw-r--r--src/glsl/SConscript111
-rw-r--r--src/glsl/ir_algebraic.cpp420
-rw-r--r--src/glsl/ir_constant_folding.cpp273
-rw-r--r--src/glsl/ir_constant_propagation.cpp435
-rw-r--r--src/glsl/ir_constant_variable.cpp198
-rw-r--r--src/glsl/ir_copy_propagation.cpp362
-rw-r--r--src/glsl/ir_dead_code.cpp134
-rw-r--r--src/glsl/ir_dead_code_local.cpp229
-rw-r--r--src/glsl/ir_dead_functions.cpp151
-rw-r--r--src/glsl/ir_explog_to_explog2.cpp85
-rw-r--r--src/glsl/ir_function_inlining.cpp417
-rw-r--r--src/glsl/ir_if_simplification.cpp84
-rw-r--r--src/glsl/ir_if_to_cond_assign.cpp168
-rw-r--r--src/glsl/ir_mat_op_to_vec.cpp397
-rw-r--r--src/glsl/ir_noop_swizzle.cpp80
-rw-r--r--src/glsl/ir_structure_splitting.cpp356
-rw-r--r--src/glsl/ir_sub_to_add_neg.cpp76
-rw-r--r--src/glsl/ir_swizzle_swizzle.cpp93
-rw-r--r--src/glsl/ir_tree_grafting.cpp361
-rw-r--r--src/glsl/ir_vec_index_to_cond_assign.cpp258
-rw-r--r--src/glsl/ir_vec_index_to_swizzle.cpp157
-rw-r--r--src/glsl/main.cpp2
-rw-r--r--src/mesa/main/.gitignore4
-rw-r--r--src/mesa/main/APIspec.dtd52
-rw-r--r--src/mesa/main/APIspec.py617
-rw-r--r--src/mesa/main/APIspec.xml4341
-rw-r--r--src/mesa/main/APIspecutil.py272
-rw-r--r--src/mesa/main/descrip.mms255
-rw-r--r--src/mesa/main/dispatch.h37
-rw-r--r--src/mesa/main/dlist.c10195
-rw-r--r--src/mesa/main/dlist.h103
-rw-r--r--src/mesa/main/dlopen.c112
-rw-r--r--src/mesa/main/dlopen.h42
-rw-r--r--src/mesa/main/enable.c1491
-rw-r--r--src/mesa/main/enable.h71
-rw-r--r--src/mesa/main/enums.c6280
-rw-r--r--src/mesa/main/enums.h62
-rw-r--r--src/mesa/main/es_generator.py760
-rw-r--r--src/mesa/main/execmem.c154
-rw-r--r--src/mesa/main/extensions.c986
-rw-r--r--src/mesa/main/extensions.h96
-rw-r--r--src/mesa/main/formats.c1492
-rw-r--r--src/mesa/main/formats.h226
-rw-r--r--src/mesa/main/matrix.c787
-rw-r--r--src/mesa/main/matrix.h113
-rw-r--r--src/mesa/main/mipmap.c1966
-rw-r--r--src/mesa/main/mipmap.h64
-rw-r--r--src/mesa/main/mm.c283
-rw-r--r--src/mesa/main/mm.h90
-rw-r--r--src/mesa/main/multisample.c61
-rw-r--r--src/mesa/main/multisample.h41
-rw-r--r--src/mesa/main/nvprogram.c919
-rw-r--r--src/mesa/main/nvprogram.h119
-rw-r--r--src/mesa/main/pack.c5063
-rw-r--r--src/mesa/main/pack.h147
-rw-r--r--src/mesa/main/pixel.c700
-rw-r--r--src/mesa/main/pixel.h72
-rw-r--r--src/mesa/main/pixelstore.c283
-rw-r--r--src/mesa/main/pixelstore.h52
-rw-r--r--src/mesa/main/pixeltransfer.c566
-rw-r--r--src/mesa/main/pixeltransfer.h90
-rw-r--r--src/mesa/main/points.c272
-rw-r--r--src/mesa/main/points.h59
-rw-r--r--src/mesa/main/polygon.c322
-rw-r--r--src/mesa/main/polygon.h67
-rw-r--r--src/mesa/main/querymatrix.c212
-rw-r--r--src/mesa/main/queryobj.c565
-rw-r--r--src/mesa/main/queryobj.h95
-rw-r--r--src/mesa/main/rastpos.c564
-rw-r--r--src/mesa/main/rastpos.h60
-rw-r--r--src/mesa/main/readpix.c234
-rw-r--r--src/mesa/main/readpix.h43
-rw-r--r--src/mesa/main/remap.c226
-rw-r--r--src/mesa/main/remap.h98
-rw-r--r--src/mesa/main/remap_helper.h6504
-rw-r--r--src/mesa/main/renderbuffer.c2007
-rw-r--r--src/mesa/main/renderbuffer.h111
-rw-r--r--src/mesa/main/restart.c68
-rw-r--r--src/mesa/main/restart.h41
-rw-r--r--src/mesa/main/scissor.c99
-rw-r--r--src/mesa/main/scissor.h47
-rw-r--r--src/mesa/main/shaderapi.c1886
-rw-r--r--src/mesa/main/shaderapi.h193
-rw-r--r--src/mesa/main/shaderobj.c411
-rw-r--r--src/mesa/main/shared.c390
-rw-r--r--src/mesa/main/shared.h38
-rw-r--r--src/mesa/main/state.c732
-rw-r--r--src/mesa/main/state.h49
-rw-r--r--src/mesa/main/stencil.c590
-rw-r--r--src/mesa/main/stencil.h81
-rw-r--r--src/mesa/main/syncobj.c424
-rw-r--r--src/mesa/main/syncobj.h119
-rw-r--r--src/mesa/main/texcompress.c247
-rw-r--r--src/mesa/main/texcompress.h59
-rw-r--r--src/mesa/main/texcompress_fxt1.c1650
-rw-r--r--src/mesa/main/texcompress_fxt1.h61
-rw-r--r--src/mesa/main/texcompress_s3tc.c572
-rw-r--r--src/mesa/main/texcompress_s3tc.h110
-rw-r--r--src/mesa/main/texenv.c1036
-rw-r--r--src/mesa/main/texenv.h63
-rw-r--r--src/mesa/main/texenvprogram.c1617
-rw-r--r--src/mesa/main/texenvprogram.h35
-rw-r--r--src/mesa/main/texfetch.c834
-rw-r--r--src/mesa/main/texfetch.h40
-rw-r--r--src/mesa/main/texfetch_tmp.h1919
-rw-r--r--src/mesa/main/texformat.c458
-rw-r--r--src/mesa/main/texformat.h39
-rw-r--r--src/mesa/main/texgen.c400
-rw-r--r--src/mesa/main/texgen.h84
-rw-r--r--src/mesa/main/texgetimage.c905
-rw-r--r--src/mesa/main/texgetimage.h60
-rw-r--r--src/mesa/main/teximage.c3485
-rw-r--r--src/mesa/main/teximage.h274
-rw-r--r--src/mesa/main/texobj.c1258
-rw-r--r--src/mesa/main/texobj.h122
-rw-r--r--src/mesa/main/texpal.c204
-rw-r--r--src/mesa/main/texpal.h38
-rw-r--r--src/mesa/main/texparam.c1417
-rw-r--r--src/mesa/main/texparam.h75
-rw-r--r--src/mesa/main/texrender.c635
-rw-r--r--src/mesa/main/texrender.h18
-rw-r--r--src/mesa/main/texstate.c844
-rw-r--r--src/mesa/main/texstate.h92
-rw-r--r--src/mesa/main/texstore.c4648
-rw-r--r--src/mesa/main/texstore.h218
-rw-r--r--src/mesa/main/transformfeedback.c944
-rw-r--r--src/mesa/main/transformfeedback.h137
-rw-r--r--src/mesa/main/uniforms.c1662
-rw-r--r--src/mesa/main/uniforms.h193
-rw-r--r--src/mesa/main/varray.c1172
-rw-r--r--src/mesa/main/varray.h244
-rw-r--r--src/mesa/main/viewport.c180
-rw-r--r--src/mesa/main/viewport.h55
-rw-r--r--src/mesa/main/vtxfmt.c171
-rw-r--r--src/mesa/main/vtxfmt.h58
-rw-r--r--src/mesa/math/descrip.mms47
-rw-r--r--src/mesa/program/.gitignore1
-rw-r--r--src/mesa/program/Makefile7
-rw-r--r--src/mesa/program/arbprogparse.c219
-rw-r--r--src/mesa/program/arbprogparse.h41
-rw-r--r--src/mesa/program/descrip.mms93
-rw-r--r--src/mesa/program/ir_to_mesa.cpp3074
-rw-r--r--src/mesa/program/lex.yy.c3681
-rw-r--r--src/mesa/program/nvfragparse.c1588
-rw-r--r--src/mesa/program/nvfragparse.h44
-rw-r--r--src/mesa/program/nvvertparse.c1459
-rw-r--r--src/mesa/program/nvvertparse.h46
-rw-r--r--src/mesa/program/prog_cache.c206
-rw-r--r--src/mesa/program/prog_cache.h58
-rw-r--r--src/mesa/program/prog_execute.c1879
-rw-r--r--src/mesa/program/prog_execute.h86
-rw-r--r--src/mesa/program/prog_instruction.c354
-rw-r--r--src/mesa/program/prog_instruction.h454
-rw-r--r--src/mesa/program/prog_noise.c638
-rw-r--r--src/mesa/program/prog_noise.h36
-rw-r--r--src/mesa/program/prog_optimize.c1250
-rw-r--r--src/mesa/program/prog_optimize.h46
-rw-r--r--src/mesa/program/prog_parameter.c656
-rw-r--r--src/mesa/program/prog_parameter_layout.c214
-rw-r--r--src/mesa/program/prog_parameter_layout.h42
-rw-r--r--src/mesa/program/prog_print.c1084
-rw-r--r--src/mesa/program/prog_print.h120
-rw-r--r--src/mesa/program/prog_statevars.c1182
-rw-r--r--src/mesa/program/prog_uniform.c177
-rw-r--r--src/mesa/program/program.c1073
-rw-r--r--src/mesa/program/program.h210
-rw-r--r--src/mesa/program/program_lexer.l507
-rw-r--r--src/mesa/program/program_parse.tab.c5730
-rw-r--r--src/mesa/program/program_parse.tab.h209
-rw-r--r--src/mesa/program/program_parse.y2768
-rw-r--r--src/mesa/program/program_parse_extra.c255
-rw-r--r--src/mesa/program/program_parser.h299
-rw-r--r--src/mesa/program/programopt.c669
-rw-r--r--src/mesa/program/programopt.h53
-rw-r--r--src/mesa/program/register_allocate.c425
-rw-r--r--src/mesa/program/register_allocate.h71
-rw-r--r--src/mesa/program/sampler.cpp140
-rw-r--r--src/mesa/program/sampler.h29
182 files changed, 1 insertions, 120311 deletions
diff --git a/src/glsl/.dir-locals.el b/src/glsl/.dir-locals.el
deleted file mode 100644
index be19e29..0000000
--- a/src/glsl/.dir-locals.el
+++ /dev/null
@@ -1,3 +0,0 @@
-((c-mode . ((c-basic-offset . 3)))
- (c++-mode . ((c-basic-offset . 3)))
-)
diff --git a/src/glsl/.gitignore b/src/glsl/.gitignore
deleted file mode 100644
index 4c21231..0000000
--- a/src/glsl/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-glsl_compiler
-glsl_parser.output
diff --git a/src/glsl/Makefile b/src/glsl/Makefile
deleted file mode 100644
index 86a577e..0000000
--- a/src/glsl/Makefile
+++ /dev/null
@@ -1,186 +0,0 @@
-#src/glsl/pp/Makefile
-
-TOP = ../..
-
-include $(TOP)/configs/current
-
-LIBNAME = glsl
-
-LIBGLCPP_SOURCES = \
- glcpp/glcpp-lex.c \
- glcpp/glcpp-parse.c \
- glcpp/pp.c
-
-GLCPP_SOURCES = \
- $(LIBGLCPP_SOURCES) \
- glcpp/glcpp.c
-
-C_SOURCES = \
- strtod.c \
- $(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_basic_block.cpp \
- ir_clone.cpp \
- ir_constant_expression.cpp \
- ir.cpp \
- ir_expression_flattening.cpp \
- ir_function_can_inline.cpp \
- ir_function.cpp \
- ir_hierarchical_visitor.cpp \
- ir_hv_accept.cpp \
- ir_import_prototypes.cpp \
- ir_print_visitor.cpp \
- ir_reader.cpp \
- ir_rvalue_visitor.cpp \
- ir_set_program_inouts.cpp \
- ir_validate.cpp \
- ir_variable.cpp \
- ir_variable_refcount.cpp \
- linker.cpp \
- link_functions.cpp \
- loop_analysis.cpp \
- loop_controls.cpp \
- loop_unroll.cpp \
- lower_discard.cpp \
- lower_if_to_cond_assign.cpp \
- lower_instructions.cpp \
- lower_jumps.cpp \
- lower_mat_op_to_vec.cpp \
- lower_noise.cpp \
- lower_texture_projection.cpp \
- lower_variable_index_to_cond_assign.cpp \
- lower_vec_index_to_cond_assign.cpp \
- lower_vec_index_to_swizzle.cpp \
- lower_vector.cpp \
- opt_algebraic.cpp \
- opt_constant_folding.cpp \
- opt_constant_propagation.cpp \
- opt_constant_variable.cpp \
- opt_copy_propagation.cpp \
- opt_dead_code.cpp \
- opt_dead_code_local.cpp \
- opt_dead_functions.cpp \
- opt_discard_simplification.cpp \
- opt_function_inlining.cpp \
- opt_if_simplification.cpp \
- opt_noop_swizzle.cpp \
- opt_redundant_jumps.cpp \
- opt_structure_splitting.cpp \
- opt_swizzle_swizzle.cpp \
- opt_tree_grafting.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...
- $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py > builtin_function.cpp
- @echo Rebuilding the real compiler...
- make glsl_compiler
-
--include depend
diff --git a/src/glsl/Makefile.template b/src/glsl/Makefile.template
deleted file mode 100644
index 974987a..0000000
--- a/src/glsl/Makefile.template
+++ /dev/null
@@ -1,50 +0,0 @@
-# src/glsl/Makefile.template
-
-# Template makefile for glsl libraries.
-#
-# Usage:
-# The minimum that the including makefile needs to define
-# is TOP, LIBNAME and one of of the *_SOURCES.
-#
-# Optional defines:
-# LIBRARY_INCLUDES are appended to the list of includes directories.
-# LIBRARY_DEFINES is not used for makedepend, but for compilation.
-
-
-### Basic defines ###
-
-OBJECTS = $(C_SOURCES:.c=.o)
-
-INCLUDES = \
- -I. \
- $(LIBRARY_INCLUDES)
-
-
-##### TARGETS #####
-
-default: depend lib$(LIBNAME).a
-
-lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/glsl/Makefile.template
- $(MKLIB) -o $(LIBNAME) -static $(OBJECTS)
-
-depend: $(C_SOURCES)
- rm -f depend
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) 2> /dev/null
-
-# Remove .o and backup files
-clean:
- rm -f $(OBJECTS) lib$(LIBNAME).a depend depend.bak
-
-# Dummy target
-install:
- @echo -n ""
-
-
-##### RULES #####
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@
-
--include depend
-
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
deleted file mode 100644
index f179721..0000000
--- a/src/glsl/SConscript
+++ /dev/null
@@ -1,111 +0,0 @@
-import common
-
-Import('*')
-
-env = env.Clone()
-
-env.Prepend(CPPPATH = [
- '#src/mapi',
- '#src/mesa',
-])
-
-if env['platform'] == 'windows':
- env.Prepend(CPPPATH = ['#src/talloc'])
-
-sources = [
- '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_basic_block.cpp',
- 'ir_clone.cpp',
- 'ir_constant_expression.cpp',
- 'ir.cpp',
- 'ir_expression_flattening.cpp',
- 'ir_function_can_inline.cpp',
- 'ir_function.cpp',
- 'ir_hierarchical_visitor.cpp',
- 'ir_hv_accept.cpp',
- 'ir_import_prototypes.cpp',
- 'ir_print_visitor.cpp',
- 'ir_reader.cpp',
- 'ir_rvalue_visitor.cpp',
- 'ir_set_program_inouts.cpp',
- 'ir_validate.cpp',
- 'ir_variable.cpp',
- 'ir_variable_refcount.cpp',
- 'linker.cpp',
- 'link_functions.cpp',
- 'loop_analysis.cpp',
- 'loop_controls.cpp',
- 'loop_unroll.cpp',
- 'lower_discard.cpp',
- 'lower_if_to_cond_assign.cpp',
- 'lower_instructions.cpp',
- 'lower_jumps.cpp',
- 'lower_mat_op_to_vec.cpp',
- 'lower_noise.cpp',
- 'lower_variable_index_to_cond_assign.cpp',
- 'lower_vec_index_to_cond_assign.cpp',
- 'lower_vec_index_to_swizzle.cpp',
- 'lower_vector.cpp',
- 'opt_algebraic.cpp',
- 'opt_constant_folding.cpp',
- 'opt_constant_propagation.cpp',
- 'opt_constant_variable.cpp',
- 'opt_copy_propagation.cpp',
- 'opt_dead_code.cpp',
- 'opt_dead_code_local.cpp',
- 'opt_dead_functions.cpp',
- 'opt_discard_simplification.cpp',
- 'opt_function_inlining.cpp',
- 'opt_if_simplification.cpp',
- 'opt_noop_swizzle.cpp',
- 'opt_redundant_jumps.cpp',
- 'opt_structure_splitting.cpp',
- 'opt_swizzle_swizzle.cpp',
- 'opt_tree_grafting.cpp',
- 's_expression.cpp',
- 'strtod.c',
-]
-
-glsl = env.ConvenienceLibrary(
- target = 'glsl',
- source = sources,
-)
-
-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':
- env.PrependUnique(LIBS = [
- 'user32',
- ])
-
-env.Prepend(LIBS = [glsl, talloc])
-
-env.Program(
- target = 'glsl2',
- source = [
- 'main.cpp',
- ]
-)
-
-env.Program(
- target = 'glcpp',
- source = ['glcpp/glcpp.c'],
-)
diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp
deleted file mode 100644
index b731ba0..0000000
--- a/src/glsl/ir_algebraic.cpp
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * 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;
-
- 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_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/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp
deleted file mode 100644
index 1126042..0000000
--- a/src/glsl/ir_constant_folding.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * 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_optimization.h"
-#include "glsl_types.h"
-
-/**
- * Visitor class for replacing expressions with ir_constant values.
- */
-
-class ir_constant_folding_visitor : public ir_visitor {
-public:
- ir_constant_folding_visitor()
- {
- this->progress = false;
- }
-
- virtual ~ir_constant_folding_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(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 *);
- /*@}*/
-
- void fold_constant(ir_rvalue **rvalue);
-
- bool progress;
-};
-
-void
-ir_constant_folding_visitor::fold_constant(ir_rvalue **rvalue)
-{
- if (*rvalue == NULL || (*rvalue)->ir_type == ir_type_constant)
- return;
-
- ir_constant *constant = (*rvalue)->constant_expression_value();
- if (constant) {
- *rvalue = constant;
- this->progress = true;
- } else {
- (*rvalue)->accept(this);
- }
-}
-
-void
-ir_constant_folding_visitor::visit(ir_variable *ir)
-{
- (void) ir;
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_function_signature *ir)
-{
- visit_exec_list(&ir->body, this);
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_function *ir)
-{
- foreach_iter(exec_list_iterator, iter, *ir) {
- ir_function_signature *const sig = (ir_function_signature *) iter.get();
- sig->accept(this);
- }
-}
-
-void
-ir_constant_folding_visitor::visit(ir_expression *ir)
-{
- unsigned int operand;
-
- for (operand = 0; operand < ir->get_num_operands(); operand++) {
- fold_constant(&ir->operands[operand]);
- }
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_texture *ir)
-{
- fold_constant(&ir->coordinate);
- fold_constant(&ir->projector);
- fold_constant(&ir->shadow_comparitor);
-
- switch (ir->op) {
- case ir_tex:
- break;
- case ir_txb:
- fold_constant(&ir->lod_info.bias);
- break;
- case ir_txf:
- case ir_txl:
- fold_constant(&ir->lod_info.lod);
- break;
- case ir_txd:
- fold_constant(&ir->lod_info.grad.dPdx);
- fold_constant(&ir->lod_info.grad.dPdy);
- break;
- }
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_swizzle *ir)
-{
- fold_constant(&ir->val);
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_dereference_variable *ir)
-{
- (void) ir;
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_dereference_array *ir)
-{
- fold_constant(&ir->array_index);
- ir->array->accept(this);
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_dereference_record *ir)
-{
- ir->record->accept(this);
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_assignment *ir)
-{
- fold_constant(&ir->rhs);
-
- if (ir->condition) {
- /* If the condition is constant, either remove the condition or
- * remove the never-executed assignment.
- */
- ir_constant *const_val = ir->condition->constant_expression_value();
- if (const_val) {
- if (const_val->value.b[0])
- ir->condition = NULL;
- else
- ir->remove();
- this->progress = true;
- }
- }
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_constant *ir)
-{
- (void) ir;
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_call *ir)
-{
- foreach_iter(exec_list_iterator, iter, *ir) {
- ir_rvalue *param = (ir_rvalue *)iter.get();
- ir_rvalue *new_param = param;
- fold_constant(&new_param);
-
- if (new_param != param) {
- param->replace_with(new_param);
- }
- }
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_return *ir)
-{
- fold_constant(&ir->value);
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_discard *ir)
-{
- (void) ir;
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_if *ir)
-{
- fold_constant(&ir->condition);
-
- visit_exec_list(&ir->then_instructions, this);
- visit_exec_list(&ir->else_instructions, this);
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_loop *ir)
-{
- (void) ir;
-}
-
-
-void
-ir_constant_folding_visitor::visit(ir_loop_jump *ir)
-{
- (void) ir;
-}
-
-bool
-do_constant_folding(exec_list *instructions)
-{
- ir_constant_folding_visitor constant_folding;
-
- visit_exec_list(instructions, &constant_folding);
-
- return constant_folding.progress;
-}
diff --git a/src/glsl/ir_constant_propagation.cpp b/src/glsl/ir_constant_propagation.cpp
deleted file mode 100644
index 76c1ce7..0000000
--- a/src/glsl/ir_constant_propagation.cpp
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * Constantright © 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_enter(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 (!*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;
-
- switch (type->base_type) {
- case GLSL_TYPE_FLOAT:
- data.f[i] = found->constant->value.f[channel];
- break;
- case GLSL_TYPE_INT:
- data.i[i] = found->constant->value.i[channel];
- break;
- case GLSL_TYPE_UINT:
- data.u[i] = found->constant->value.u[channel];
- break;
- case GLSL_TYPE_BOOL:
- data.b[i] = found->constant->value.b[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_enter(ir_assignment *ir)
-{
- /* Inline accepting children, skipping the LHS. */
- ir->rhs->accept(this);
- handle_rvalue(&ir->rhs);
-
- if (ir->condition) {
- ir->condition->accept(this);
- handle_rvalue(&ir->condition);
- }
-
- kill(ir->lhs->variable_referenced(), ir->write_mask);
-
- add_constant(ir);
-
- return visit_continue_with_parent;
-}
-
-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/src/glsl/ir_constant_variable.cpp b/src/glsl/ir_constant_variable.cpp
deleted file mode 100644
index 1fb73e7..0000000
--- a/src/glsl/ir_constant_variable.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * 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/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp
deleted file mode 100644
index 6c211f0..0000000
--- a/src/glsl/ir_copy_propagation.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * 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_enter(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_enter(ir_assignment *ir)
-{
- ir_visitor_status s;
-
- /* ir_assignment::accept(ir_hv *v), skipping the LHS so that we can
- * avoid copy propagating into the LHS.
- *
- * Note that this means we won't copy propagate into the derefs of
- * an array index. Oh well.
- */
-
- s = ir->rhs->accept(this);
- assert(s == visit_continue);
-
- if (ir->condition) {
- s = ir->condition->accept(this);
- assert(s == visit_continue);
- }
-
- kill(ir->lhs->variable_referenced());
-
- add_copy(ir);
-
- return visit_continue_with_parent;
-}
-
-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)
-{
- 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/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp
deleted file mode 100644
index 7ff580d..0000000
--- a/src/glsl/ir_dead_code.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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.
- */
- 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/src/glsl/ir_dead_code_local.cpp b/src/glsl/ir_dead_code_local.cpp
deleted file mode 100644
index 4bbedf0..0000000
--- a/src/glsl/ir_dead_code_local.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * 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/src/glsl/ir_dead_functions.cpp b/src/glsl/ir_dead_functions.cpp
deleted file mode 100644
index 2655444..0000000
--- a/src/glsl/ir_dead_functions.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
- /*
- * 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/src/glsl/ir_explog_to_explog2.cpp b/src/glsl/ir_explog_to_explog2.cpp
deleted file mode 100644
index 4fe1daa..0000000
--- a/src/glsl/ir_explog_to_explog2.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 <math.h>
-#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/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp
deleted file mode 100644
index 874602c..0000000
--- a/src/glsl/ir_function_inlining.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * 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/src/glsl/ir_if_simplification.cpp b/src/glsl/ir_if_simplification.cpp
deleted file mode 100644
index 6882ef7..0000000
--- a/src/glsl/ir_if_simplification.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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
- *
- * 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/src/glsl/ir_if_to_cond_assign.cpp b/src/glsl/ir_if_to_cond_assign.cpp
deleted file mode 100644
index 0b87413..0000000
--- a/src/glsl/ir_if_to_cond_assign.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp
deleted file mode 100644
index 80e0579..0000000
--- a/src/glsl/ir_mat_op_to_vec.cpp
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * 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;
- }
-
- 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);
-
- 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(base_ir) ir_dereference_variable(var);
-
- if (var->type->is_matrix()) {
- deref = new(base_ir) ir_dereference_array(var,
- new(base_ir) ir_constant(col));
- } else {
- assert(col == 0);
- }
-
- return new(base_ir) 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(base_ir) ir_dereference_variable(var);
- } else {
- deref = new(base_ir) ir_dereference_variable(var);
- deref = new(base_ir) ir_dereference_array(deref,
- new(base_ir) 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(base_ir) 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(base_ir) ir_expression(ir_binop_mul,
- a->type,
- a,
- b);
- expr = new(base_ir) ir_expression(ir_binop_add,
- a->type,
- expr,
- mul_expr);
- }
-
- ir_rvalue *result = get_column(result_var, b_col);
- assign = new(base_ir) 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(base_ir) 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(base_ir) ir_expression(ir_binop_mul,
- result_var->type,
- a,
- b);
- expr = new(base_ir) ir_expression(ir_binop_add,
- result_var->type,
- expr,
- mul_expr);
- }
-
- ir_rvalue *result = new(base_ir) ir_dereference_variable(result_var);
- assign = new(base_ir) 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(base_ir) 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(base_ir) ir_dereference_variable(result_var);
- result = new(base_ir) ir_swizzle(result, i, 0, 0, 0, 1);
-
- column_expr = new(base_ir) ir_expression(ir_binop_dot,
- result->type,
- a,
- b);
-
- column_assign = new(base_ir) 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(base_ir) ir_dereference_variable(b_var);
- ir_rvalue *result = get_column(result_var, i);
- ir_expression *column_expr;
- ir_assignment *column_assign;
-
- column_expr = new(base_ir) ir_expression(ir_binop_mul,
- result->type,
- a,
- b);
-
- column_assign = new(base_ir) ir_assignment(result,
- column_expr,
- NULL);
- base_ir->insert_before(column_assign);
- }
-}
-
-ir_visitor_status
-ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign)
-{
- ir_expression *expr = assign->rhs->as_expression();
- bool found_matrix = false;
- unsigned int i, matrix_columns = 1;
- ir_variable *op_var[2];
-
- if (!expr)
- return visit_continue;
-
- for (i = 0; i < expr->get_num_operands(); i++) {
- if (expr->operands[i]->type->is_matrix()) {
- found_matrix = true;
- matrix_columns = expr->operands[i]->type->matrix_columns;
- break;
- }
- }
- if (!found_matrix)
- return visit_continue;
-
- ir_dereference_variable *lhs_deref = 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 < expr->get_num_operands(); i++) {
- ir_assignment *assign;
-
- op_var[i] = new(base_ir) ir_variable(expr->operands[i]->type,
- "mat_op_to_vec",
- ir_var_temporary);
- base_ir->insert_before(op_var[i]);
-
- lhs_deref = new(base_ir) ir_dereference_variable(op_var[i]);
- assign = new(base_ir) ir_assignment(lhs_deref,
- expr->operands[i],
- NULL);
- base_ir->insert_before(assign);
- }
-
- /* OK, time to break down this matrix operation. */
- switch (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(base_ir) ir_expression(expr->operation,
- result->type,
- op0,
- NULL);
-
- column_assign = new(base_ir) 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(base_ir) ir_expression(expr->operation,
- result->type,
- op0,
- op1);
-
- column_assign = new(base_ir) 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;
- default:
- printf("FINISHME: Handle matrix operation for %s\n", expr->operator_string());
- abort();
- }
- assign->remove();
- this->made_progress = true;
-
- return visit_continue;
-}
diff --git a/src/glsl/ir_noop_swizzle.cpp b/src/glsl/ir_noop_swizzle.cpp
deleted file mode 100644
index b78c87b..0000000
--- a/src/glsl/ir_noop_swizzle.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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 != 1)
- return;
- if (elems >= 4 && swiz->mask.w != 1)
- 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/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp
deleted file mode 100644
index 91f6dac..0000000
--- a/src/glsl/ir_structure_splitting.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * 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;
-
-class variable_entry : public exec_node
-{
-public:
- variable_entry(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_entry *get_variable_entry(ir_variable *var);
-
- /* List of variable_entry */
- exec_list variable_list;
-
- void *mem_ctx;
-};
-
-variable_entry *
-ir_structure_reference_visitor::get_variable_entry(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_entry *entry = (variable_entry *)iter.get();
- if (entry->var == var)
- return entry;
- }
-
- variable_entry *entry = new(mem_ctx) variable_entry(var);
- this->variable_list.push_tail(entry);
- return entry;
-}
-
-
-ir_visitor_status
-ir_structure_reference_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_structure_reference_visitor::visit(ir_dereference_variable *ir)
-{
- ir_variable *const var = ir->variable_referenced();
- variable_entry *entry = this->get_variable_entry(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_entry *get_splitting_entry(ir_variable *var);
-
- exec_list *variable_list;
- void *mem_ctx;
-};
-
-variable_entry *
-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_entry *entry = (variable_entry *)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_entry *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_entry *lhs_entry = lhs_deref ? get_splitting_entry(lhs_deref->var) : NULL;
- variable_entry *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_entry *entry = (variable_entry *)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_entry *entry = (variable_entry *)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/src/glsl/ir_sub_to_add_neg.cpp b/src/glsl/ir_sub_to_add_neg.cpp
deleted file mode 100644
index 7ed8c14..0000000
--- a/src/glsl/ir_sub_to_add_neg.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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/src/glsl/ir_swizzle_swizzle.cpp b/src/glsl/ir_swizzle_swizzle.cpp
deleted file mode 100644
index 0ffb4fa..0000000
--- a/src/glsl/ir_swizzle_swizzle.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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/src/glsl/ir_tree_grafting.cpp b/src/glsl/ir_tree_grafting.cpp
deleted file mode 100644
index 6acc5b8..0000000
--- a/src/glsl/ir_tree_grafting.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * 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)
-{
- /* Reminder: iterating ir_call iterates its parameters. */
- foreach_iter(exec_list_iterator, iter, *ir) {
- ir_rvalue *ir = (ir_rvalue *)iter.get();
- ir_rvalue *new_ir = ir;
-
- if (do_graft(&new_ir)) {
- ir->replace_with(new_ir);
- return visit_stop;
- }
- }
-
- 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/src/glsl/ir_vec_index_to_cond_assign.cpp b/src/glsl/ir_vec_index_to_cond_assign.cpp
deleted file mode 100644
index cd8dedf..0000000
--- a/src/glsl/ir_vec_index_to_cond_assign.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * 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/src/glsl/ir_vec_index_to_swizzle.cpp b/src/glsl/ir_vec_index_to_swizzle.cpp
deleted file mode 100644
index 969dc8f..0000000
--- a/src/glsl/ir_vec_index_to_swizzle.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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/src/glsl/main.cpp b/src/glsl/main.cpp
index b3fea09..a4dbbda 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -304,6 +304,7 @@ void execute(void (* function)(), float * data)
printf ("\n *** test_scan elapsed CPU time: %fs \n *** fps=%.2f, tpf=%.2fms \n",
elapsed, frames / elapsed, elapsed / frames * 1000);
printf("gl_FragColor=%.2f, %.2f, %.2f %.2f \n", outputs[0], outputs[1], outputs[2], outputs[3]);
+ assert(0.1f < outputs[3]);
#ifdef __arm__
SaveBMP("/sdcard/mesa.bmp", frameSurface, width, height);
#else
@@ -365,7 +366,6 @@ void jit(llvm::Module * mod)
void (* function)() = (void (*)())ee->getPointerToFunction(func);
execute(function, data);
puts("USE_LLVM_EXECUTIONENGINE");
- printf("gl_FragColor=%.2f, %.2f, %.2f %.2f \n", data[0], data[1], data[2], data[3]);
}
#else
diff --git a/src/mesa/main/.gitignore b/src/mesa/main/.gitignore
deleted file mode 100644
index 391c334..0000000
--- a/src/mesa/main/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-api_exec_es1.c
-api_exec_es2.c
-get_es1.c
-get_es2.c
diff --git a/src/mesa/main/APIspec.dtd b/src/mesa/main/APIspec.dtd
deleted file mode 100644
index efcfa31..0000000
--- a/src/mesa/main/APIspec.dtd
+++ /dev/null
@@ -1,52 +0,0 @@
-<!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/src/mesa/main/APIspec.py b/src/mesa/main/APIspec.py
deleted file mode 100644
index 6947f73..0000000
--- a/src/mesa/main/APIspec.py
+++ /dev/null
@@ -1,617 +0,0 @@
-#!/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/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
deleted file mode 100644
index 16d0c94..0000000
--- a/src/mesa/main/APIspec.xml
+++ /dev/null
@@ -1,4341 +0,0 @@
-<?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_BGRA_EXT"/>
- <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>
-
- <desc name="format" category="EXT_texture_format_BGRA8888">
- <value name="GL_BGRA_EXT"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- </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="_es_" 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="_es_" template="Material" gltype="GLfloat" expand_vector="true"/>
- <function name="Materialfv" default_prefix="_es_" 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="_es_" 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="_es_" 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="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/>
- <function name="VertexAttrib2f" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/>
- <function name="VertexAttrib3f" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/>
- <function name="VertexAttrib4f" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/>
- <function name="VertexAttrib1fv" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="1"/>
- <function name="VertexAttrib2fv" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="2"/>
- <function name="VertexAttrib3fv" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="3"/>
- <function name="VertexAttrib4fv" default_prefix="_es_" 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" external="true" 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" external="true" template="Material" gltype="GLfloat" expand_vector="true"/>
- <function name="Materialfv" external="true" 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" external="true" 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" external="true" 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_format_BGRA8888"/>
-
- <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" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/>
- <function name="VertexAttrib2f" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/>
- <function name="VertexAttrib3f" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/>
- <function name="VertexAttrib4f" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/>
- <function name="VertexAttrib1fv" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="1"/>
- <function name="VertexAttrib2fv" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="2"/>
- <function name="VertexAttrib3fv" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="3"/>
- <function name="VertexAttrib4fv" external="true" 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/src/mesa/main/APIspecutil.py b/src/mesa/main/APIspecutil.py
deleted file mode 100644
index 9e604bb..0000000
--- a/src/mesa/main/APIspecutil.py
+++ /dev/null
@@ -1,272 +0,0 @@
-#!/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/src/mesa/main/descrip.mms b/src/mesa/main/descrip.mms
deleted file mode 100644
index 70bc263..0000000
--- a/src/mesa/main/descrip.mms
+++ /dev/null
@@ -1,255 +0,0 @@
-# Makefile for core library for VMS
-# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
-# Last revision : 29 September 2008
-
-.first
- define gl [---.include.gl]
- define math [-.math]
- define shader [-.shader]
- define glapi [-.glapi]
- define main [-.main]
-
-.include [---]mms-config.
-
-##### MACROS #####
-
-VPATH = RCS
-
-INCDIR = [---.include],[-.glapi],[-.shader]
-LIBDIR = [---.lib]
-CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm
-
-SOURCES =accum.c \
- api_arrayelt.c \
- api_exec.c \
- api_loopback.c \
- api_noop.c \
- api_validate.c \
- attrib.c \
- arrayobj.c \
- blend.c \
- bufferobj.c \
- buffers.c \
- clear.c \
- clip.c \
- colortab.c \
- context.c \
- convolve.c \
- debug.c \
- depth.c \
- depthstencil.c \
- dlist.c \
- drawpix.c \
- enable.c \
- enums.c \
- eval.c \
- execmem.c \
- extensions.c \
- fbobject.c \
- feedback.c \
- ffvertex_prog.c \
- fog.c \
- framebuffer.c \
- get.c \
- getstring.c \
- hash.c \
- hint.c \
- histogram.c \
- image.c \
- imports.c \
- light.c \
- lines.c \
- matrix.c \
- mipmap.c \
- mm.c \
- multisample.c \
- pixel.c \
- pixelstore.c \
- points.c \
- polygon.c \
- rastpos.c \
- rbadaptors.c \
- readpix.c \
- renderbuffer.c \
- scissor.c \
- shaders.c \
- state.c \
- stencil.c \
- texcompress.c \
- texcompress_fxt1.c \
- texcompress_s3tc.c \
- texenv.c \
- texenvprogram.c \
- texformat.c \
- texgen.c \
- teximage.c \
- texobj.c \
- texparam.c \
- texrender.c \
- texstate.c \
- texstore.c \
- varray.c \
- vtxfmt.c \
- queryobj.c \
- rbadaptors.c
-
-OBJECTS=accum.obj,\
-api_arrayelt.obj,\
-api_exec.obj,\
-api_loopback.obj,\
-api_noop.obj,\
-api_validate.obj,\
-arrayobj.obj,\
-attrib.obj,\
-blend.obj,\
-bufferobj.obj,\
-buffers.obj,\
-clear.obj,\
-clip.obj,\
-colortab.obj,\
-context.obj,\
-convolve.obj,\
-debug.obj,\
-depth.obj,\
-depthstencil.obj,\
-dlist.obj,\
-drawpix.obj,\
-enable.obj,\
-enums.obj,\
-eval.obj,\
-execmem.obj,\
-extensions.obj,\
-fbobject.obj,\
-feedback.obj,\
-ffvertex_prog.obj,\
-fog.obj,\
-framebuffer.obj,\
-get.obj,\
-getstring.obj,\
-hash.obj,\
-hint.obj,\
-histogram.obj,\
-image.obj,\
-imports.obj,\
-light.obj,\
-lines.obj,\
-matrix.obj,\
-mipmap.obj,\
-mm.obj,\
-multisample.obj,\
-pixel.obj,\
-pixelstore.obj,\
-points.obj,\
-polygon.obj,\
-rastpos.obj,\
-readpix.obj,\
-renderbuffer.obj,\
-scissor.obj,\
-shaders.obj,\
-state.obj,\
-stencil.obj,\
-texcompress.obj,\
-texcompress_fxt1.obj,\
-texcompress_s3tc.obj,\
-texenv.obj,\
-texenvprogram.obj,\
-texformat.obj,\
-texgen.obj,\
-teximage.obj,\
-texobj.obj,\
-texparam.obj,\
-texrender.obj,\
-texstate.obj,\
-texstore.obj,\
-varray.obj,\
-vtxfmt.obj,\
-queryobj.obj,\
-rbadaptors.obj
-
-##### RULES #####
-
-VERSION=Mesa V3.4
-
-##### TARGETS #####
-# Make the library
-$(LIBDIR)$(GL_LIB) : $(OBJECTS)
- @ $(MAKELIB) $(LIBDIR)$(GL_LIB) $(OBJECTS)
-
-clean :
- purge
- delete *.obj;*
-
-accum.obj : accum.c
-api_arrayelt.obj : api_arrayelt.c
-api_loopback.obj : api_loopback.c
-api_noop.obj : api_noop.c
-api_validate.obj : api_validate.c
-arrayobj.obj : arrayobj.c
-attrib.obj : attrib.c
-blend.obj : blend.c
-bufferobj.obj : bufferobj.c
-buffers.obj : buffers.c
-clip.obj : clip.c
-colortab.obj : colortab.c
-context.obj : context.c
-convolve.obj : convolve.c
-debug.obj : debug.c
-depth.obj : depth.c
-depthstencil.obj : depthstencil.c
-dlist.obj : dlist.c
-drawpix.obj : drawpix.c
-enable.obj : enable.c
-enums.obj : enums.c
-eval.obj : eval.c
-execmem.obj : execmem.c
-extensions.obj : extensions.c
-fbobject.obj : fbobject.c
-feedback.obj : feedback.c
-fog.obj : fog.c
-framebuffer.obj : framebuffer.c
-get.obj : get.c
-getstring.obj : getstring.c
-hash.obj : hash.c
-hint.obj : hint.c
-histogram.obj : histogram.c
-image.obj : image.c
-imports.obj : imports.c vsnprintf.c
-light.obj : light.c
-lines.obj : lines.c
-matrix.obj : matrix.c
-mipmap.obj : mipmap.c
-mm.obj : mm.c
-pixel.obj : pixel.c
-points.obj : points.c
-polygon.obj : polygon.c
-rastpos.obj : rastpos.c
-rbadaptors.obj : rbadaptors.c
-renderbuffer.obj : renderbuffer.c
-state.obj : state.c
-stencil.obj : stencil.c
-texcompress.obj : texcompress.c
-texcompress_fxt1.obj : texcompress_fxt1.c
- cc$(CFLAGS)/warn=(disable=SHIFTCOUNT) texcompress_fxt1.c
-texcompress_s3tc.obj : texcompress_s3tc.c
-texenvprogram.obj : texenvprogram.c
-texformat.obj : texformat.c
-teximage.obj : teximage.c
-texobj.obj : texobj.c
-texrender.obj : texrender.c
-texstate.obj : texstate.c
-texstore.obj : texstore.c
-varray.obj : varray.c
-vtxfmt.obj : vtxfmt.c
-shaders.obj : shaders.c
-queryobj.obj : queryobj.c
-rbadaptors.obj : rbadaptors.c
-clear.obj : clear.c
-multisample.obj : multisample.c
-scissor.obj : scissor.c
-texenv.obj : texenv.c
-texgen.obj : texgen.c
-texparam.obj : texparam.c
-readpix.obj : readpix.c
-ffvertex_prog.obj : ffvertex_prog.c
-api_exec.obj : api_exec.c
-pixelstore.obj : pixelstore.c
diff --git a/src/mesa/main/dispatch.h b/src/mesa/main/dispatch.h
deleted file mode 100644
index a597959..0000000
--- a/src/mesa/main/dispatch.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * (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.
- */
-
-#ifndef _DISPATCH_H
-#define _DISPATCH_H
-
-#include "main/mfeatures.h"
-
-#if FEATURE_remap_table
-#define _GLAPI_USE_REMAP_TABLE
-#endif
-
-#include "main/glapidispatch.h"
-
-#endif /* _DISPATCH_H */
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
deleted file mode 100644
index 6c0c556..0000000
--- a/src/mesa/main/dlist.c
+++ /dev/null
@@ -1,10195 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * Copyright (C) 1999-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 dlist.c
- * Display lists management functions.
- */
-
-#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
-#include "bufferobj.h"
-#endif
-#include "arrayobj.h"
-#include "context.h"
-#include "dlist.h"
-#include "enums.h"
-#include "eval.h"
-#include "framebuffer.h"
-#include "glapi/glapi.h"
-#include "hash.h"
-#include "image.h"
-#include "light.h"
-#include "macros.h"
-#include "pack.h"
-#include "queryobj.h"
-#include "teximage.h"
-#include "mtypes.h"
-#include "varray.h"
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
-#include "arbprogram.h"
-#endif
-#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
-#include "nvprogram.h"
-#endif
-
-#include "math/m_matrix.h"
-
-#include "main/dispatch.h"
-
-
-
-/**
- * Other parts of Mesa (such as the VBO module) can plug into the display
- * list system. This structure describes new display list instructions.
- */
-struct gl_list_instruction
-{
- GLuint Size;
- void (*Execute)( struct gl_context *ctx, void *data );
- void (*Destroy)( struct gl_context *ctx, void *data );
- void (*Print)( struct gl_context *ctx, void *data );
-};
-
-
-#define MAX_DLIST_EXT_OPCODES 16
-
-/**
- * Used by device drivers to hook new commands into display lists.
- */
-struct gl_list_extensions
-{
- struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
- GLuint NumOpcodes;
-};
-
-
-
-/**
- * Flush vertices.
- *
- * \param ctx GL context.
- *
- * Checks if dd_function_table::SaveNeedFlush is marked to flush
- * stored (save) vertices, and calls
- * dd_function_table::SaveFlushVertices if so.
- */
-#define SAVE_FLUSH_VERTICES(ctx) \
-do { \
- if (ctx->Driver.SaveNeedFlush) \
- ctx->Driver.SaveFlushVertices(ctx); \
-} while (0)
-
-
-/**
- * Macro to assert that the API call was made outside the
- * glBegin()/glEnd() pair, with return value.
- *
- * \param ctx GL context.
- * \param retval value to return value in case the assertion fails.
- */
-#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
-do { \
- if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
- ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
- _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
- return retval; \
- } \
-} while (0)
-
-/**
- * Macro to assert that the API call was made outside the
- * glBegin()/glEnd() pair.
- *
- * \param ctx GL context.
- */
-#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
-do { \
- if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
- ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
- _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
- return; \
- } \
-} while (0)
-
-/**
- * Macro to assert that the API call was made outside the
- * glBegin()/glEnd() pair and flush the vertices.
- *
- * \param ctx GL context.
- */
-#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
-do { \
- ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
- SAVE_FLUSH_VERTICES(ctx); \
-} while (0)
-
-/**
- * Macro to assert that the API call was made outside the
- * glBegin()/glEnd() pair and flush the vertices, with return value.
- *
- * \param ctx GL context.
- * \param retval value to return value in case the assertion fails.
- */
-#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
-do { \
- ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
- SAVE_FLUSH_VERTICES(ctx); \
-} while (0)
-
-
-
-/**
- * Display list opcodes.
- *
- * The fact that these identifiers are assigned consecutive
- * integer values starting at 0 is very important, see InstSize array usage)
- */
-typedef enum
-{
- OPCODE_INVALID = -1, /* Force signed enum */
- OPCODE_ACCUM,
- OPCODE_ALPHA_FUNC,
- OPCODE_BIND_TEXTURE,
- OPCODE_BITMAP,
- OPCODE_BLEND_COLOR,
- OPCODE_BLEND_EQUATION,
- OPCODE_BLEND_EQUATION_SEPARATE,
- OPCODE_BLEND_FUNC_SEPARATE,
- OPCODE_CALL_LIST,
- OPCODE_CALL_LIST_OFFSET,
- OPCODE_CLEAR,
- OPCODE_CLEAR_ACCUM,
- OPCODE_CLEAR_COLOR,
- OPCODE_CLEAR_DEPTH,
- OPCODE_CLEAR_INDEX,
- OPCODE_CLEAR_STENCIL,
- OPCODE_CLEAR_BUFFER_IV,
- OPCODE_CLEAR_BUFFER_UIV,
- OPCODE_CLEAR_BUFFER_FV,
- OPCODE_CLEAR_BUFFER_FI,
- OPCODE_CLIP_PLANE,
- OPCODE_COLOR_MASK,
- OPCODE_COLOR_MASK_INDEXED,
- OPCODE_COLOR_MATERIAL,
- OPCODE_COLOR_TABLE,
- OPCODE_COLOR_TABLE_PARAMETER_FV,
- OPCODE_COLOR_TABLE_PARAMETER_IV,
- OPCODE_COLOR_SUB_TABLE,
- OPCODE_CONVOLUTION_FILTER_1D,
- OPCODE_CONVOLUTION_FILTER_2D,
- OPCODE_CONVOLUTION_PARAMETER_I,
- OPCODE_CONVOLUTION_PARAMETER_IV,
- OPCODE_CONVOLUTION_PARAMETER_F,
- OPCODE_CONVOLUTION_PARAMETER_FV,
- OPCODE_COPY_COLOR_SUB_TABLE,
- OPCODE_COPY_COLOR_TABLE,
- OPCODE_COPY_PIXELS,
- OPCODE_COPY_TEX_IMAGE1D,
- OPCODE_COPY_TEX_IMAGE2D,
- OPCODE_COPY_TEX_SUB_IMAGE1D,
- OPCODE_COPY_TEX_SUB_IMAGE2D,
- OPCODE_COPY_TEX_SUB_IMAGE3D,
- OPCODE_CULL_FACE,
- OPCODE_DEPTH_FUNC,
- OPCODE_DEPTH_MASK,
- OPCODE_DEPTH_RANGE,
- OPCODE_DISABLE,
- OPCODE_DISABLE_INDEXED,
- OPCODE_DRAW_BUFFER,
- OPCODE_DRAW_PIXELS,
- OPCODE_ENABLE,
- OPCODE_ENABLE_INDEXED,
- OPCODE_EVALMESH1,
- OPCODE_EVALMESH2,
- OPCODE_FOG,
- OPCODE_FRONT_FACE,
- OPCODE_FRUSTUM,
- OPCODE_HINT,
- OPCODE_HISTOGRAM,
- OPCODE_INDEX_MASK,
- OPCODE_INIT_NAMES,
- OPCODE_LIGHT,
- OPCODE_LIGHT_MODEL,
- OPCODE_LINE_STIPPLE,
- OPCODE_LINE_WIDTH,
- OPCODE_LIST_BASE,
- OPCODE_LOAD_IDENTITY,
- OPCODE_LOAD_MATRIX,
- OPCODE_LOAD_NAME,
- OPCODE_LOGIC_OP,
- OPCODE_MAP1,
- OPCODE_MAP2,
- OPCODE_MAPGRID1,
- OPCODE_MAPGRID2,
- OPCODE_MATRIX_MODE,
- OPCODE_MIN_MAX,
- OPCODE_MULT_MATRIX,
- OPCODE_ORTHO,
- OPCODE_PASSTHROUGH,
- OPCODE_PIXEL_MAP,
- OPCODE_PIXEL_TRANSFER,
- OPCODE_PIXEL_ZOOM,
- OPCODE_POINT_SIZE,
- OPCODE_POINT_PARAMETERS,
- OPCODE_POLYGON_MODE,
- OPCODE_POLYGON_STIPPLE,
- OPCODE_POLYGON_OFFSET,
- OPCODE_POP_ATTRIB,
- OPCODE_POP_MATRIX,
- OPCODE_POP_NAME,
- OPCODE_PRIORITIZE_TEXTURE,
- OPCODE_PUSH_ATTRIB,
- OPCODE_PUSH_MATRIX,
- OPCODE_PUSH_NAME,
- OPCODE_RASTER_POS,
- OPCODE_READ_BUFFER,
- OPCODE_RESET_HISTOGRAM,
- OPCODE_RESET_MIN_MAX,
- OPCODE_ROTATE,
- OPCODE_SCALE,
- OPCODE_SCISSOR,
- OPCODE_SELECT_TEXTURE_SGIS,
- OPCODE_SELECT_TEXTURE_COORD_SET,
- OPCODE_SHADE_MODEL,
- OPCODE_STENCIL_FUNC,
- OPCODE_STENCIL_MASK,
- OPCODE_STENCIL_OP,
- OPCODE_TEXENV,
- OPCODE_TEXGEN,
- OPCODE_TEXPARAMETER,
- OPCODE_TEX_IMAGE1D,
- OPCODE_TEX_IMAGE2D,
- OPCODE_TEX_IMAGE3D,
- OPCODE_TEX_SUB_IMAGE1D,
- OPCODE_TEX_SUB_IMAGE2D,
- OPCODE_TEX_SUB_IMAGE3D,
- OPCODE_TRANSLATE,
- OPCODE_VIEWPORT,
- OPCODE_WINDOW_POS,
- /* GL_ARB_multitexture */
- OPCODE_ACTIVE_TEXTURE,
- /* GL_ARB_texture_compression */
- OPCODE_COMPRESSED_TEX_IMAGE_1D,
- OPCODE_COMPRESSED_TEX_IMAGE_2D,
- OPCODE_COMPRESSED_TEX_IMAGE_3D,
- OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
- OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
- OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
- /* GL_ARB_multisample */
- OPCODE_SAMPLE_COVERAGE,
- /* GL_ARB_window_pos */
- OPCODE_WINDOW_POS_ARB,
- /* GL_NV_vertex_program */
- OPCODE_BIND_PROGRAM_NV,
- OPCODE_EXECUTE_PROGRAM_NV,
- OPCODE_REQUEST_RESIDENT_PROGRAMS_NV,
- OPCODE_LOAD_PROGRAM_NV,
- OPCODE_TRACK_MATRIX_NV,
- /* GL_NV_fragment_program */
- OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
- OPCODE_PROGRAM_NAMED_PARAMETER_NV,
- /* GL_EXT_stencil_two_side */
- OPCODE_ACTIVE_STENCIL_FACE_EXT,
- /* GL_EXT_depth_bounds_test */
- OPCODE_DEPTH_BOUNDS_EXT,
- /* GL_ARB_vertex/fragment_program */
- OPCODE_PROGRAM_STRING_ARB,
- OPCODE_PROGRAM_ENV_PARAMETER_ARB,
- /* GL_ARB_occlusion_query */
- OPCODE_BEGIN_QUERY_ARB,
- OPCODE_END_QUERY_ARB,
- /* GL_ARB_draw_buffers */
- OPCODE_DRAW_BUFFERS_ARB,
- /* GL_ATI_fragment_shader */
- OPCODE_TEX_BUMP_PARAMETER_ATI,
- /* GL_ATI_fragment_shader */
- OPCODE_BIND_FRAGMENT_SHADER_ATI,
- OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
- /* OpenGL 2.0 */
- OPCODE_STENCIL_FUNC_SEPARATE,
- OPCODE_STENCIL_OP_SEPARATE,
- OPCODE_STENCIL_MASK_SEPARATE,
-
- /* GL_ARB_shader_objects */
- OPCODE_USE_PROGRAM,
- OPCODE_UNIFORM_1F,
- OPCODE_UNIFORM_2F,
- OPCODE_UNIFORM_3F,
- OPCODE_UNIFORM_4F,
- OPCODE_UNIFORM_1FV,
- OPCODE_UNIFORM_2FV,
- OPCODE_UNIFORM_3FV,
- OPCODE_UNIFORM_4FV,
- OPCODE_UNIFORM_1I,
- OPCODE_UNIFORM_2I,
- OPCODE_UNIFORM_3I,
- OPCODE_UNIFORM_4I,
- OPCODE_UNIFORM_1IV,
- OPCODE_UNIFORM_2IV,
- OPCODE_UNIFORM_3IV,
- OPCODE_UNIFORM_4IV,
- OPCODE_UNIFORM_MATRIX22,
- OPCODE_UNIFORM_MATRIX33,
- OPCODE_UNIFORM_MATRIX44,
- OPCODE_UNIFORM_MATRIX23,
- OPCODE_UNIFORM_MATRIX32,
- OPCODE_UNIFORM_MATRIX24,
- OPCODE_UNIFORM_MATRIX42,
- 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,
-
- /* Vertex attributes -- fallback for when optimized display
- * list build isn't active.
- */
- OPCODE_ATTR_1F_NV,
- OPCODE_ATTR_2F_NV,
- OPCODE_ATTR_3F_NV,
- OPCODE_ATTR_4F_NV,
- OPCODE_ATTR_1F_ARB,
- OPCODE_ATTR_2F_ARB,
- OPCODE_ATTR_3F_ARB,
- OPCODE_ATTR_4F_ARB,
- OPCODE_MATERIAL,
- OPCODE_BEGIN,
- OPCODE_END,
- OPCODE_RECTF,
- OPCODE_EVAL_C1,
- OPCODE_EVAL_C2,
- OPCODE_EVAL_P1,
- OPCODE_EVAL_P2,
-
- /* GL_EXT_provoking_vertex */
- OPCODE_PROVOKING_VERTEX,
-
- /* GL_EXT_transform_feedback */
- OPCODE_BEGIN_TRANSFORM_FEEDBACK,
- OPCODE_END_TRANSFORM_FEEDBACK,
-
- /* GL_EXT_texture_integer */
- OPCODE_CLEARCOLOR_I,
- OPCODE_CLEARCOLOR_UI,
- OPCODE_TEXPARAMETER_I,
- OPCODE_TEXPARAMETER_UI,
-
- /* GL_EXT_separate_shader_objects */
- OPCODE_ACTIVE_PROGRAM_EXT,
- OPCODE_USE_SHADER_PROGRAM_EXT,
-
- /* The following three are meta instructions */
- OPCODE_ERROR, /* raise compiled-in error */
- OPCODE_CONTINUE,
- OPCODE_END_OF_LIST,
- OPCODE_EXT_0
-} OpCode;
-
-
-
-/**
- * Display list node.
- *
- * Display list instructions are stored as sequences of "nodes". Nodes
- * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
- * are linked together with a pointer.
- *
- * Each instruction in the display list is stored as a sequence of
- * contiguous nodes in memory.
- * Each node is the union of a variety of data types.
- */
-union gl_dlist_node
-{
- OpCode opcode;
- GLboolean b;
- GLbitfield bf;
- GLubyte ub;
- GLshort s;
- GLushort us;
- GLint i;
- GLuint ui;
- GLenum e;
- GLfloat f;
- GLvoid *data;
- void *next; /* If prev node's opcode==OPCODE_CONTINUE */
-};
-
-
-typedef union gl_dlist_node Node;
-
-
-/**
- * How many nodes to allocate at a time.
- *
- * \note Reduced now that we hold vertices etc. elsewhere.
- */
-#define BLOCK_SIZE 256
-
-
-
-/**
- * Number of nodes of storage needed for each instruction.
- * Sizes for dynamically allocated opcodes are stored in the context struct.
- */
-static GLuint InstSize[OPCODE_END_OF_LIST + 1];
-
-
-#if FEATURE_dlist
-
-
-void mesa_print_display_list(GLuint list);
-
-
-/**********************************************************************/
-/***** Private *****/
-/**********************************************************************/
-
-
-/**
- * Make an empty display list. This is used by glGenLists() to
- * reserve display list IDs.
- */
-static struct gl_display_list *
-make_list(GLuint name, GLuint count)
-{
- struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
- dlist->Name = name;
- dlist->Head = (Node *) malloc(sizeof(Node) * count);
- dlist->Head[0].opcode = OPCODE_END_OF_LIST;
- return dlist;
-}
-
-
-/**
- * Lookup function to just encapsulate casting.
- */
-static INLINE struct gl_display_list *
-lookup_list(struct gl_context *ctx, GLuint list)
-{
- return (struct gl_display_list *)
- _mesa_HashLookup(ctx->Shared->DisplayList, list);
-}
-
-
-/** Is the given opcode an extension code? */
-static INLINE GLboolean
-is_ext_opcode(OpCode opcode)
-{
- return (opcode >= OPCODE_EXT_0);
-}
-
-
-/** Destroy an extended opcode instruction */
-static GLint
-ext_opcode_destroy(struct gl_context *ctx, Node *node)
-{
- const GLint i = node[0].opcode - OPCODE_EXT_0;
- GLint step;
- ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
- step = ctx->ListExt->Opcode[i].Size;
- return step;
-}
-
-
-/** Execute an extended opcode instruction */
-static GLint
-ext_opcode_execute(struct gl_context *ctx, Node *node)
-{
- const GLint i = node[0].opcode - OPCODE_EXT_0;
- GLint step;
- ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
- step = ctx->ListExt->Opcode[i].Size;
- return step;
-}
-
-
-/** Print an extended opcode instruction */
-static GLint
-ext_opcode_print(struct gl_context *ctx, Node *node)
-{
- const GLint i = node[0].opcode - OPCODE_EXT_0;
- GLint step;
- ctx->ListExt->Opcode[i].Print(ctx, &node[1]);
- step = ctx->ListExt->Opcode[i].Size;
- return step;
-}
-
-
-/**
- * Delete the named display list, but don't remove from hash table.
- * \param dlist - display list pointer
- */
-void
-_mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
-{
- Node *n, *block;
- GLboolean done;
-
- n = block = dlist->Head;
-
- done = block ? GL_FALSE : GL_TRUE;
- while (!done) {
- const OpCode opcode = n[0].opcode;
-
- /* check for extension opcodes first */
- if (is_ext_opcode(opcode)) {
- n += ext_opcode_destroy(ctx, n);
- }
- else {
- switch (opcode) {
- /* for some commands, we need to free malloc'd memory */
- case OPCODE_MAP1:
- free(n[6].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_MAP2:
- free(n[10].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_DRAW_PIXELS:
- free(n[5].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_BITMAP:
- free(n[7].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COLOR_TABLE:
- free(n[6].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COLOR_SUB_TABLE:
- free(n[6].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_CONVOLUTION_FILTER_1D:
- free(n[6].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_CONVOLUTION_FILTER_2D:
- free(n[7].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_POLYGON_STIPPLE:
- free(n[1].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_TEX_IMAGE1D:
- free(n[8].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_TEX_IMAGE2D:
- free(n[9].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_TEX_IMAGE3D:
- free(n[10].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_TEX_SUB_IMAGE1D:
- free(n[7].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_TEX_SUB_IMAGE2D:
- free(n[9].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_TEX_SUB_IMAGE3D:
- free(n[11].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_IMAGE_1D:
- free(n[7].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_IMAGE_2D:
- free(n[8].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_IMAGE_3D:
- free(n[9].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
- free(n[7].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
- free(n[9].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
- free(n[11].data);
- n += InstSize[n[0].opcode];
- break;
-#if FEATURE_NV_vertex_program
- case OPCODE_LOAD_PROGRAM_NV:
- free(n[4].data); /* program string */
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
- free(n[2].data); /* array of program ids */
- n += InstSize[n[0].opcode];
- break;
-#endif
-#if FEATURE_NV_fragment_program
- case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
- free(n[3].data); /* parameter name */
- n += InstSize[n[0].opcode];
- break;
-#endif
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
- case OPCODE_PROGRAM_STRING_ARB:
- free(n[4].data); /* program string */
- n += InstSize[n[0].opcode];
- break;
-#endif
- case OPCODE_UNIFORM_1FV:
- case OPCODE_UNIFORM_2FV:
- case OPCODE_UNIFORM_3FV:
- case OPCODE_UNIFORM_4FV:
- case OPCODE_UNIFORM_1IV:
- 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;
- case OPCODE_UNIFORM_MATRIX22:
- case OPCODE_UNIFORM_MATRIX33:
- case OPCODE_UNIFORM_MATRIX44:
- case OPCODE_UNIFORM_MATRIX24:
- case OPCODE_UNIFORM_MATRIX42:
- case OPCODE_UNIFORM_MATRIX23:
- case OPCODE_UNIFORM_MATRIX32:
- case OPCODE_UNIFORM_MATRIX34:
- case OPCODE_UNIFORM_MATRIX43:
- free(n[4].data);
- n += InstSize[n[0].opcode];
- break;
-
- case OPCODE_CONTINUE:
- n = (Node *) n[1].next;
- free(block);
- block = n;
- break;
- case OPCODE_END_OF_LIST:
- free(block);
- done = GL_TRUE;
- break;
- default:
- /* Most frequent case */
- n += InstSize[n[0].opcode];
- break;
- }
- }
- }
-
- free(dlist);
-}
-
-
-/**
- * Destroy a display list and remove from hash table.
- * \param list - display list number
- */
-static void
-destroy_list(struct gl_context *ctx, GLuint list)
-{
- struct gl_display_list *dlist;
-
- if (list == 0)
- return;
-
- dlist = lookup_list(ctx, list);
- if (!dlist)
- return;
-
- _mesa_delete_list(ctx, dlist);
- _mesa_HashRemove(ctx->Shared->DisplayList, list);
-}
-
-
-/*
- * Translate the nth element of list from <type> to GLint.
- */
-static GLint
-translate_id(GLsizei n, GLenum type, const GLvoid * list)
-{
- GLbyte *bptr;
- GLubyte *ubptr;
- GLshort *sptr;
- GLushort *usptr;
- GLint *iptr;
- GLuint *uiptr;
- GLfloat *fptr;
-
- switch (type) {
- case GL_BYTE:
- bptr = (GLbyte *) list;
- return (GLint) bptr[n];
- case GL_UNSIGNED_BYTE:
- ubptr = (GLubyte *) list;
- return (GLint) ubptr[n];
- case GL_SHORT:
- sptr = (GLshort *) list;
- return (GLint) sptr[n];
- case GL_UNSIGNED_SHORT:
- usptr = (GLushort *) list;
- return (GLint) usptr[n];
- case GL_INT:
- iptr = (GLint *) list;
- return iptr[n];
- case GL_UNSIGNED_INT:
- uiptr = (GLuint *) list;
- return (GLint) uiptr[n];
- case GL_FLOAT:
- fptr = (GLfloat *) list;
- return (GLint) FLOORF(fptr[n]);
- case GL_2_BYTES:
- ubptr = ((GLubyte *) list) + 2 * n;
- return (GLint) ubptr[0] * 256
- + (GLint) ubptr[1];
- case GL_3_BYTES:
- ubptr = ((GLubyte *) list) + 3 * n;
- return (GLint) ubptr[0] * 65536
- + (GLint) ubptr[1] * 256
- + (GLint) ubptr[2];
- case GL_4_BYTES:
- ubptr = ((GLubyte *) list) + 4 * n;
- return (GLint) ubptr[0] * 16777216
- + (GLint) ubptr[1] * 65536
- + (GLint) ubptr[2] * 256
- + (GLint) ubptr[3];
- default:
- return 0;
- }
-}
-
-
-
-
-/**********************************************************************/
-/***** Public *****/
-/**********************************************************************/
-
-/**
- * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
- * If we run out of memory, GL_OUT_OF_MEMORY will be recorded.
- */
-static GLvoid *
-unpack_image(struct gl_context *ctx, GLuint dimensions,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *unpack)
-{
- if (!_mesa_is_bufferobj(unpack->BufferObj)) {
- /* no PBO */
- GLvoid *image = _mesa_unpack_image(dimensions, width, height, depth,
- format, type, pixels, unpack);
- if (pixels && !image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
- }
- return image;
- }
- else if (_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
- format, type, pixels)) {
- const GLubyte *map, *src;
- GLvoid *image;
-
- map = (GLubyte *)
- ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
- GL_READ_ONLY_ARB, unpack->BufferObj);
- if (!map) {
- /* unable to map src buffer! */
- _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
- return NULL;
- }
-
- src = ADD_POINTERS(map, pixels);
- image = _mesa_unpack_image(dimensions, width, height, depth,
- format, type, src, unpack);
-
- ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
- unpack->BufferObj);
-
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
- }
- return image;
- }
- /* bad access! */
- return NULL;
-}
-
-
-/**
- * Allocate space for a display list instruction (opcode + payload space).
- * \param opcode the instruction opcode (OPCODE_* value)
- * \param bytes instruction payload size (not counting opcode)
- * \return pointer to allocated memory (the opcode space)
- */
-static Node *
-dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes)
-{
- const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
- Node *n;
-
- if (opcode < (GLuint) OPCODE_EXT_0) {
- if (InstSize[opcode] == 0) {
- /* save instruction size now */
- InstSize[opcode] = numNodes;
- }
- else {
- /* make sure instruction size agrees */
- ASSERT(numNodes == InstSize[opcode]);
- }
- }
-
- if (ctx->ListState.CurrentPos + numNodes + 2 > BLOCK_SIZE) {
- /* This block is full. Allocate a new block and chain to it */
- Node *newblock;
- n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
- n[0].opcode = OPCODE_CONTINUE;
- newblock = (Node *) malloc(sizeof(Node) * BLOCK_SIZE);
- if (!newblock) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
- return NULL;
- }
- n[1].next = (Node *) newblock;
- ctx->ListState.CurrentBlock = newblock;
- ctx->ListState.CurrentPos = 0;
- }
-
- n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
- ctx->ListState.CurrentPos += numNodes;
-
- n[0].opcode = opcode;
-
- return n;
-}
-
-
-
-/**
- * Allocate space for a display list instruction. Used by callers outside
- * this file for things like VBO vertex data.
- *
- * \param opcode the instruction opcode (OPCODE_* value)
- * \param bytes instruction size in bytes, not counting opcode.
- * \return pointer to the usable data area (not including the internal
- * opcode).
- */
-void *
-_mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
-{
- Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes);
- if (n)
- return n + 1; /* return pointer to payload area, after opcode */
- else
- return NULL;
-}
-
-
-/**
- * This function allows modules and drivers to get their own opcodes
- * for extending display list functionality.
- * \param ctx the rendering context
- * \param size number of bytes for storing the new display list command
- * \param execute function to execute the new display list command
- * \param destroy function to destroy the new display list command
- * \param print function to print the new display list command
- * \return the new opcode number or -1 if error
- */
-GLint
-_mesa_dlist_alloc_opcode(struct gl_context *ctx,
- GLuint size,
- void (*execute) (struct gl_context *, void *),
- void (*destroy) (struct gl_context *, void *),
- void (*print) (struct gl_context *, void *))
-{
- if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
- const GLuint i = ctx->ListExt->NumOpcodes++;
- ctx->ListExt->Opcode[i].Size =
- 1 + (size + sizeof(Node) - 1) / sizeof(Node);
- ctx->ListExt->Opcode[i].Execute = execute;
- ctx->ListExt->Opcode[i].Destroy = destroy;
- ctx->ListExt->Opcode[i].Print = print;
- return i + OPCODE_EXT_0;
- }
- return -1;
-}
-
-
-/**
- * Allocate space for a display list instruction. The space is basically
- * an array of Nodes where node[0] holds the opcode, node[1] is the first
- * function parameter, node[2] is the second parameter, etc.
- *
- * \param opcode one of OPCODE_x
- * \param nparams number of function parameters
- * \return pointer to start of instruction space
- */
-static INLINE Node *
-alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
-{
- return dlist_alloc(ctx, opcode, nparams * sizeof(Node));
-}
-
-
-
-/*
- * Display List compilation functions
- */
-static void GLAPIENTRY
-save_Accum(GLenum op, GLfloat value)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
- if (n) {
- n[1].e = op;
- n[2].f = value;
- }
- if (ctx->ExecuteFlag) {
- CALL_Accum(ctx->Exec, (op, value));
- }
-}
-
-
-static void GLAPIENTRY
-save_AlphaFunc(GLenum func, GLclampf ref)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
- if (n) {
- n[1].e = func;
- n[2].f = (GLfloat) ref;
- }
- if (ctx->ExecuteFlag) {
- CALL_AlphaFunc(ctx->Exec, (func, ref));
- }
-}
-
-
-static void GLAPIENTRY
-save_BindTexture(GLenum target, GLuint texture)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
- if (n) {
- n[1].e = target;
- n[2].ui = texture;
- }
- if (ctx->ExecuteFlag) {
- CALL_BindTexture(ctx->Exec, (target, texture));
- }
-}
-
-
-static void GLAPIENTRY
-save_Bitmap(GLsizei width, GLsizei height,
- GLfloat xorig, GLfloat yorig,
- GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_BITMAP, 7);
- if (n) {
- n[1].i = (GLint) width;
- n[2].i = (GLint) height;
- n[3].f = xorig;
- n[4].f = yorig;
- n[5].f = xmove;
- n[6].f = ymove;
- n[7].data = _mesa_unpack_bitmap(width, height, pixels, &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_Bitmap(ctx->Exec, (width, height,
- xorig, yorig, xmove, ymove, pixels));
- }
-}
-
-
-static void GLAPIENTRY
-save_BlendEquation(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
- if (n) {
- n[1].e = mode;
- }
- if (ctx->ExecuteFlag) {
- CALL_BlendEquation(ctx->Exec, (mode));
- }
-}
-
-
-static void GLAPIENTRY
-save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
- if (n) {
- n[1].e = modeRGB;
- n[2].e = modeA;
- }
- if (ctx->ExecuteFlag) {
- CALL_BlendEquationSeparateEXT(ctx->Exec, (modeRGB, modeA));
- }
-}
-
-
-static void GLAPIENTRY
-save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
- if (n) {
- n[1].e = sfactorRGB;
- n[2].e = dfactorRGB;
- n[3].e = sfactorA;
- n[4].e = dfactorA;
- }
- if (ctx->ExecuteFlag) {
- CALL_BlendFuncSeparateEXT(ctx->Exec,
- (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
- }
-}
-
-
-static void GLAPIENTRY
-save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
-{
- save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
-}
-
-
-static void GLAPIENTRY
-save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
- if (n) {
- n[1].f = red;
- n[2].f = green;
- n[3].f = blue;
- n[4].f = alpha;
- }
- if (ctx->ExecuteFlag) {
- CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
- }
-}
-
-static void invalidate_saved_current_state( struct gl_context *ctx )
-{
- GLint i;
-
- for (i = 0; i < VERT_ATTRIB_MAX; i++)
- ctx->ListState.ActiveAttribSize[i] = 0;
-
- for (i = 0; i < MAT_ATTRIB_MAX; i++)
- ctx->ListState.ActiveMaterialSize[i] = 0;
-
- memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
-
- ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
-}
-
-static void GLAPIENTRY
-save_CallList(GLuint list)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
-
- n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
- if (n) {
- n[1].ui = list;
- }
-
- /* After this, we don't know what state we're in. Invalidate all
- * cached information previously gathered:
- */
- invalidate_saved_current_state( ctx );
-
- if (ctx->ExecuteFlag) {
- _mesa_CallList(list);
- }
-}
-
-
-static void GLAPIENTRY
-save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
- GLboolean typeErrorFlag;
-
- SAVE_FLUSH_VERTICES(ctx);
-
- switch (type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- case GL_2_BYTES:
- case GL_3_BYTES:
- case GL_4_BYTES:
- typeErrorFlag = GL_FALSE;
- break;
- default:
- typeErrorFlag = GL_TRUE;
- }
-
- for (i = 0; i < num; i++) {
- GLint list = translate_id(i, type, lists);
- Node *n = alloc_instruction(ctx, OPCODE_CALL_LIST_OFFSET, 2);
- if (n) {
- n[1].i = list;
- n[2].b = typeErrorFlag;
- }
- }
-
- /* After this, we don't know what state we're in. Invalidate all
- * cached information previously gathered:
- */
- invalidate_saved_current_state( ctx );
-
- if (ctx->ExecuteFlag) {
- CALL_CallLists(ctx->Exec, (num, type, lists));
- }
-}
-
-
-static void GLAPIENTRY
-save_Clear(GLbitfield mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
- if (n) {
- n[1].bf = mask;
- }
- if (ctx->ExecuteFlag) {
- CALL_Clear(ctx->Exec, (mask));
- }
-}
-
-
-static void GLAPIENTRY
-save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
- if (n) {
- n[1].e = buffer;
- n[2].i = drawbuffer;
- n[3].i = value[0];
- if (buffer == GL_COLOR) {
- n[4].i = value[1];
- n[5].i = value[2];
- n[6].i = value[3];
- }
- else {
- n[4].i = 0;
- n[5].i = 0;
- n[6].i = 0;
- }
- }
- if (ctx->ExecuteFlag) {
- /*CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));*/
- }
-}
-
-
-static void GLAPIENTRY
-save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
- if (n) {
- n[1].e = buffer;
- n[2].i = drawbuffer;
- n[3].ui = value[0];
- if (buffer == GL_COLOR) {
- n[4].ui = value[1];
- n[5].ui = value[2];
- n[6].ui = value[3];
- }
- else {
- n[4].ui = 0;
- n[5].ui = 0;
- n[6].ui = 0;
- }
- }
- if (ctx->ExecuteFlag) {
- /*CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));*/
- }
-}
-
-
-static void GLAPIENTRY
-save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
- if (n) {
- n[1].e = buffer;
- n[2].i = drawbuffer;
- n[3].f = value[0];
- if (buffer == GL_COLOR) {
- n[4].f = value[1];
- n[5].f = value[2];
- n[6].f = value[3];
- }
- else {
- n[4].f = 0.0F;
- n[5].f = 0.0F;
- n[6].f = 0.0F;
- }
- }
- if (ctx->ExecuteFlag) {
- /*CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));*/
- }
-}
-
-
-static void GLAPIENTRY
-save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
- GLfloat depth, GLint stencil)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
- if (n) {
- n[1].e = buffer;
- n[2].i = drawbuffer;
- n[3].f = depth;
- n[4].i = stencil;
- }
- if (ctx->ExecuteFlag) {
- /*CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));*/
- }
-}
-
-
-static void GLAPIENTRY
-save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
- if (n) {
- n[1].f = red;
- n[2].f = green;
- n[3].f = blue;
- n[4].f = alpha;
- }
- if (ctx->ExecuteFlag) {
- CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
- }
-}
-
-
-static void GLAPIENTRY
-save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
- if (n) {
- n[1].f = red;
- n[2].f = green;
- n[3].f = blue;
- n[4].f = alpha;
- }
- if (ctx->ExecuteFlag) {
- CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
- }
-}
-
-
-static void GLAPIENTRY
-save_ClearDepth(GLclampd depth)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
- if (n) {
- n[1].f = (GLfloat) depth;
- }
- if (ctx->ExecuteFlag) {
- CALL_ClearDepth(ctx->Exec, (depth));
- }
-}
-
-
-static void GLAPIENTRY
-save_ClearIndex(GLfloat c)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
- if (n) {
- n[1].f = c;
- }
- if (ctx->ExecuteFlag) {
- CALL_ClearIndex(ctx->Exec, (c));
- }
-}
-
-
-static void GLAPIENTRY
-save_ClearStencil(GLint s)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
- if (n) {
- n[1].i = s;
- }
- if (ctx->ExecuteFlag) {
- CALL_ClearStencil(ctx->Exec, (s));
- }
-}
-
-
-static void GLAPIENTRY
-save_ClipPlane(GLenum plane, const GLdouble * equ)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
- if (n) {
- n[1].e = plane;
- n[2].f = (GLfloat) equ[0];
- n[3].f = (GLfloat) equ[1];
- n[4].f = (GLfloat) equ[2];
- n[5].f = (GLfloat) equ[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_ClipPlane(ctx->Exec, (plane, equ));
- }
-}
-
-
-
-static void GLAPIENTRY
-save_ColorMask(GLboolean red, GLboolean green,
- GLboolean blue, GLboolean alpha)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
- if (n) {
- n[1].b = red;
- n[2].b = green;
- n[3].b = blue;
- n[4].b = alpha;
- }
- if (ctx->ExecuteFlag) {
- CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
- }
-}
-
-
-static void GLAPIENTRY
-save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
- GLboolean blue, GLboolean alpha)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
- if (n) {
- n[1].ui = buf;
- n[2].b = red;
- n[3].b = green;
- n[4].b = blue;
- n[5].b = alpha;
- }
- if (ctx->ExecuteFlag) {
- /*CALL_ColorMaskIndexedEXT(ctx->Exec, (buf, red, green, blue, alpha));*/
- }
-}
-
-
-static void GLAPIENTRY
-save_ColorMaterial(GLenum face, GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
- if (n) {
- n[1].e = face;
- n[2].e = mode;
- }
- if (ctx->ExecuteFlag) {
- CALL_ColorMaterial(ctx->Exec, (face, mode));
- }
-}
-
-
-static void GLAPIENTRY
-save_ColorTable(GLenum target, GLenum internalFormat,
- GLsizei width, GLenum format, GLenum type,
- const GLvoid * table)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (_mesa_is_proxy_texture(target)) {
- /* execute immediately */
- CALL_ColorTable(ctx->Exec, (target, internalFormat, width,
- format, type, table));
- }
- else {
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COLOR_TABLE, 6);
- if (n) {
- n[1].e = target;
- n[2].e = internalFormat;
- n[3].i = width;
- n[4].e = format;
- n[5].e = type;
- n[6].data = unpack_image(ctx, 1, width, 1, 1, format, type, table,
- &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_ColorTable(ctx->Exec, (target, internalFormat, width,
- format, type, table));
- }
- }
-}
-
-
-
-static void GLAPIENTRY
-save_ColorTableParameterfv(GLenum target, GLenum pname,
- const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].f = params[0];
- if (pname == GL_COLOR_TABLE_SGI ||
- pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
- pname == GL_TEXTURE_COLOR_TABLE_SGI) {
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
- }
- }
-
- if (ctx->ExecuteFlag) {
- CALL_ColorTableParameterfv(ctx->Exec, (target, pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].i = params[0];
- if (pname == GL_COLOR_TABLE_SGI ||
- pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
- pname == GL_TEXTURE_COLOR_TABLE_SGI) {
- n[4].i = params[1];
- n[5].i = params[2];
- n[6].i = params[3];
- }
- }
-
- if (ctx->ExecuteFlag) {
- CALL_ColorTableParameteriv(ctx->Exec, (target, pname, params));
- }
-}
-
-
-
-static void GLAPIENTRY
-save_ColorSubTable(GLenum target, GLsizei start, GLsizei count,
- GLenum format, GLenum type, const GLvoid * table)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COLOR_SUB_TABLE, 6);
- if (n) {
- n[1].e = target;
- n[2].i = start;
- n[3].i = count;
- n[4].e = format;
- n[5].e = type;
- n[6].data = unpack_image(ctx, 1, count, 1, 1, format, type, table,
- &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_ColorSubTable(ctx->Exec,
- (target, start, count, format, type, table));
- }
-}
-
-
-static void GLAPIENTRY
-save_CopyColorSubTable(GLenum target, GLsizei start,
- GLint x, GLint y, GLsizei width)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5);
- if (n) {
- n[1].e = target;
- n[2].i = start;
- n[3].i = x;
- n[4].i = y;
- n[5].i = width;
- }
- if (ctx->ExecuteFlag) {
- CALL_CopyColorSubTable(ctx->Exec, (target, start, x, y, width));
- }
-}
-
-
-static void GLAPIENTRY
-save_CopyColorTable(GLenum target, GLenum internalformat,
- GLint x, GLint y, GLsizei width)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COPY_COLOR_TABLE, 5);
- if (n) {
- n[1].e = target;
- n[2].e = internalformat;
- n[3].i = x;
- n[4].i = y;
- n[5].i = width;
- }
- if (ctx->ExecuteFlag) {
- CALL_CopyColorTable(ctx->Exec, (target, internalformat, x, y, width));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width,
- GLenum format, GLenum type, const GLvoid * filter)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6);
- if (n) {
- n[1].e = target;
- n[2].e = internalFormat;
- n[3].i = width;
- n[4].e = format;
- n[5].e = type;
- n[6].data = unpack_image(ctx, 1, width, 1, 1, format, type, filter,
- &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionFilter1D(ctx->Exec, (target, internalFormat, width,
- format, type, filter));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionFilter2D(GLenum target, GLenum internalFormat,
- GLsizei width, GLsizei height, GLenum format,
- GLenum type, const GLvoid * filter)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7);
- if (n) {
- n[1].e = target;
- n[2].e = internalFormat;
- n[3].i = width;
- n[4].i = height;
- n[5].e = format;
- n[6].e = type;
- n[7].data = unpack_image(ctx, 2, width, height, 1, format, type, filter,
- &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionFilter2D(ctx->Exec,
- (target, internalFormat, width, height, format,
- type, filter));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].i = param;
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionParameteri(ctx->Exec, (target, pname, param));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].i = params[0];
- if (pname == GL_CONVOLUTION_BORDER_COLOR ||
- pname == GL_CONVOLUTION_FILTER_SCALE ||
- pname == GL_CONVOLUTION_FILTER_BIAS) {
- n[4].i = params[1];
- n[5].i = params[2];
- n[6].i = params[3];
- }
- else {
- n[4].i = n[5].i = n[6].i = 0;
- }
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionParameteriv(ctx->Exec, (target, pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].f = param;
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionParameterf(ctx->Exec, (target, pname, param));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionParameterfv(GLenum target, GLenum pname,
- const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].f = params[0];
- if (pname == GL_CONVOLUTION_BORDER_COLOR ||
- pname == GL_CONVOLUTION_FILTER_SCALE ||
- pname == GL_CONVOLUTION_FILTER_BIAS) {
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
- }
- else {
- n[4].f = n[5].f = n[6].f = 0.0F;
- }
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionParameterfv(ctx->Exec, (target, pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
- if (n) {
- n[1].i = x;
- n[2].i = y;
- n[3].i = (GLint) width;
- n[4].i = (GLint) height;
- n[5].e = type;
- }
- if (ctx->ExecuteFlag) {
- CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
- }
-}
-
-
-
-static void GLAPIENTRY
-save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
- GLint x, GLint y, GLsizei width, GLint border)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].e = internalformat;
- n[4].i = x;
- n[5].i = y;
- n[6].i = width;
- n[7].i = border;
- }
- if (ctx->ExecuteFlag) {
- CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
- x, y, width, border));
- }
-}
-
-
-static void GLAPIENTRY
-save_CopyTexImage2D(GLenum target, GLint level,
- GLenum internalformat,
- GLint x, GLint y, GLsizei width,
- GLsizei height, GLint border)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].e = internalformat;
- n[4].i = x;
- n[5].i = y;
- n[6].i = width;
- n[7].i = height;
- n[8].i = border;
- }
- if (ctx->ExecuteFlag) {
- CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
- x, y, width, height, border));
- }
-}
-
-
-
-static void GLAPIENTRY
-save_CopyTexSubImage1D(GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = x;
- n[5].i = y;
- n[6].i = width;
- }
- if (ctx->ExecuteFlag) {
- CALL_CopyTexSubImage1D(ctx->Exec,
- (target, level, xoffset, x, y, width));
- }
-}
-
-
-static void GLAPIENTRY
-save_CopyTexSubImage2D(GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLint height)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = yoffset;
- n[5].i = x;
- n[6].i = y;
- n[7].i = width;
- n[8].i = height;
- }
- if (ctx->ExecuteFlag) {
- CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
- x, y, width, height));
- }
-}
-
-
-static void GLAPIENTRY
-save_CopyTexSubImage3D(GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y, GLsizei width, GLint height)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = yoffset;
- n[5].i = zoffset;
- n[6].i = x;
- n[7].i = y;
- n[8].i = width;
- n[9].i = height;
- }
- if (ctx->ExecuteFlag) {
- CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
- xoffset, yoffset, zoffset,
- x, y, width, height));
- }
-}
-
-
-static void GLAPIENTRY
-save_CullFace(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
- if (n) {
- n[1].e = mode;
- }
- if (ctx->ExecuteFlag) {
- CALL_CullFace(ctx->Exec, (mode));
- }
-}
-
-
-static void GLAPIENTRY
-save_DepthFunc(GLenum func)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
- if (n) {
- n[1].e = func;
- }
- if (ctx->ExecuteFlag) {
- CALL_DepthFunc(ctx->Exec, (func));
- }
-}
-
-
-static void GLAPIENTRY
-save_DepthMask(GLboolean mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
- if (n) {
- n[1].b = mask;
- }
- if (ctx->ExecuteFlag) {
- CALL_DepthMask(ctx->Exec, (mask));
- }
-}
-
-
-static void GLAPIENTRY
-save_DepthRange(GLclampd nearval, GLclampd farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
- if (n) {
- n[1].f = (GLfloat) nearval;
- n[2].f = (GLfloat) farval;
- }
- if (ctx->ExecuteFlag) {
- CALL_DepthRange(ctx->Exec, (nearval, farval));
- }
-}
-
-
-static void GLAPIENTRY
-save_Disable(GLenum cap)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
- if (n) {
- n[1].e = cap;
- }
- if (ctx->ExecuteFlag) {
- CALL_Disable(ctx->Exec, (cap));
- }
-}
-
-
-static void GLAPIENTRY
-save_DisableIndexed(GLuint index, GLenum cap)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
- if (n) {
- n[1].ui = index;
- n[2].e = cap;
- }
- if (ctx->ExecuteFlag) {
- CALL_DisableIndexedEXT(ctx->Exec, (index, cap));
- }
-}
-
-
-static void GLAPIENTRY
-save_DrawBuffer(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
- if (n) {
- n[1].e = mode;
- }
- if (ctx->ExecuteFlag) {
- CALL_DrawBuffer(ctx->Exec, (mode));
- }
-}
-
-
-static void GLAPIENTRY
-save_DrawPixels(GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 5);
- if (n) {
- n[1].i = width;
- n[2].i = height;
- n[3].e = format;
- n[4].e = type;
- n[5].data = unpack_image(ctx, 2, width, height, 1, format, type,
- pixels, &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
- }
-}
-
-
-
-static void GLAPIENTRY
-save_Enable(GLenum cap)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
- if (n) {
- n[1].e = cap;
- }
- if (ctx->ExecuteFlag) {
- CALL_Enable(ctx->Exec, (cap));
- }
-}
-
-
-
-static void GLAPIENTRY
-save_EnableIndexed(GLuint index, GLenum cap)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
- if (n) {
- n[1].ui = index;
- n[2].e = cap;
- }
- if (ctx->ExecuteFlag) {
- CALL_EnableIndexedEXT(ctx->Exec, (index, cap));
- }
-}
-
-
-
-static void GLAPIENTRY
-save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
- if (n) {
- n[1].e = mode;
- n[2].i = i1;
- n[3].i = i2;
- }
- if (ctx->ExecuteFlag) {
- CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
- }
-}
-
-
-static void GLAPIENTRY
-save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
- if (n) {
- n[1].e = mode;
- n[2].i = i1;
- n[3].i = i2;
- n[4].i = j1;
- n[5].i = j2;
- }
- if (ctx->ExecuteFlag) {
- CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
- }
-}
-
-
-
-
-static void GLAPIENTRY
-save_Fogfv(GLenum pname, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_FOG, 5);
- if (n) {
- n[1].e = pname;
- n[2].f = params[0];
- n[3].f = params[1];
- n[4].f = params[2];
- n[5].f = params[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_Fogfv(ctx->Exec, (pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_Fogf(GLenum pname, GLfloat param)
-{
- GLfloat parray[4];
- parray[0] = param;
- parray[1] = parray[2] = parray[3] = 0.0F;
- save_Fogfv(pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_Fogiv(GLenum pname, const GLint *params)
-{
- GLfloat p[4];
- switch (pname) {
- case GL_FOG_MODE:
- case GL_FOG_DENSITY:
- case GL_FOG_START:
- case GL_FOG_END:
- case GL_FOG_INDEX:
- p[0] = (GLfloat) *params;
- p[1] = 0.0f;
- p[2] = 0.0f;
- p[3] = 0.0f;
- break;
- case GL_FOG_COLOR:
- p[0] = INT_TO_FLOAT(params[0]);
- p[1] = INT_TO_FLOAT(params[1]);
- p[2] = INT_TO_FLOAT(params[2]);
- p[3] = INT_TO_FLOAT(params[3]);
- break;
- default:
- /* Error will be caught later in gl_Fogfv */
- ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
- }
- save_Fogfv(pname, p);
-}
-
-
-static void GLAPIENTRY
-save_Fogi(GLenum pname, GLint param)
-{
- GLint parray[4];
- parray[0] = param;
- parray[1] = parray[2] = parray[3] = 0;
- save_Fogiv(pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_FrontFace(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
- if (n) {
- n[1].e = mode;
- }
- if (ctx->ExecuteFlag) {
- CALL_FrontFace(ctx->Exec, (mode));
- }
-}
-
-
-static void GLAPIENTRY
-save_Frustum(GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
- if (n) {
- n[1].f = (GLfloat) left;
- n[2].f = (GLfloat) right;
- n[3].f = (GLfloat) bottom;
- n[4].f = (GLfloat) top;
- n[5].f = (GLfloat) nearval;
- n[6].f = (GLfloat) farval;
- }
- if (ctx->ExecuteFlag) {
- CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
- }
-}
-
-
-static void GLAPIENTRY
-save_Hint(GLenum target, GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_HINT, 2);
- if (n) {
- n[1].e = target;
- n[2].e = mode;
- }
- if (ctx->ExecuteFlag) {
- CALL_Hint(ctx->Exec, (target, mode));
- }
-}
-
-
-static void GLAPIENTRY
-save_Histogram(GLenum target, GLsizei width, GLenum internalFormat,
- GLboolean sink)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_HISTOGRAM, 4);
- if (n) {
- n[1].e = target;
- n[2].i = width;
- n[3].e = internalFormat;
- n[4].b = sink;
- }
- if (ctx->ExecuteFlag) {
- CALL_Histogram(ctx->Exec, (target, width, internalFormat, sink));
- }
-}
-
-
-static void GLAPIENTRY
-save_IndexMask(GLuint mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
- if (n) {
- n[1].ui = mask;
- }
- if (ctx->ExecuteFlag) {
- CALL_IndexMask(ctx->Exec, (mask));
- }
-}
-
-
-static void GLAPIENTRY
-save_InitNames(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
- if (ctx->ExecuteFlag) {
- CALL_InitNames(ctx->Exec, ());
- }
-}
-
-
-static void GLAPIENTRY
-save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
- if (n) {
- GLint i, nParams;
- n[1].e = light;
- n[2].e = pname;
- switch (pname) {
- case GL_AMBIENT:
- nParams = 4;
- break;
- case GL_DIFFUSE:
- nParams = 4;
- break;
- case GL_SPECULAR:
- nParams = 4;
- break;
- case GL_POSITION:
- nParams = 4;
- break;
- case GL_SPOT_DIRECTION:
- nParams = 3;
- break;
- case GL_SPOT_EXPONENT:
- nParams = 1;
- break;
- case GL_SPOT_CUTOFF:
- nParams = 1;
- break;
- case GL_CONSTANT_ATTENUATION:
- nParams = 1;
- break;
- case GL_LINEAR_ATTENUATION:
- nParams = 1;
- break;
- case GL_QUADRATIC_ATTENUATION:
- nParams = 1;
- break;
- default:
- nParams = 0;
- }
- for (i = 0; i < nParams; i++) {
- n[3 + i].f = params[i];
- }
- }
- if (ctx->ExecuteFlag) {
- CALL_Lightfv(ctx->Exec, (light, pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_Lightf(GLenum light, GLenum pname, GLfloat param)
-{
- GLfloat parray[4];
- parray[0] = param;
- parray[1] = parray[2] = parray[3] = 0.0F;
- save_Lightfv(light, pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_Lightiv(GLenum light, GLenum pname, const GLint *params)
-{
- GLfloat fparam[4];
- switch (pname) {
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- fparam[0] = INT_TO_FLOAT(params[0]);
- fparam[1] = INT_TO_FLOAT(params[1]);
- fparam[2] = INT_TO_FLOAT(params[2]);
- fparam[3] = INT_TO_FLOAT(params[3]);
- break;
- case GL_POSITION:
- fparam[0] = (GLfloat) params[0];
- fparam[1] = (GLfloat) params[1];
- fparam[2] = (GLfloat) params[2];
- fparam[3] = (GLfloat) params[3];
- break;
- case GL_SPOT_DIRECTION:
- fparam[0] = (GLfloat) params[0];
- fparam[1] = (GLfloat) params[1];
- fparam[2] = (GLfloat) params[2];
- break;
- case GL_SPOT_EXPONENT:
- case GL_SPOT_CUTOFF:
- case GL_CONSTANT_ATTENUATION:
- case GL_LINEAR_ATTENUATION:
- case GL_QUADRATIC_ATTENUATION:
- fparam[0] = (GLfloat) params[0];
- break;
- default:
- /* error will be caught later in gl_Lightfv */
- ;
- }
- save_Lightfv(light, pname, fparam);
-}
-
-
-static void GLAPIENTRY
-save_Lighti(GLenum light, GLenum pname, GLint param)
-{
- GLint parray[4];
- parray[0] = param;
- parray[1] = parray[2] = parray[3] = 0;
- save_Lightiv(light, pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_LightModelfv(GLenum pname, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
- if (n) {
- n[1].e = pname;
- n[2].f = params[0];
- n[3].f = params[1];
- n[4].f = params[2];
- n[5].f = params[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_LightModelfv(ctx->Exec, (pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_LightModelf(GLenum pname, GLfloat param)
-{
- GLfloat parray[4];
- parray[0] = param;
- parray[1] = parray[2] = parray[3] = 0.0F;
- save_LightModelfv(pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_LightModeliv(GLenum pname, const GLint *params)
-{
- GLfloat fparam[4];
- switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT:
- fparam[0] = INT_TO_FLOAT(params[0]);
- fparam[1] = INT_TO_FLOAT(params[1]);
- fparam[2] = INT_TO_FLOAT(params[2]);
- fparam[3] = INT_TO_FLOAT(params[3]);
- break;
- case GL_LIGHT_MODEL_LOCAL_VIEWER:
- case GL_LIGHT_MODEL_TWO_SIDE:
- case GL_LIGHT_MODEL_COLOR_CONTROL:
- fparam[0] = (GLfloat) params[0];
- fparam[1] = 0.0F;
- fparam[2] = 0.0F;
- fparam[3] = 0.0F;
- break;
- default:
- /* Error will be caught later in gl_LightModelfv */
- ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
- }
- save_LightModelfv(pname, fparam);
-}
-
-
-static void GLAPIENTRY
-save_LightModeli(GLenum pname, GLint param)
-{
- GLint parray[4];
- parray[0] = param;
- parray[1] = parray[2] = parray[3] = 0;
- save_LightModeliv(pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_LineStipple(GLint factor, GLushort pattern)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
- if (n) {
- n[1].i = factor;
- n[2].us = pattern;
- }
- if (ctx->ExecuteFlag) {
- CALL_LineStipple(ctx->Exec, (factor, pattern));
- }
-}
-
-
-static void GLAPIENTRY
-save_LineWidth(GLfloat width)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
- if (n) {
- n[1].f = width;
- }
- if (ctx->ExecuteFlag) {
- CALL_LineWidth(ctx->Exec, (width));
- }
-}
-
-
-static void GLAPIENTRY
-save_ListBase(GLuint base)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
- if (n) {
- n[1].ui = base;
- }
- if (ctx->ExecuteFlag) {
- CALL_ListBase(ctx->Exec, (base));
- }
-}
-
-
-static void GLAPIENTRY
-save_LoadIdentity(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
- if (ctx->ExecuteFlag) {
- CALL_LoadIdentity(ctx->Exec, ());
- }
-}
-
-
-static void GLAPIENTRY
-save_LoadMatrixf(const GLfloat * m)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
- if (n) {
- GLuint i;
- for (i = 0; i < 16; i++) {
- n[1 + i].f = m[i];
- }
- }
- if (ctx->ExecuteFlag) {
- CALL_LoadMatrixf(ctx->Exec, (m));
- }
-}
-
-
-static void GLAPIENTRY
-save_LoadMatrixd(const GLdouble * m)
-{
- GLfloat f[16];
- GLint i;
- for (i = 0; i < 16; i++) {
- f[i] = (GLfloat) m[i];
- }
- save_LoadMatrixf(f);
-}
-
-
-static void GLAPIENTRY
-save_LoadName(GLuint name)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
- if (n) {
- n[1].ui = name;
- }
- if (ctx->ExecuteFlag) {
- CALL_LoadName(ctx->Exec, (name));
- }
-}
-
-
-static void GLAPIENTRY
-save_LogicOp(GLenum opcode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
- if (n) {
- n[1].e = opcode;
- }
- if (ctx->ExecuteFlag) {
- CALL_LogicOp(ctx->Exec, (opcode));
- }
-}
-
-
-static void GLAPIENTRY
-save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
- GLint order, const GLdouble * points)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MAP1, 6);
- if (n) {
- GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
- n[1].e = target;
- n[2].f = (GLfloat) u1;
- n[3].f = (GLfloat) u2;
- n[4].i = _mesa_evaluator_components(target); /* stride */
- n[5].i = order;
- n[6].data = (void *) pnts;
- }
- if (ctx->ExecuteFlag) {
- CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
- }
-}
-
-static void GLAPIENTRY
-save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
- GLint order, const GLfloat * points)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MAP1, 6);
- if (n) {
- GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
- n[1].e = target;
- n[2].f = u1;
- n[3].f = u2;
- n[4].i = _mesa_evaluator_components(target); /* stride */
- n[5].i = order;
- n[6].data = (void *) pnts;
- }
- if (ctx->ExecuteFlag) {
- CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
- }
-}
-
-
-static void GLAPIENTRY
-save_Map2d(GLenum target,
- GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
- GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
- const GLdouble * points)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MAP2, 10);
- if (n) {
- GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
- vstride, vorder, points);
- n[1].e = target;
- n[2].f = (GLfloat) u1;
- n[3].f = (GLfloat) u2;
- n[4].f = (GLfloat) v1;
- n[5].f = (GLfloat) v2;
- /* XXX verify these strides are correct */
- n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
- n[7].i = _mesa_evaluator_components(target); /*vstride */
- n[8].i = uorder;
- n[9].i = vorder;
- n[10].data = (void *) pnts;
- }
- if (ctx->ExecuteFlag) {
- CALL_Map2d(ctx->Exec, (target,
- u1, u2, ustride, uorder,
- v1, v2, vstride, vorder, points));
- }
-}
-
-
-static void GLAPIENTRY
-save_Map2f(GLenum target,
- GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
- GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
- const GLfloat * points)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MAP2, 10);
- if (n) {
- GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
- vstride, vorder, points);
- n[1].e = target;
- n[2].f = u1;
- n[3].f = u2;
- n[4].f = v1;
- n[5].f = v2;
- /* XXX verify these strides are correct */
- n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
- n[7].i = _mesa_evaluator_components(target); /*vstride */
- n[8].i = uorder;
- n[9].i = vorder;
- n[10].data = (void *) pnts;
- }
- if (ctx->ExecuteFlag) {
- CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
- v1, v2, vstride, vorder, points));
- }
-}
-
-
-static void GLAPIENTRY
-save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
- if (n) {
- n[1].i = un;
- n[2].f = u1;
- n[3].f = u2;
- }
- if (ctx->ExecuteFlag) {
- CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
- }
-}
-
-
-static void GLAPIENTRY
-save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
-}
-
-
-static void GLAPIENTRY
-save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
- GLint vn, GLfloat v1, GLfloat v2)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
- if (n) {
- n[1].i = un;
- n[2].f = u1;
- n[3].f = u2;
- n[4].i = vn;
- n[5].f = v1;
- n[6].f = v2;
- }
- if (ctx->ExecuteFlag) {
- CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
- }
-}
-
-
-
-static void GLAPIENTRY
-save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
- GLint vn, GLdouble v1, GLdouble v2)
-{
- save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
- vn, (GLfloat) v1, (GLfloat) v2);
-}
-
-
-static void GLAPIENTRY
-save_MatrixMode(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
- if (n) {
- n[1].e = mode;
- }
- if (ctx->ExecuteFlag) {
- CALL_MatrixMode(ctx->Exec, (mode));
- }
-}
-
-
-static void GLAPIENTRY
-save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MIN_MAX, 3);
- if (n) {
- n[1].e = target;
- n[2].e = internalFormat;
- n[3].b = sink;
- }
- if (ctx->ExecuteFlag) {
- CALL_Minmax(ctx->Exec, (target, internalFormat, sink));
- }
-}
-
-
-static void GLAPIENTRY
-save_MultMatrixf(const GLfloat * m)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
- if (n) {
- GLuint i;
- for (i = 0; i < 16; i++) {
- n[1 + i].f = m[i];
- }
- }
- if (ctx->ExecuteFlag) {
- CALL_MultMatrixf(ctx->Exec, (m));
- }
-}
-
-
-static void GLAPIENTRY
-save_MultMatrixd(const GLdouble * m)
-{
- GLfloat f[16];
- GLint i;
- for (i = 0; i < 16; i++) {
- f[i] = (GLfloat) m[i];
- }
- save_MultMatrixf(f);
-}
-
-
-static void GLAPIENTRY
-save_NewList(GLuint name, GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- /* It's an error to call this function while building a display list */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
- (void) name;
- (void) mode;
-}
-
-
-
-static void GLAPIENTRY
-save_Ortho(GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
- if (n) {
- n[1].f = (GLfloat) left;
- n[2].f = (GLfloat) right;
- n[3].f = (GLfloat) bottom;
- n[4].f = (GLfloat) top;
- n[5].f = (GLfloat) nearval;
- n[6].f = (GLfloat) farval;
- }
- if (ctx->ExecuteFlag) {
- CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
- }
-}
-
-
-static void GLAPIENTRY
-save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 3);
- if (n) {
- n[1].e = map;
- n[2].i = mapsize;
- n[3].data = (void *) malloc(mapsize * sizeof(GLfloat));
- memcpy(n[3].data, (void *) values, mapsize * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
- }
-}
-
-
-static void GLAPIENTRY
-save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
- GLint i;
- if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
- for (i = 0; i < mapsize; i++) {
- fvalues[i] = (GLfloat) values[i];
- }
- }
- else {
- for (i = 0; i < mapsize; i++) {
- fvalues[i] = UINT_TO_FLOAT(values[i]);
- }
- }
- save_PixelMapfv(map, mapsize, fvalues);
-}
-
-
-static void GLAPIENTRY
-save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
- GLint i;
- if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
- for (i = 0; i < mapsize; i++) {
- fvalues[i] = (GLfloat) values[i];
- }
- }
- else {
- for (i = 0; i < mapsize; i++) {
- fvalues[i] = USHORT_TO_FLOAT(values[i]);
- }
- }
- save_PixelMapfv(map, mapsize, fvalues);
-}
-
-
-static void GLAPIENTRY
-save_PixelTransferf(GLenum pname, GLfloat param)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
- if (n) {
- n[1].e = pname;
- n[2].f = param;
- }
- if (ctx->ExecuteFlag) {
- CALL_PixelTransferf(ctx->Exec, (pname, param));
- }
-}
-
-
-static void GLAPIENTRY
-save_PixelTransferi(GLenum pname, GLint param)
-{
- save_PixelTransferf(pname, (GLfloat) param);
-}
-
-
-static void GLAPIENTRY
-save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
- if (n) {
- n[1].f = xfactor;
- n[2].f = yfactor;
- }
- if (ctx->ExecuteFlag) {
- CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
- }
-}
-
-
-static void GLAPIENTRY
-save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
- if (n) {
- n[1].e = pname;
- n[2].f = params[0];
- n[3].f = params[1];
- n[4].f = params[2];
- }
- if (ctx->ExecuteFlag) {
- CALL_PointParameterfvEXT(ctx->Exec, (pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_PointParameterfEXT(GLenum pname, GLfloat param)
-{
- GLfloat parray[3];
- parray[0] = param;
- parray[1] = parray[2] = 0.0F;
- save_PointParameterfvEXT(pname, parray);
-}
-
-static void GLAPIENTRY
-save_PointParameteriNV(GLenum pname, GLint param)
-{
- GLfloat parray[3];
- parray[0] = (GLfloat) param;
- parray[1] = parray[2] = 0.0F;
- save_PointParameterfvEXT(pname, parray);
-}
-
-static void GLAPIENTRY
-save_PointParameterivNV(GLenum pname, const GLint * param)
-{
- GLfloat parray[3];
- parray[0] = (GLfloat) param[0];
- parray[1] = parray[2] = 0.0F;
- save_PointParameterfvEXT(pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_PointSize(GLfloat size)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
- if (n) {
- n[1].f = size;
- }
- if (ctx->ExecuteFlag) {
- CALL_PointSize(ctx->Exec, (size));
- }
-}
-
-
-static void GLAPIENTRY
-save_PolygonMode(GLenum face, GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
- if (n) {
- n[1].e = face;
- n[2].e = mode;
- }
- if (ctx->ExecuteFlag) {
- CALL_PolygonMode(ctx->Exec, (face, mode));
- }
-}
-
-
-static void GLAPIENTRY
-save_PolygonStipple(const GLubyte * pattern)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, 1);
- if (n) {
- n[1].data = unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
- pattern, &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
- }
-}
-
-
-static void GLAPIENTRY
-save_PolygonOffset(GLfloat factor, GLfloat units)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
- if (n) {
- n[1].f = factor;
- n[2].f = units;
- }
- if (ctx->ExecuteFlag) {
- CALL_PolygonOffset(ctx->Exec, (factor, units));
- }
-}
-
-
-static void GLAPIENTRY
-save_PolygonOffsetEXT(GLfloat factor, GLfloat bias)
-{
- GET_CURRENT_CONTEXT(ctx);
- /* XXX mult by DepthMaxF here??? */
- save_PolygonOffset(factor, ctx->DrawBuffer->_DepthMaxF * bias);
-}
-
-
-static void GLAPIENTRY
-save_PopAttrib(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
- if (ctx->ExecuteFlag) {
- CALL_PopAttrib(ctx->Exec, ());
- }
-}
-
-
-static void GLAPIENTRY
-save_PopMatrix(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
- if (ctx->ExecuteFlag) {
- CALL_PopMatrix(ctx->Exec, ());
- }
-}
-
-
-static void GLAPIENTRY
-save_PopName(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
- if (ctx->ExecuteFlag) {
- CALL_PopName(ctx->Exec, ());
- }
-}
-
-
-static void GLAPIENTRY
-save_PrioritizeTextures(GLsizei num, const GLuint * textures,
- const GLclampf * priorities)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- for (i = 0; i < num; i++) {
- Node *n;
- n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
- if (n) {
- n[1].ui = textures[i];
- n[2].f = priorities[i];
- }
- }
- if (ctx->ExecuteFlag) {
- CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
- }
-}
-
-
-static void GLAPIENTRY
-save_PushAttrib(GLbitfield mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
- if (n) {
- n[1].bf = mask;
- }
- if (ctx->ExecuteFlag) {
- CALL_PushAttrib(ctx->Exec, (mask));
- }
-}
-
-
-static void GLAPIENTRY
-save_PushMatrix(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
- if (ctx->ExecuteFlag) {
- CALL_PushMatrix(ctx->Exec, ());
- }
-}
-
-
-static void GLAPIENTRY
-save_PushName(GLuint name)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
- if (n) {
- n[1].ui = name;
- }
- if (ctx->ExecuteFlag) {
- CALL_PushName(ctx->Exec, (name));
- }
-}
-
-
-static void GLAPIENTRY
-save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
- if (n) {
- n[1].f = x;
- n[2].f = y;
- n[3].f = z;
- n[4].f = w;
- }
- if (ctx->ExecuteFlag) {
- CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
- }
-}
-
-static void GLAPIENTRY
-save_RasterPos2d(GLdouble x, GLdouble y)
-{
- save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos2f(GLfloat x, GLfloat y)
-{
- save_RasterPos4f(x, y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos2i(GLint x, GLint y)
-{
- save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos2s(GLshort x, GLshort y)
-{
- save_RasterPos4f(x, y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- save_RasterPos4f(x, y, z, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos3i(GLint x, GLint y, GLint z)
-{
- save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- save_RasterPos4f(x, y, z, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-static void GLAPIENTRY
-save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-static void GLAPIENTRY
-save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- save_RasterPos4f(x, y, z, w);
-}
-
-static void GLAPIENTRY
-save_RasterPos2dv(const GLdouble * v)
-{
- save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos2fv(const GLfloat * v)
-{
- save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos2iv(const GLint * v)
-{
- save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos2sv(const GLshort * v)
-{
- save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos3dv(const GLdouble * v)
-{
- save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos3fv(const GLfloat * v)
-{
- save_RasterPos4f(v[0], v[1], v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos3iv(const GLint * v)
-{
- save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos3sv(const GLshort * v)
-{
- save_RasterPos4f(v[0], v[1], v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-save_RasterPos4dv(const GLdouble * v)
-{
- save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
-}
-
-static void GLAPIENTRY
-save_RasterPos4fv(const GLfloat * v)
-{
- save_RasterPos4f(v[0], v[1], v[2], v[3]);
-}
-
-static void GLAPIENTRY
-save_RasterPos4iv(const GLint * v)
-{
- save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
-}
-
-static void GLAPIENTRY
-save_RasterPos4sv(const GLshort * v)
-{
- save_RasterPos4f(v[0], v[1], v[2], v[3]);
-}
-
-
-static void GLAPIENTRY
-save_PassThrough(GLfloat token)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
- if (n) {
- n[1].f = token;
- }
- if (ctx->ExecuteFlag) {
- CALL_PassThrough(ctx->Exec, (token));
- }
-}
-
-
-static void GLAPIENTRY
-save_ReadBuffer(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
- if (n) {
- n[1].e = mode;
- }
- if (ctx->ExecuteFlag) {
- CALL_ReadBuffer(ctx->Exec, (mode));
- }
-}
-
-
-static void GLAPIENTRY
-save_ResetHistogram(GLenum target)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_RESET_HISTOGRAM, 1);
- if (n) {
- n[1].e = target;
- }
- if (ctx->ExecuteFlag) {
- CALL_ResetHistogram(ctx->Exec, (target));
- }
-}
-
-
-static void GLAPIENTRY
-save_ResetMinmax(GLenum target)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_RESET_MIN_MAX, 1);
- if (n) {
- n[1].e = target;
- }
- if (ctx->ExecuteFlag) {
- CALL_ResetMinmax(ctx->Exec, (target));
- }
-}
-
-
-static void GLAPIENTRY
-save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
- if (n) {
- n[1].f = angle;
- n[2].f = x;
- n[3].f = y;
- n[4].f = z;
- }
- if (ctx->ExecuteFlag) {
- CALL_Rotatef(ctx->Exec, (angle, x, y, z));
- }
-}
-
-
-static void GLAPIENTRY
-save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
-}
-
-
-static void GLAPIENTRY
-save_Scalef(GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_SCALE, 3);
- if (n) {
- n[1].f = x;
- n[2].f = y;
- n[3].f = z;
- }
- if (ctx->ExecuteFlag) {
- CALL_Scalef(ctx->Exec, (x, y, z));
- }
-}
-
-
-static void GLAPIENTRY
-save_Scaled(GLdouble x, GLdouble y, GLdouble z)
-{
- save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
-}
-
-
-static void GLAPIENTRY
-save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
- if (n) {
- n[1].i = x;
- n[2].i = y;
- n[3].i = width;
- n[4].i = height;
- }
- if (ctx->ExecuteFlag) {
- CALL_Scissor(ctx->Exec, (x, y, width, height));
- }
-}
-
-
-static void GLAPIENTRY
-save_ShadeModel(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
-
- if (ctx->ExecuteFlag) {
- CALL_ShadeModel(ctx->Exec, (mode));
- }
-
- if (ctx->ListState.Current.ShadeModel == mode)
- return;
-
- SAVE_FLUSH_VERTICES(ctx);
-
- /* Only save the value if we know the statechange will take effect:
- */
- if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END)
- ctx->ListState.Current.ShadeModel = mode;
-
- n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
- if (n) {
- n[1].e = mode;
- }
-}
-
-
-static void GLAPIENTRY
-save_StencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
- if (n) {
- n[1].e = func;
- n[2].i = ref;
- n[3].ui = mask;
- }
- if (ctx->ExecuteFlag) {
- CALL_StencilFunc(ctx->Exec, (func, ref, mask));
- }
-}
-
-
-static void GLAPIENTRY
-save_StencilMask(GLuint mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
- if (n) {
- n[1].ui = mask;
- }
- if (ctx->ExecuteFlag) {
- CALL_StencilMask(ctx->Exec, (mask));
- }
-}
-
-
-static void GLAPIENTRY
-save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
- if (n) {
- n[1].e = fail;
- n[2].e = zfail;
- n[3].e = zpass;
- }
- if (ctx->ExecuteFlag) {
- CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
- }
-}
-
-
-static void GLAPIENTRY
-save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
- if (n) {
- n[1].e = face;
- n[2].e = func;
- n[3].i = ref;
- n[4].ui = mask;
- }
- if (ctx->ExecuteFlag) {
- CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
- }
-}
-
-
-static void GLAPIENTRY
-save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
- GLuint mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- /* GL_FRONT */
- n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
- if (n) {
- n[1].e = GL_FRONT;
- n[2].e = frontfunc;
- n[3].i = ref;
- n[4].ui = mask;
- }
- /* GL_BACK */
- n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
- if (n) {
- n[1].e = GL_BACK;
- n[2].e = backfunc;
- n[3].i = ref;
- n[4].ui = mask;
- }
- if (ctx->ExecuteFlag) {
- CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
- CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
- }
-}
-
-
-static void GLAPIENTRY
-save_StencilMaskSeparate(GLenum face, GLuint mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
- if (n) {
- n[1].e = face;
- n[2].ui = mask;
- }
- if (ctx->ExecuteFlag) {
- CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
- }
-}
-
-
-static void GLAPIENTRY
-save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
- if (n) {
- n[1].e = face;
- n[2].e = fail;
- n[3].e = zfail;
- n[4].e = zpass;
- }
- if (ctx->ExecuteFlag) {
- CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
- }
-}
-
-
-static void GLAPIENTRY
-save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- if (pname == GL_TEXTURE_ENV_COLOR) {
- n[3].f = params[0];
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
- }
- else {
- n[3].f = params[0];
- n[4].f = n[5].f = n[6].f = 0.0F;
- }
- }
- if (ctx->ExecuteFlag) {
- CALL_TexEnvfv(ctx->Exec, (target, pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- GLfloat parray[4];
- parray[0] = (GLfloat) param;
- parray[1] = parray[2] = parray[3] = 0.0F;
- save_TexEnvfv(target, pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_TexEnvi(GLenum target, GLenum pname, GLint param)
-{
- GLfloat p[4];
- p[0] = (GLfloat) param;
- p[1] = p[2] = p[3] = 0.0F;
- save_TexEnvfv(target, pname, p);
-}
-
-
-static void GLAPIENTRY
-save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
-{
- GLfloat p[4];
- if (pname == GL_TEXTURE_ENV_COLOR) {
- p[0] = INT_TO_FLOAT(param[0]);
- p[1] = INT_TO_FLOAT(param[1]);
- p[2] = INT_TO_FLOAT(param[2]);
- p[3] = INT_TO_FLOAT(param[3]);
- }
- else {
- p[0] = (GLfloat) param[0];
- p[1] = p[2] = p[3] = 0.0F;
- }
- save_TexEnvfv(target, pname, p);
-}
-
-
-static void GLAPIENTRY
-save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
- if (n) {
- n[1].e = coord;
- n[2].e = pname;
- n[3].f = params[0];
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_TexGenfv(ctx->Exec, (coord, pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- GLfloat p[4];
- p[0] = (GLfloat) params[0];
- p[1] = (GLfloat) params[1];
- p[2] = (GLfloat) params[2];
- p[3] = (GLfloat) params[3];
- save_TexGenfv(coord, pname, p);
-}
-
-
-static void GLAPIENTRY
-save_TexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- GLfloat parray[4];
- parray[0] = (GLfloat) param;
- parray[1] = parray[2] = parray[3] = 0.0F;
- save_TexGenfv(coord, pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- GLfloat p[4];
- p[0] = (GLfloat) params[0];
- p[1] = (GLfloat) params[1];
- p[2] = (GLfloat) params[2];
- p[3] = (GLfloat) params[3];
- save_TexGenfv(coord, pname, p);
-}
-
-
-static void GLAPIENTRY
-save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- GLfloat parray[4];
- parray[0] = param;
- parray[1] = parray[2] = parray[3] = 0.0F;
- save_TexGenfv(coord, pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_TexGeni(GLenum coord, GLenum pname, GLint param)
-{
- GLint parray[4];
- parray[0] = param;
- parray[1] = parray[2] = parray[3] = 0;
- save_TexGeniv(coord, pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].f = params[0];
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_TexParameterfv(ctx->Exec, (target, pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- GLfloat parray[4];
- parray[0] = param;
- parray[1] = parray[2] = parray[3] = 0.0F;
- save_TexParameterfv(target, pname, parray);
-}
-
-
-static void GLAPIENTRY
-save_TexParameteri(GLenum target, GLenum pname, GLint param)
-{
- GLfloat fparam[4];
- fparam[0] = (GLfloat) param;
- fparam[1] = fparam[2] = fparam[3] = 0.0F;
- save_TexParameterfv(target, pname, fparam);
-}
-
-
-static void GLAPIENTRY
-save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- GLfloat fparam[4];
- fparam[0] = (GLfloat) params[0];
- fparam[1] = fparam[2] = fparam[3] = 0.0F;
- save_TexParameterfv(target, pname, fparam);
-}
-
-
-static void GLAPIENTRY
-save_TexImage1D(GLenum target,
- GLint level, GLint components,
- GLsizei width, GLint border,
- GLenum format, GLenum type, const GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (target == GL_PROXY_TEXTURE_1D) {
- /* don't compile, execute immediately */
- CALL_TexImage1D(ctx->Exec, (target, level, components, width,
- border, format, type, pixels));
- }
- else {
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 8);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = components;
- n[4].i = (GLint) width;
- n[5].i = border;
- n[6].e = format;
- n[7].e = type;
- n[8].data = unpack_image(ctx, 1, width, 1, 1, format, type,
- pixels, &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_TexImage1D(ctx->Exec, (target, level, components, width,
- border, format, type, pixels));
- }
- }
-}
-
-
-static void GLAPIENTRY
-save_TexImage2D(GLenum target,
- GLint level, GLint components,
- GLsizei width, GLsizei height, GLint border,
- GLenum format, GLenum type, const GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (target == GL_PROXY_TEXTURE_2D) {
- /* don't compile, execute immediately */
- CALL_TexImage2D(ctx->Exec, (target, level, components, width,
- height, border, format, type, pixels));
- }
- else {
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 9);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = components;
- n[4].i = (GLint) width;
- n[5].i = (GLint) height;
- n[6].i = border;
- n[7].e = format;
- n[8].e = type;
- n[9].data = unpack_image(ctx, 2, width, height, 1, format, type,
- pixels, &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_TexImage2D(ctx->Exec, (target, level, components, width,
- height, border, format, type, pixels));
- }
- }
-}
-
-
-static void GLAPIENTRY
-save_TexImage3D(GLenum target,
- GLint level, GLint internalFormat,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border,
- GLenum format, GLenum type, const GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (target == GL_PROXY_TEXTURE_3D) {
- /* don't compile, execute immediately */
- CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
- height, depth, border, format, type,
- pixels));
- }
- else {
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 10);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = (GLint) internalFormat;
- n[4].i = (GLint) width;
- n[5].i = (GLint) height;
- n[6].i = (GLint) depth;
- n[7].i = border;
- n[8].e = format;
- n[9].e = type;
- n[10].data = unpack_image(ctx, 3, width, height, depth, format, type,
- pixels, &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
- height, depth, border, format, type,
- pixels));
- }
- }
-}
-
-
-static void GLAPIENTRY
-save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
- GLsizei width, GLenum format, GLenum type,
- const GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 7);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = (GLint) width;
- n[5].e = format;
- n[6].e = type;
- n[7].data = unpack_image(ctx, 1, width, 1, 1, format, type,
- pixels, &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
- format, type, pixels));
- }
-}
-
-
-static void GLAPIENTRY
-save_TexSubImage2D(GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 9);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = yoffset;
- n[5].i = (GLint) width;
- n[6].i = (GLint) height;
- n[7].e = format;
- n[8].e = type;
- n[9].data = unpack_image(ctx, 2, width, height, 1, format, type,
- pixels, &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
- width, height, format, type, pixels));
- }
-}
-
-
-static void GLAPIENTRY
-save_TexSubImage3D(GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 11);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = yoffset;
- n[5].i = zoffset;
- n[6].i = (GLint) width;
- n[7].i = (GLint) height;
- n[8].i = (GLint) depth;
- n[9].e = format;
- n[10].e = type;
- n[11].data = unpack_image(ctx, 3, width, height, depth, format, type,
- pixels, &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_TexSubImage3D(ctx->Exec, (target, level,
- xoffset, yoffset, zoffset,
- width, height, depth, format, type,
- pixels));
- }
-}
-
-
-static void GLAPIENTRY
-save_Translatef(GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
- if (n) {
- n[1].f = x;
- n[2].f = y;
- n[3].f = z;
- }
- if (ctx->ExecuteFlag) {
- CALL_Translatef(ctx->Exec, (x, y, z));
- }
-}
-
-
-static void GLAPIENTRY
-save_Translated(GLdouble x, GLdouble y, GLdouble z)
-{
- save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
-}
-
-
-
-static void GLAPIENTRY
-save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
- if (n) {
- n[1].i = x;
- n[2].i = y;
- n[3].i = (GLint) width;
- n[4].i = (GLint) height;
- }
- if (ctx->ExecuteFlag) {
- CALL_Viewport(ctx->Exec, (x, y, width, height));
- }
-}
-
-
-static void GLAPIENTRY
-save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
- if (n) {
- n[1].f = x;
- n[2].f = y;
- n[3].f = z;
- n[4].f = w;
- }
- if (ctx->ExecuteFlag) {
- CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
- }
-}
-
-static void GLAPIENTRY
-save_WindowPos2dMESA(GLdouble x, GLdouble y)
-{
- save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos2fMESA(GLfloat x, GLfloat y)
-{
- save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos2iMESA(GLint x, GLint y)
-{
- save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos2sMESA(GLshort x, GLshort y)
-{
- save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
-{
- save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
-{
- save_WindowPos4fMESA(x, y, z, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos3iMESA(GLint x, GLint y, GLint z)
-{
- save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
-{
- save_WindowPos4fMESA(x, y, z, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-static void GLAPIENTRY
-save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
-{
- save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-static void GLAPIENTRY
-save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- save_WindowPos4fMESA(x, y, z, w);
-}
-
-static void GLAPIENTRY
-save_WindowPos2dvMESA(const GLdouble * v)
-{
- save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos2fvMESA(const GLfloat * v)
-{
- save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos2ivMESA(const GLint * v)
-{
- save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos2svMESA(const GLshort * v)
-{
- save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos3dvMESA(const GLdouble * v)
-{
- save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos3fvMESA(const GLfloat * v)
-{
- save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos3ivMESA(const GLint * v)
-{
- save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos3svMESA(const GLshort * v)
-{
- save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-save_WindowPos4dvMESA(const GLdouble * v)
-{
- save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
-}
-
-static void GLAPIENTRY
-save_WindowPos4fvMESA(const GLfloat * v)
-{
- save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
-}
-
-static void GLAPIENTRY
-save_WindowPos4ivMESA(const GLint * v)
-{
- save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
-}
-
-static void GLAPIENTRY
-save_WindowPos4svMESA(const GLshort * v)
-{
- save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
-}
-
-
-
-/* GL_ARB_multitexture */
-static void GLAPIENTRY
-save_ActiveTextureARB(GLenum target)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
- if (n) {
- n[1].e = target;
- }
- if (ctx->ExecuteFlag) {
- CALL_ActiveTextureARB(ctx->Exec, (target));
- }
-}
-
-
-/* GL_ARB_transpose_matrix */
-
-static void GLAPIENTRY
-save_LoadTransposeMatrixdARB(const GLdouble m[16])
-{
- GLfloat tm[16];
- _math_transposefd(tm, m);
- save_LoadMatrixf(tm);
-}
-
-
-static void GLAPIENTRY
-save_LoadTransposeMatrixfARB(const GLfloat m[16])
-{
- GLfloat tm[16];
- _math_transposef(tm, m);
- save_LoadMatrixf(tm);
-}
-
-
-static void GLAPIENTRY
-save_MultTransposeMatrixdARB(const GLdouble m[16])
-{
- GLfloat tm[16];
- _math_transposefd(tm, m);
- save_MultMatrixf(tm);
-}
-
-
-static void GLAPIENTRY
-save_MultTransposeMatrixfARB(const GLfloat m[16])
-{
- GLfloat tm[16];
- _math_transposef(tm, m);
- save_MultMatrixf(tm);
-}
-
-
-/* GL_ARB_texture_compression */
-static void GLAPIENTRY
-save_CompressedTexImage1DARB(GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLint border, GLsizei imageSize,
- const GLvoid * data)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (target == GL_PROXY_TEXTURE_1D) {
- /* don't compile, execute immediately */
- CALL_CompressedTexImage1DARB(ctx->Exec, (target, level, internalFormat,
- width, border, imageSize,
- data));
- }
- else {
- Node *n;
- GLvoid *image;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- /* make copy of image */
- image = malloc(imageSize);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB");
- return;
- }
- memcpy(image, data, imageSize);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].e = internalFormat;
- n[4].i = (GLint) width;
- n[5].i = border;
- n[6].i = imageSize;
- n[7].data = image;
- }
- else if (image) {
- free(image);
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexImage1DARB(ctx->Exec,
- (target, level, internalFormat, width,
- border, imageSize, data));
- }
- }
-}
-
-
-static void GLAPIENTRY
-save_CompressedTexImage2DARB(GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLsizei height, GLint border, GLsizei imageSize,
- const GLvoid * data)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (target == GL_PROXY_TEXTURE_2D) {
- /* don't compile, execute immediately */
- CALL_CompressedTexImage2DARB(ctx->Exec, (target, level, internalFormat,
- width, height, border,
- imageSize, data));
- }
- else {
- Node *n;
- GLvoid *image;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- /* make copy of image */
- image = malloc(imageSize);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
- return;
- }
- memcpy(image, data, imageSize);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].e = internalFormat;
- n[4].i = (GLint) width;
- n[5].i = (GLint) height;
- n[6].i = border;
- n[7].i = imageSize;
- n[8].data = image;
- }
- else if (image) {
- free(image);
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexImage2DARB(ctx->Exec,
- (target, level, internalFormat, width,
- height, border, imageSize, data));
- }
- }
-}
-
-
-static void GLAPIENTRY
-save_CompressedTexImage3DARB(GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLsizei height, GLsizei depth, GLint border,
- GLsizei imageSize, const GLvoid * data)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (target == GL_PROXY_TEXTURE_3D) {
- /* don't compile, execute immediately */
- CALL_CompressedTexImage3DARB(ctx->Exec, (target, level, internalFormat,
- width, height, depth, border,
- imageSize, data));
- }
- else {
- Node *n;
- GLvoid *image;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- /* make copy of image */
- image = malloc(imageSize);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB");
- return;
- }
- memcpy(image, data, imageSize);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].e = internalFormat;
- n[4].i = (GLint) width;
- n[5].i = (GLint) height;
- n[6].i = (GLint) depth;
- n[7].i = border;
- n[8].i = imageSize;
- n[9].data = image;
- }
- else if (image) {
- free(image);
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexImage3DARB(ctx->Exec,
- (target, level, internalFormat, width,
- height, depth, border, imageSize,
- data));
- }
- }
-}
-
-
-static void GLAPIENTRY
-save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
- GLsizei width, GLenum format,
- GLsizei imageSize, const GLvoid * data)
-{
- Node *n;
- GLvoid *image;
-
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- /* make copy of image */
- image = malloc(imageSize);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB");
- return;
- }
- memcpy(image, data, imageSize);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = (GLint) width;
- n[5].e = format;
- n[6].i = imageSize;
- n[7].data = image;
- }
- else if (image) {
- free(image);
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset,
- width, format, imageSize,
- data));
- }
-}
-
-
-static void GLAPIENTRY
-save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
- GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize,
- const GLvoid * data)
-{
- Node *n;
- GLvoid *image;
-
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- /* make copy of image */
- image = malloc(imageSize);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB");
- return;
- }
- memcpy(image, data, imageSize);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = yoffset;
- n[5].i = (GLint) width;
- n[6].i = (GLint) height;
- n[7].e = format;
- n[8].i = imageSize;
- n[9].data = image;
- }
- else if (image) {
- free(image);
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexSubImage2DARB(ctx->Exec,
- (target, level, xoffset, yoffset, width,
- height, format, imageSize, data));
- }
-}
-
-
-static void GLAPIENTRY
-save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
- GLint yoffset, GLint zoffset, GLsizei width,
- GLsizei height, GLsizei depth, GLenum format,
- GLsizei imageSize, const GLvoid * data)
-{
- Node *n;
- GLvoid *image;
-
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- /* make copy of image */
- image = malloc(imageSize);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB");
- return;
- }
- memcpy(image, data, imageSize);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = yoffset;
- n[5].i = zoffset;
- n[6].i = (GLint) width;
- n[7].i = (GLint) height;
- n[8].i = (GLint) depth;
- n[9].e = format;
- n[10].i = imageSize;
- n[11].data = image;
- }
- else if (image) {
- free(image);
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexSubImage3DARB(ctx->Exec,
- (target, level, xoffset, yoffset,
- zoffset, width, height, depth, format,
- imageSize, data));
- }
-}
-
-
-/* GL_ARB_multisample */
-static void GLAPIENTRY
-save_SampleCoverageARB(GLclampf value, GLboolean invert)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
- if (n) {
- n[1].f = value;
- n[2].b = invert;
- }
- if (ctx->ExecuteFlag) {
- CALL_SampleCoverageARB(ctx->Exec, (value, invert));
- }
-}
-
-
-/*
- * GL_NV_vertex_program
- */
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
-static void GLAPIENTRY
-save_BindProgramNV(GLenum target, GLuint id)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_NV, 2);
- if (n) {
- n[1].e = target;
- n[2].ui = id;
- }
- if (ctx->ExecuteFlag) {
- CALL_BindProgramNV(ctx->Exec, (target, id));
- }
-}
-
-static void GLAPIENTRY
-save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = index;
- n[3].f = x;
- n[4].f = y;
- n[5].f = z;
- n[6].f = w;
- }
- if (ctx->ExecuteFlag) {
- CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
- const GLfloat *params)
-{
- save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
- params[2], params[3]);
-}
-
-
-static void GLAPIENTRY
-save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
- const GLfloat * params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- if (count > 0) {
- GLint i;
- const GLfloat * p = params;
-
- for (i = 0 ; i < count ; i++) {
- n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = index;
- n[3].f = p[0];
- n[4].f = p[1];
- n[5].f = p[2];
- n[6].f = p[3];
- p += 4;
- }
- }
- }
-
- if (ctx->ExecuteFlag) {
- CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
- GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- save_ProgramEnvParameter4fARB(target, index,
- (GLfloat) x,
- (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-
-static void GLAPIENTRY
-save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
- const GLdouble *params)
-{
- save_ProgramEnvParameter4fARB(target, index,
- (GLfloat) params[0],
- (GLfloat) params[1],
- (GLfloat) params[2], (GLfloat) params[3]);
-}
-
-#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
-
-#if FEATURE_NV_vertex_program
-static void GLAPIENTRY
-save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = id;
- n[3].f = params[0];
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_ExecuteProgramNV(ctx->Exec, (target, id, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramParameters4dvNV(GLenum target, GLuint index,
- GLsizei num, const GLdouble *params)
-{
- GLint i;
- for (i = 0; i < num; i++) {
- save_ProgramEnvParameter4dvARB(target, index + i, params + 4 * i);
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramParameters4fvNV(GLenum target, GLuint index,
- GLsizei num, const GLfloat *params)
-{
- GLint i;
- for (i = 0; i < num; i++) {
- save_ProgramEnvParameter4fvARB(target, index + i, params + 4 * i);
- }
-}
-
-
-static void GLAPIENTRY
-save_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
- const GLubyte * program)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
- if (n) {
- GLubyte *programCopy = (GLubyte *) malloc(len);
- if (!programCopy) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- memcpy(programCopy, program, len);
- n[1].e = target;
- n[2].ui = id;
- n[3].i = len;
- n[4].data = programCopy;
- }
- if (ctx->ExecuteFlag) {
- CALL_LoadProgramNV(ctx->Exec, (target, id, len, program));
- }
-}
-
-
-static void GLAPIENTRY
-save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2);
- if (n) {
- GLuint *idCopy = (GLuint *) malloc(num * sizeof(GLuint));
- if (!idCopy) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
- return;
- }
- memcpy(idCopy, ids, num * sizeof(GLuint));
- n[1].i = num;
- n[2].data = idCopy;
- }
- if (ctx->ExecuteFlag) {
- CALL_RequestResidentProgramsNV(ctx->Exec, (num, ids));
- }
-}
-
-
-static void GLAPIENTRY
-save_TrackMatrixNV(GLenum target, GLuint address,
- GLenum matrix, GLenum transform)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 4);
- if (n) {
- n[1].e = target;
- n[2].ui = address;
- n[3].e = matrix;
- n[4].e = transform;
- }
- if (ctx->ExecuteFlag) {
- CALL_TrackMatrixNV(ctx->Exec, (target, address, matrix, transform));
- }
-}
-#endif /* FEATURE_NV_vertex_program */
-
-
-/*
- * GL_NV_fragment_program
- */
-#if FEATURE_NV_fragment_program
-static void GLAPIENTRY
-save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = index;
- n[3].f = x;
- n[4].f = y;
- n[5].f = z;
- n[6].f = w;
- }
- if (ctx->ExecuteFlag) {
- CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
- const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = index;
- n[3].f = params[0];
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
- const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- if (count > 0) {
- GLint i;
- const GLfloat * p = params;
-
- for (i = 0 ; i < count ; i++) {
- n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = index;
- n[3].f = p[0];
- n[4].f = p[1];
- n[5].f = p[2];
- n[6].f = p[3];
- p += 4;
- }
- }
- }
-
- if (ctx->ExecuteFlag) {
- CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
- GLdouble x, GLdouble y,
- GLdouble z, GLdouble w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = index;
- n[3].f = (GLfloat) x;
- n[4].f = (GLfloat) y;
- n[5].f = (GLfloat) z;
- n[6].f = (GLfloat) w;
- }
- if (ctx->ExecuteFlag) {
- CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
- const GLdouble *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = index;
- n[3].f = (GLfloat) params[0];
- n[4].f = (GLfloat) params[1];
- n[5].f = (GLfloat) params[2];
- n[6].f = (GLfloat) params[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
- }
-}
-
-static void GLAPIENTRY
-save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
- if (n) {
- GLubyte *nameCopy = (GLubyte *) malloc(len);
- if (!nameCopy) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
- return;
- }
- memcpy(nameCopy, name, len);
- n[1].ui = id;
- n[2].i = len;
- n[3].data = nameCopy;
- n[4].f = x;
- n[5].f = y;
- n[6].f = z;
- n[7].f = w;
- }
- if (ctx->ExecuteFlag) {
- CALL_ProgramNamedParameter4fNV(ctx->Exec, (id, len, name, x, y, z, w));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte * name,
- const float v[])
-{
- save_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]);
-}
-
-
-static void GLAPIENTRY
-save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte * name,
- GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) x, (GLfloat) y,
- (GLfloat) z, (GLfloat) w);
-}
-
-
-static void GLAPIENTRY
-save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name,
- const double v[])
-{
- save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) v[0],
- (GLfloat) v[1], (GLfloat) v[2],
- (GLfloat) v[3]);
-}
-
-#endif /* FEATURE_NV_fragment_program */
-
-
-
-/* GL_EXT_stencil_two_side */
-static void GLAPIENTRY
-save_ActiveStencilFaceEXT(GLenum face)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
- if (n) {
- n[1].e = face;
- }
- if (ctx->ExecuteFlag) {
- CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
- }
-}
-
-
-/* GL_EXT_depth_bounds_test */
-static void GLAPIENTRY
-save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
- if (n) {
- n[1].f = (GLfloat) zmin;
- n[2].f = (GLfloat) zmax;
- }
- if (ctx->ExecuteFlag) {
- CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
- }
-}
-
-
-
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
-
-static void GLAPIENTRY
-save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
- const GLvoid * string)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
- if (n) {
- GLubyte *programCopy = (GLubyte *) malloc(len);
- if (!programCopy) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
- return;
- }
- memcpy(programCopy, string, len);
- n[1].e = target;
- n[2].e = format;
- n[3].i = len;
- n[4].data = programCopy;
- }
- if (ctx->ExecuteFlag) {
- CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
- }
-}
-
-#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
-
-
-#if FEATURE_queryobj
-
-static void GLAPIENTRY
-save_BeginQueryARB(GLenum target, GLuint id)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
- if (n) {
- n[1].e = target;
- n[2].ui = id;
- }
- if (ctx->ExecuteFlag) {
- CALL_BeginQueryARB(ctx->Exec, (target, id));
- }
-}
-
-
-static void GLAPIENTRY
-save_EndQueryARB(GLenum target)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
- if (n) {
- n[1].e = target;
- }
- if (ctx->ExecuteFlag) {
- CALL_EndQueryARB(ctx->Exec, (target));
- }
-}
-
-#endif /* FEATURE_queryobj */
-
-
-static void GLAPIENTRY
-save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
- if (n) {
- GLint i;
- n[1].i = count;
- if (count > MAX_DRAW_BUFFERS)
- count = MAX_DRAW_BUFFERS;
- for (i = 0; i < count; i++) {
- n[2 + i].e = buffers[i];
- }
- }
- if (ctx->ExecuteFlag) {
- CALL_DrawBuffersARB(ctx->Exec, (count, buffers));
- }
-}
-
-static void GLAPIENTRY
-save_TexBumpParameterfvATI(GLenum pname, const GLfloat *param)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- n = alloc_instruction(ctx, OPCODE_TEX_BUMP_PARAMETER_ATI, 5);
- if (n) {
- n[1].ui = pname;
- n[2].f = param[0];
- n[3].f = param[1];
- n[4].f = param[2];
- n[5].f = param[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_TexBumpParameterfvATI(ctx->Exec, (pname, param));
- }
-}
-
-static void GLAPIENTRY
-save_TexBumpParameterivATI(GLenum pname, const GLint *param)
-{
- GLfloat p[4];
- p[0] = INT_TO_FLOAT(param[0]);
- p[1] = INT_TO_FLOAT(param[1]);
- p[2] = INT_TO_FLOAT(param[2]);
- p[3] = INT_TO_FLOAT(param[3]);
- save_TexBumpParameterfvATI(pname, p);
-}
-
-#if FEATURE_ATI_fragment_shader
-static void GLAPIENTRY
-save_BindFragmentShaderATI(GLuint id)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
- if (n) {
- n[1].ui = id;
- }
- if (ctx->ExecuteFlag) {
- CALL_BindFragmentShaderATI(ctx->Exec, (id));
- }
-}
-
-static void GLAPIENTRY
-save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
- if (n) {
- n[1].ui = dst;
- n[2].f = value[0];
- n[3].f = value[1];
- n[4].f = value[2];
- n[5].f = value[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
- }
-}
-#endif
-
-static void
-save_Attr1fNV(GLenum attr, GLfloat x)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2);
- if (n) {
- n[1].e = attr;
- n[2].f = x;
- }
-
- ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
- ctx->ListState.ActiveAttribSize[attr] = 1;
- ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
-
- if (ctx->ExecuteFlag) {
- CALL_VertexAttrib1fNV(ctx->Exec, (attr, x));
- }
-}
-
-static void
-save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3);
- if (n) {
- n[1].e = attr;
- n[2].f = x;
- n[3].f = y;
- }
-
- ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
- ctx->ListState.ActiveAttribSize[attr] = 2;
- ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
-
- if (ctx->ExecuteFlag) {
- CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y));
- }
-}
-
-static void
-save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4);
- if (n) {
- n[1].e = attr;
- n[2].f = x;
- n[3].f = y;
- n[4].f = z;
- }
-
- ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
- ctx->ListState.ActiveAttribSize[attr] = 3;
- ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
-
- if (ctx->ExecuteFlag) {
- CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z));
- }
-}
-
-static void
-save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5);
- if (n) {
- n[1].e = attr;
- n[2].f = x;
- n[3].f = y;
- n[4].f = z;
- n[5].f = w;
- }
-
- ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
- ctx->ListState.ActiveAttribSize[attr] = 4;
- ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
-
- if (ctx->ExecuteFlag) {
- CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w));
- }
-}
-
-
-static void
-save_Attr1fARB(GLenum attr, GLfloat x)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2);
- if (n) {
- n[1].e = attr;
- n[2].f = x;
- }
-
- ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
- ctx->ListState.ActiveAttribSize[attr] = 1;
- ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
-
- if (ctx->ExecuteFlag) {
- CALL_VertexAttrib1fARB(ctx->Exec, (attr, x));
- }
-}
-
-static void
-save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3);
- if (n) {
- n[1].e = attr;
- n[2].f = x;
- n[3].f = y;
- }
-
- ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
- ctx->ListState.ActiveAttribSize[attr] = 2;
- ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
-
- if (ctx->ExecuteFlag) {
- CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y));
- }
-}
-
-static void
-save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4);
- if (n) {
- n[1].e = attr;
- n[2].f = x;
- n[3].f = y;
- n[4].f = z;
- }
-
- ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
- ctx->ListState.ActiveAttribSize[attr] = 3;
- ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
-
- if (ctx->ExecuteFlag) {
- CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z));
- }
-}
-
-static void
-save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5);
- if (n) {
- n[1].e = attr;
- n[2].f = x;
- n[3].f = y;
- n[4].f = z;
- n[5].f = w;
- }
-
- ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
- ctx->ListState.ActiveAttribSize[attr] = 4;
- ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
-
- if (ctx->ExecuteFlag) {
- CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w));
- }
-}
-
-
-static void GLAPIENTRY
-save_EvalCoord1f(GLfloat x)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
- if (n) {
- n[1].f = x;
- }
- if (ctx->ExecuteFlag) {
- CALL_EvalCoord1f(ctx->Exec, (x));
- }
-}
-
-static void GLAPIENTRY
-save_EvalCoord1fv(const GLfloat * v)
-{
- save_EvalCoord1f(v[0]);
-}
-
-static void GLAPIENTRY
-save_EvalCoord2f(GLfloat x, GLfloat y)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
- if (n) {
- n[1].f = x;
- n[2].f = y;
- }
- if (ctx->ExecuteFlag) {
- CALL_EvalCoord2f(ctx->Exec, (x, y));
- }
-}
-
-static void GLAPIENTRY
-save_EvalCoord2fv(const GLfloat * v)
-{
- save_EvalCoord2f(v[0], v[1]);
-}
-
-
-static void GLAPIENTRY
-save_EvalPoint1(GLint x)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
- if (n) {
- n[1].i = x;
- }
- if (ctx->ExecuteFlag) {
- CALL_EvalPoint1(ctx->Exec, (x));
- }
-}
-
-static void GLAPIENTRY
-save_EvalPoint2(GLint x, GLint y)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
- if (n) {
- n[1].i = x;
- n[2].i = y;
- }
- if (ctx->ExecuteFlag) {
- CALL_EvalPoint2(ctx->Exec, (x, y));
- }
-}
-
-static void GLAPIENTRY
-save_Indexf(GLfloat x)
-{
- save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
-}
-
-static void GLAPIENTRY
-save_Indexfv(const GLfloat * v)
-{
- save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
-}
-
-static void GLAPIENTRY
-save_EdgeFlag(GLboolean x)
-{
- save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0);
-}
-
-static INLINE GLboolean compare4fv( const GLfloat *a,
- const GLfloat *b,
- GLuint count )
-{
- return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
-}
-
-
-static void GLAPIENTRY
-save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- int args, i;
- GLuint bitmask;
-
- switch (face) {
- case GL_BACK:
- case GL_FRONT:
- case GL_FRONT_AND_BACK:
- break;
- default:
- _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(face)");
- return;
- }
-
- switch (pname) {
- case GL_EMISSION:
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- case GL_AMBIENT_AND_DIFFUSE:
- args = 4;
- break;
- case GL_SHININESS:
- args = 1;
- break;
- case GL_COLOR_INDEXES:
- args = 3;
- break;
- default:
- _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(pname)");
- return;
- }
-
- if (ctx->ExecuteFlag) {
- CALL_Materialfv(ctx->Exec, (face, pname, param));
- }
-
- bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
-
- /* Try to eliminate redundant statechanges. Because it is legal to
- * call glMaterial even inside begin/end calls, don't need to worry
- * about ctx->Driver.CurrentSavePrimitive here.
- */
- for (i = 0; i < MAT_ATTRIB_MAX; i++) {
- if (bitmask & (1 << i)) {
- if (ctx->ListState.ActiveMaterialSize[i] == args &&
- compare4fv(ctx->ListState.CurrentMaterial[i], param, args)) {
- bitmask &= ~(1 << i);
- }
- else {
- ctx->ListState.ActiveMaterialSize[i] = args;
- COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
- }
- }
- }
-
- /* If this call has effect, return early:
- */
- if (bitmask == 0)
- return;
-
- SAVE_FLUSH_VERTICES(ctx);
-
- n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
- if (n) {
- n[1].e = face;
- n[2].e = pname;
- for (i = 0; i < args; i++)
- n[3 + i].f = param[i];
- }
-}
-
-static void GLAPIENTRY
-save_Begin(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- GLboolean error = GL_FALSE;
-
- if ( /*mode < GL_POINTS || */ mode > GL_POLYGON) {
- _mesa_compile_error(ctx, GL_INVALID_ENUM, "Begin (mode)");
- error = GL_TRUE;
- }
- else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) {
- /* Typically the first begin. This may raise an error on
- * playback, depending on whether CallList is issued from inside
- * a begin/end or not.
- */
- ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM;
- }
- else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) {
- ctx->Driver.CurrentSavePrimitive = mode;
- }
- else {
- _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive begin");
- error = GL_TRUE;
- }
-
- if (!error) {
- /* Give the driver an opportunity to hook in an optimized
- * display list compiler.
- */
- if (ctx->Driver.NotifySaveBegin(ctx, mode))
- return;
-
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_BEGIN, 1);
- if (n) {
- n[1].e = mode;
- }
- }
-
- if (ctx->ExecuteFlag) {
- CALL_Begin(ctx->Exec, (mode));
- }
-}
-
-static void GLAPIENTRY
-save_End(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- SAVE_FLUSH_VERTICES(ctx);
- (void) alloc_instruction(ctx, OPCODE_END, 0);
- ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
- if (ctx->ExecuteFlag) {
- CALL_End(ctx->Exec, ());
- }
-}
-
-static void GLAPIENTRY
-save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = alloc_instruction(ctx, OPCODE_RECTF, 4);
- if (n) {
- n[1].f = a;
- n[2].f = b;
- n[3].f = c;
- n[4].f = d;
- }
- if (ctx->ExecuteFlag) {
- CALL_Rectf(ctx->Exec, (a, b, c, d));
- }
-}
-
-
-static void GLAPIENTRY
-save_Vertex2f(GLfloat x, GLfloat y)
-{
- save_Attr2fNV(VERT_ATTRIB_POS, x, y);
-}
-
-static void GLAPIENTRY
-save_Vertex2fv(const GLfloat * v)
-{
- save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]);
-}
-
-static void GLAPIENTRY
-save_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- save_Attr3fNV(VERT_ATTRIB_POS, x, y, z);
-}
-
-static void GLAPIENTRY
-save_Vertex3fv(const GLfloat * v)
-{
- save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]);
-}
-
-static void GLAPIENTRY
-save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w);
-}
-
-static void GLAPIENTRY
-save_Vertex4fv(const GLfloat * v)
-{
- save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]);
-}
-
-static void GLAPIENTRY
-save_TexCoord1f(GLfloat x)
-{
- save_Attr1fNV(VERT_ATTRIB_TEX0, x);
-}
-
-static void GLAPIENTRY
-save_TexCoord1fv(const GLfloat * v)
-{
- save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]);
-}
-
-static void GLAPIENTRY
-save_TexCoord2f(GLfloat x, GLfloat y)
-{
- save_Attr2fNV(VERT_ATTRIB_TEX0, x, y);
-}
-
-static void GLAPIENTRY
-save_TexCoord2fv(const GLfloat * v)
-{
- save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]);
-}
-
-static void GLAPIENTRY
-save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z)
-{
- save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z);
-}
-
-static void GLAPIENTRY
-save_TexCoord3fv(const GLfloat * v)
-{
- save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]);
-}
-
-static void GLAPIENTRY
-save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w);
-}
-
-static void GLAPIENTRY
-save_TexCoord4fv(const GLfloat * v)
-{
- save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]);
-}
-
-static void GLAPIENTRY
-save_Normal3f(GLfloat x, GLfloat y, GLfloat z)
-{
- save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z);
-}
-
-static void GLAPIENTRY
-save_Normal3fv(const GLfloat * v)
-{
- save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]);
-}
-
-static void GLAPIENTRY
-save_FogCoordfEXT(GLfloat x)
-{
- save_Attr1fNV(VERT_ATTRIB_FOG, x);
-}
-
-static void GLAPIENTRY
-save_FogCoordfvEXT(const GLfloat * v)
-{
- save_Attr1fNV(VERT_ATTRIB_FOG, v[0]);
-}
-
-static void GLAPIENTRY
-save_Color3f(GLfloat x, GLfloat y, GLfloat z)
-{
- save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z);
-}
-
-static void GLAPIENTRY
-save_Color3fv(const GLfloat * v)
-{
- save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]);
-}
-
-static void GLAPIENTRY
-save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w);
-}
-
-static void GLAPIENTRY
-save_Color4fv(const GLfloat * v)
-{
- save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]);
-}
-
-static void GLAPIENTRY
-save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z)
-{
- save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z);
-}
-
-static void GLAPIENTRY
-save_SecondaryColor3fvEXT(const GLfloat * v)
-{
- save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]);
-}
-
-
-/* Just call the respective ATTR for texcoord
- */
-static void GLAPIENTRY
-save_MultiTexCoord1f(GLenum target, GLfloat x)
-{
- GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr1fNV(attr, x);
-}
-
-static void GLAPIENTRY
-save_MultiTexCoord1fv(GLenum target, const GLfloat * v)
-{
- GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr1fNV(attr, v[0]);
-}
-
-static void GLAPIENTRY
-save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y)
-{
- GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr2fNV(attr, x, y);
-}
-
-static void GLAPIENTRY
-save_MultiTexCoord2fv(GLenum target, const GLfloat * v)
-{
- GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr2fNV(attr, v[0], v[1]);
-}
-
-static void GLAPIENTRY
-save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z)
-{
- GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr3fNV(attr, x, y, z);
-}
-
-static void GLAPIENTRY
-save_MultiTexCoord3fv(GLenum target, const GLfloat * v)
-{
- GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr3fNV(attr, v[0], v[1], v[2]);
-}
-
-static void GLAPIENTRY
-save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y,
- GLfloat z, GLfloat w)
-{
- GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr4fNV(attr, x, y, z, w);
-}
-
-static void GLAPIENTRY
-save_MultiTexCoord4fv(GLenum target, const GLfloat * v)
-{
- GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr4fNV(attr, v[0], v[1], v[2], v[3]);
-}
-
-
-/**
- * Record a GL_INVALID_VALUE error when a invalid vertex attribute
- * index is found.
- */
-static void
-index_error(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)");
-}
-
-
-/* First level for NV_vertex_program:
- *
- * Check for errors at compile time?.
- */
-static void GLAPIENTRY
-save_VertexAttrib1fNV(GLuint index, GLfloat x)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr1fNV(index, x);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib1fvNV(GLuint index, const GLfloat * v)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr1fNV(index, v[0]);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr2fNV(index, x, y);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib2fvNV(GLuint index, const GLfloat * v)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr2fNV(index, v[0], v[1]);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr3fNV(index, x, y, z);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib3fvNV(GLuint index, const GLfloat * v)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr3fNV(index, v[0], v[1], v[2]);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y,
- GLfloat z, GLfloat w)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr4fNV(index, x, y, z, w);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib4fvNV(GLuint index, const GLfloat * v)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr4fNV(index, v[0], v[1], v[2], v[3]);
- else
- index_error();
-}
-
-
-
-
-static void GLAPIENTRY
-save_VertexAttrib1fARB(GLuint index, GLfloat x)
-{
- if (index < MAX_VERTEX_GENERIC_ATTRIBS)
- save_Attr1fARB(index, x);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
-{
- if (index < MAX_VERTEX_GENERIC_ATTRIBS)
- save_Attr1fARB(index, v[0]);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
-{
- if (index < MAX_VERTEX_GENERIC_ATTRIBS)
- save_Attr2fARB(index, x, y);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
-{
- if (index < MAX_VERTEX_GENERIC_ATTRIBS)
- save_Attr2fARB(index, v[0], v[1]);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- if (index < MAX_VERTEX_GENERIC_ATTRIBS)
- save_Attr3fARB(index, x, y, z);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
-{
- if (index < MAX_VERTEX_GENERIC_ATTRIBS)
- save_Attr3fARB(index, v[0], v[1], v[2]);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
- GLfloat w)
-{
- if (index < MAX_VERTEX_GENERIC_ATTRIBS)
- save_Attr4fARB(index, x, y, z, w);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
-{
- if (index < MAX_VERTEX_GENERIC_ATTRIBS)
- save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
- else
- index_error();
-}
-
-
-/* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
-
-static void GLAPIENTRY
-exec_BindAttribLocationARB(GLuint program, GLuint index, const GLchar *name)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_BindAttribLocationARB(ctx->Exec, (program, index, name));
-}
-
-static GLint GLAPIENTRY
-exec_GetAttribLocationARB(GLuint program, const GLchar *name)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_GetAttribLocationARB(ctx->Exec, (program, name));
-}
-
-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
-static void GLAPIENTRY
-save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
- GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, GLenum filter)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
- if (n) {
- n[1].i = srcX0;
- n[2].i = srcY0;
- n[3].i = srcX1;
- n[4].i = srcY1;
- n[5].i = dstX0;
- n[6].i = dstY0;
- n[7].i = dstX1;
- n[8].i = dstY1;
- n[9].i = mask;
- n[10].e = filter;
- }
- if (ctx->ExecuteFlag) {
- CALL_BlitFramebufferEXT(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
- dstX0, dstY0, dstX1, dstY1,
- mask, filter));
- }
-}
-#endif
-
-
-/** GL_EXT_provoking_vertex */
-static void GLAPIENTRY
-save_ProvokingVertexEXT(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
- if (n) {
- n[1].e = mode;
- }
- if (ctx->ExecuteFlag) {
- /*CALL_ProvokingVertexEXT(ctx->Exec, (mode));*/
- _mesa_ProvokingVertexEXT(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)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
- if (n) {
- n[1].ui = program;
- }
- if (ctx->ExecuteFlag) {
- CALL_UseProgramObjectARB(ctx->Exec, (program));
- }
-}
-
-
-static void GLAPIENTRY
-save_Uniform1fARB(GLint location, GLfloat x)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
- if (n) {
- n[1].i = location;
- n[2].f = x;
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform1fARB(ctx->Exec, (location, x));
- }
-}
-
-
-static void GLAPIENTRY
-save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
- if (n) {
- n[1].i = location;
- n[2].f = x;
- n[3].f = y;
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform2fARB(ctx->Exec, (location, x, y));
- }
-}
-
-
-static void GLAPIENTRY
-save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
- if (n) {
- n[1].i = location;
- n[2].f = x;
- n[3].f = y;
- n[4].f = z;
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform3fARB(ctx->Exec, (location, x, y, z));
- }
-}
-
-
-static void GLAPIENTRY
-save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
- if (n) {
- n[1].i = location;
- n[2].f = x;
- n[3].f = y;
- n[4].f = z;
- n[5].f = w;
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform4fARB(ctx->Exec, (location, x, y, z, w));
- }
-}
-
-
-/** Return copy of memory */
-static void *
-memdup(const void *src, GLsizei bytes)
-{
- void *b = bytes >= 0 ? malloc(bytes) : NULL;
- if (b)
- memcpy(b, src, bytes);
- return b;
-}
-
-
-static void GLAPIENTRY
-save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 3);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].data = memdup(v, count * 1 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform1fvARB(ctx->Exec, (location, count, v));
- }
-}
-
-static void GLAPIENTRY
-save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 3);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].data = memdup(v, count * 2 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform2fvARB(ctx->Exec, (location, count, v));
- }
-}
-
-static void GLAPIENTRY
-save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 3);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].data = memdup(v, count * 3 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform3fvARB(ctx->Exec, (location, count, v));
- }
-}
-
-static void GLAPIENTRY
-save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 3);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform4fvARB(ctx->Exec, (location, count, v));
- }
-}
-
-
-static void GLAPIENTRY
-save_Uniform1iARB(GLint location, GLint x)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
- if (n) {
- n[1].i = location;
- n[2].i = x;
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform1iARB(ctx->Exec, (location, x));
- }
-}
-
-static void GLAPIENTRY
-save_Uniform2iARB(GLint location, GLint x, GLint y)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
- if (n) {
- n[1].i = location;
- n[2].i = x;
- n[3].i = y;
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform2iARB(ctx->Exec, (location, x, y));
- }
-}
-
-static void GLAPIENTRY
-save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
- if (n) {
- n[1].i = location;
- n[2].i = x;
- n[3].i = y;
- n[4].i = z;
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform3iARB(ctx->Exec, (location, x, y, z));
- }
-}
-
-static void GLAPIENTRY
-save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 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_Uniform4iARB(ctx->Exec, (location, x, y, z, w));
- }
-}
-
-
-
-static void GLAPIENTRY
-save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 3);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].data = memdup(v, count * 1 * sizeof(GLint));
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform1ivARB(ctx->Exec, (location, count, v));
- }
-}
-
-static void GLAPIENTRY
-save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 3);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].data = memdup(v, count * 2 * sizeof(GLint));
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform2ivARB(ctx->Exec, (location, count, v));
- }
-}
-
-static void GLAPIENTRY
-save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 3);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].data = memdup(v, count * 3 * sizeof(GLint));
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform3ivARB(ctx->Exec, (location, count, v));
- }
-}
-
-static void GLAPIENTRY
-save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 3);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_Uniform4ivARB(ctx->Exec, (location, count, 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)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 4);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].b = transpose;
- n[4].data = memdup(m, count * 2 * 2 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_UniformMatrix2fvARB(ctx->Exec, (location, count, transpose, m));
- }
-}
-
-static void GLAPIENTRY
-save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *m)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 4);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].b = transpose;
- n[4].data = memdup(m, count * 3 * 3 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_UniformMatrix3fvARB(ctx->Exec, (location, count, transpose, m));
- }
-}
-
-static void GLAPIENTRY
-save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *m)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 4);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].b = transpose;
- n[4].data = memdup(m, count * 4 * 4 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_UniformMatrix4fvARB(ctx->Exec, (location, count, transpose, m));
- }
-}
-
-
-static void GLAPIENTRY
-save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *m)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 4);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].b = transpose;
- n[4].data = memdup(m, count * 2 * 3 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
- }
-}
-
-static void GLAPIENTRY
-save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *m)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 4);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].b = transpose;
- n[4].data = memdup(m, count * 3 * 2 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
- }
-}
-
-
-static void GLAPIENTRY
-save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *m)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 4);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].b = transpose;
- n[4].data = memdup(m, count * 2 * 4 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
- }
-}
-
-static void GLAPIENTRY
-save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *m)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 4);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].b = transpose;
- n[4].data = memdup(m, count * 4 * 2 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
- }
-}
-
-
-static void GLAPIENTRY
-save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *m)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 4);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].b = transpose;
- n[4].data = memdup(m, count * 3 * 4 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
- }
-}
-
-static void GLAPIENTRY
-save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *m)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 4);
- if (n) {
- n[1].i = location;
- n[2].i = count;
- n[3].b = transpose;
- n[4].data = memdup(m, count * 4 * 3 * sizeof(GLfloat));
- }
- if (ctx->ExecuteFlag) {
- CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
- }
-}
-
-static void GLAPIENTRY
-save_UseShaderProgramEXT(GLenum type, GLuint program)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_USE_SHADER_PROGRAM_EXT, 2);
- if (n) {
- n[1].ui = type;
- n[2].ui = program;
- }
- if (ctx->ExecuteFlag) {
- CALL_UseShaderProgramEXT(ctx->Exec, (type, program));
- }
-}
-
-static void GLAPIENTRY
-save_ActiveProgramEXT(GLuint program)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_ACTIVE_PROGRAM_EXT, 1);
- if (n) {
- n[1].ui = program;
- }
- if (ctx->ExecuteFlag) {
- CALL_ActiveProgramEXT(ctx->Exec, (program));
- }
-}
-
-/** GL_EXT_texture_integer */
-static void GLAPIENTRY
-save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
- if (n) {
- n[1].i = red;
- n[2].i = green;
- n[3].i = blue;
- n[4].i = alpha;
- }
- if (ctx->ExecuteFlag) {
- CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
- }
-}
-
-/** GL_EXT_texture_integer */
-static void GLAPIENTRY
-save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
- if (n) {
- n[1].ui = red;
- n[2].ui = green;
- n[3].ui = blue;
- n[4].ui = alpha;
- }
- if (ctx->ExecuteFlag) {
- CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
- }
-}
-
-/** GL_EXT_texture_integer */
-static void GLAPIENTRY
-save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].i = params[0];
- n[4].i = params[1];
- n[5].i = params[2];
- n[6].i = params[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_TexParameterIivEXT(ctx->Exec, (target, pname, params));
- }
-}
-
-/** GL_EXT_texture_integer */
-static void GLAPIENTRY
-save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].ui = params[0];
- n[4].ui = params[1];
- n[5].ui = params[2];
- n[6].ui = params[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_TexParameterIuivEXT(ctx->Exec, (target, pname, params));
- }
-}
-
-/** GL_EXT_texture_integer */
-static void GLAPIENTRY
-exec_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexParameterIivEXT(ctx->Exec, (target, pname, params));
-}
-
-/** GL_EXT_texture_integer */
-static void GLAPIENTRY
-exec_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexParameterIuivEXT(ctx->Exec, (target, pname, params));
-}
-
-
-
-
-
-/**
- * Save an error-generating command into display list.
- *
- * KW: Will appear in the list before the vertex buffer containing the
- * command that provoked the error. I don't see this as a problem.
- */
-static void
-save_error(struct gl_context *ctx, GLenum error, const char *s)
-{
- Node *n;
- n = alloc_instruction(ctx, OPCODE_ERROR, 2);
- if (n) {
- n[1].e = error;
- n[2].data = (void *) s;
- }
-}
-
-
-/**
- * Compile an error into current display list.
- */
-void
-_mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
-{
- if (ctx->CompileFlag)
- save_error(ctx, error, s);
- if (ctx->ExecuteFlag)
- _mesa_error(ctx, error, "%s", s);
-}
-
-
-/**
- * Test if ID names a display list.
- */
-static GLboolean
-islist(struct gl_context *ctx, GLuint list)
-{
- if (list > 0 && lookup_list(ctx, list)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-
-
-/**********************************************************************/
-/* Display list execution */
-/**********************************************************************/
-
-
-/*
- * Execute a display list. Note that the ListBase offset must have already
- * been added before calling this function. I.e. the list argument is
- * the absolute list number, not relative to ListBase.
- * \param list - display list number
- */
-static void
-execute_list(struct gl_context *ctx, GLuint list)
-{
- struct gl_display_list *dlist;
- Node *n;
- GLboolean done;
-
- if (list == 0 || !islist(ctx, list))
- return;
-
- if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
- /* raise an error? */
- return;
- }
-
- dlist = lookup_list(ctx, list);
- if (!dlist)
- return;
-
- ctx->ListState.CallDepth++;
-
- if (ctx->Driver.BeginCallList)
- ctx->Driver.BeginCallList(ctx, dlist);
-
- n = dlist->Head;
-
- done = GL_FALSE;
- while (!done) {
- const OpCode opcode = n[0].opcode;
-
- if (is_ext_opcode(opcode)) {
- n += ext_opcode_execute(ctx, n);
- }
- else {
- switch (opcode) {
- case OPCODE_ERROR:
- _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));
- break;
- case OPCODE_ALPHA_FUNC:
- CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
- break;
- case OPCODE_BIND_TEXTURE:
- CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
- break;
- case OPCODE_BITMAP:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
- n[3].f, n[4].f, n[5].f, n[6].f,
- (const GLubyte *) n[7].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_BLEND_COLOR:
- CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
- break;
- case OPCODE_BLEND_EQUATION:
- CALL_BlendEquation(ctx->Exec, (n[1].e));
- break;
- case OPCODE_BLEND_EQUATION_SEPARATE:
- CALL_BlendEquationSeparateEXT(ctx->Exec, (n[1].e, n[2].e));
- break;
- case OPCODE_BLEND_FUNC_SEPARATE:
- CALL_BlendFuncSeparateEXT(ctx->Exec,
- (n[1].e, n[2].e, n[3].e, n[4].e));
- break;
- case OPCODE_CALL_LIST:
- /* Generated by glCallList(), don't add ListBase */
- if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
- execute_list(ctx, n[1].ui);
- }
- break;
- case OPCODE_CALL_LIST_OFFSET:
- /* Generated by glCallLists() so we must add ListBase */
- if (n[2].b) {
- /* user specified a bad data type at compile time */
- _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
- }
- else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
- GLuint list = (GLuint) (ctx->List.ListBase + n[1].i);
- execute_list(ctx, list);
- }
- break;
- case OPCODE_CLEAR:
- CALL_Clear(ctx->Exec, (n[1].bf));
- break;
- case OPCODE_CLEAR_BUFFER_IV:
- {
- GLint value[4];
- value[0] = n[3].i;
- value[1] = n[4].i;
- value[2] = n[5].i;
- value[3] = n[6].i;
- /*CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));*/
- }
- break;
- case OPCODE_CLEAR_BUFFER_UIV:
- {
- GLuint value[4];
- value[0] = n[3].ui;
- value[1] = n[4].ui;
- value[2] = n[5].ui;
- value[3] = n[6].ui;
- /*CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));*/
- }
- break;
- case OPCODE_CLEAR_BUFFER_FV:
- {
- GLfloat value[4];
- value[0] = n[3].f;
- value[1] = n[4].f;
- value[2] = n[5].f;
- value[3] = n[6].f;
- /*CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));*/
- }
- break;
- case OPCODE_CLEAR_BUFFER_FI:
- /*CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));*/
- break;
- case OPCODE_CLEAR_COLOR:
- CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
- break;
- case OPCODE_CLEAR_ACCUM:
- CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
- break;
- case OPCODE_CLEAR_DEPTH:
- CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
- break;
- case OPCODE_CLEAR_INDEX:
- CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
- break;
- case OPCODE_CLEAR_STENCIL:
- CALL_ClearStencil(ctx->Exec, (n[1].i));
- break;
- case OPCODE_CLIP_PLANE:
- {
- GLdouble eq[4];
- eq[0] = n[2].f;
- eq[1] = n[3].f;
- eq[2] = n[4].f;
- eq[3] = n[5].f;
- CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
- }
- break;
- case OPCODE_COLOR_MASK:
- CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
- break;
- case OPCODE_COLOR_MASK_INDEXED:
- CALL_ColorMaskIndexedEXT(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
- n[4].b, n[5].b));
- break;
- case OPCODE_COLOR_MATERIAL:
- CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
- break;
- case OPCODE_COLOR_TABLE:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_ColorTable(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].e,
- n[5].e, n[6].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_COLOR_TABLE_PARAMETER_FV:
- {
- GLfloat params[4];
- params[0] = n[3].f;
- params[1] = n[4].f;
- params[2] = n[5].f;
- params[3] = n[6].f;
- CALL_ColorTableParameterfv(ctx->Exec,
- (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_COLOR_TABLE_PARAMETER_IV:
- {
- GLint params[4];
- params[0] = n[3].i;
- params[1] = n[4].i;
- params[2] = n[5].i;
- params[3] = n[6].i;
- CALL_ColorTableParameteriv(ctx->Exec,
- (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_COLOR_SUB_TABLE:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_ColorSubTable(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].e, n[5].e, n[6].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_CONVOLUTION_FILTER_1D:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_ConvolutionFilter1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].e, n[5].e,
- n[6].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_CONVOLUTION_FILTER_2D:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_ConvolutionFilter2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].i, n[5].e, n[6].e,
- n[7].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_CONVOLUTION_PARAMETER_I:
- CALL_ConvolutionParameteri(ctx->Exec, (n[1].e, n[2].e, n[3].i));
- break;
- case OPCODE_CONVOLUTION_PARAMETER_IV:
- {
- GLint params[4];
- params[0] = n[3].i;
- params[1] = n[4].i;
- params[2] = n[5].i;
- params[3] = n[6].i;
- CALL_ConvolutionParameteriv(ctx->Exec,
- (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_CONVOLUTION_PARAMETER_F:
- CALL_ConvolutionParameterf(ctx->Exec, (n[1].e, n[2].e, n[3].f));
- break;
- case OPCODE_CONVOLUTION_PARAMETER_FV:
- {
- GLfloat params[4];
- params[0] = n[3].f;
- params[1] = n[4].f;
- params[2] = n[5].f;
- params[3] = n[6].f;
- CALL_ConvolutionParameterfv(ctx->Exec,
- (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_COPY_COLOR_SUB_TABLE:
- CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
- n[3].i, n[4].i, n[5].i));
- break;
- case OPCODE_COPY_COLOR_TABLE:
- CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
- n[3].i, n[4].i, n[5].i));
- break;
- case OPCODE_COPY_PIXELS:
- CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
- (GLsizei) n[3].i, (GLsizei) n[4].i,
- n[5].e));
- break;
- case OPCODE_COPY_TEX_IMAGE1D:
- CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
- n[5].i, n[6].i, n[7].i));
- break;
- case OPCODE_COPY_TEX_IMAGE2D:
- CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
- n[5].i, n[6].i, n[7].i, n[8].i));
- break;
- case OPCODE_COPY_TEX_SUB_IMAGE1D:
- CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].i, n[5].i, n[6].i));
- break;
- case OPCODE_COPY_TEX_SUB_IMAGE2D:
- CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].i, n[5].i, n[6].i, n[7].i,
- n[8].i));
- break;
- case OPCODE_COPY_TEX_SUB_IMAGE3D:
- CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].i, n[5].i, n[6].i, n[7].i,
- n[8].i, n[9].i));
- break;
- case OPCODE_CULL_FACE:
- CALL_CullFace(ctx->Exec, (n[1].e));
- break;
- case OPCODE_DEPTH_FUNC:
- CALL_DepthFunc(ctx->Exec, (n[1].e));
- break;
- case OPCODE_DEPTH_MASK:
- CALL_DepthMask(ctx->Exec, (n[1].b));
- break;
- case OPCODE_DEPTH_RANGE:
- CALL_DepthRange(ctx->Exec,
- ((GLclampd) n[1].f, (GLclampd) n[2].f));
- break;
- case OPCODE_DISABLE:
- CALL_Disable(ctx->Exec, (n[1].e));
- break;
- case OPCODE_DISABLE_INDEXED:
- CALL_DisableIndexedEXT(ctx->Exec, (n[1].ui, n[2].e));
- break;
- case OPCODE_DRAW_BUFFER:
- CALL_DrawBuffer(ctx->Exec, (n[1].e));
- break;
- case OPCODE_DRAW_PIXELS:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
- n[5].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_ENABLE:
- CALL_Enable(ctx->Exec, (n[1].e));
- break;
- case OPCODE_ENABLE_INDEXED:
- CALL_EnableIndexedEXT(ctx->Exec, (n[1].ui, n[2].e));
- break;
- case OPCODE_EVALMESH1:
- CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
- break;
- case OPCODE_EVALMESH2:
- CALL_EvalMesh2(ctx->Exec,
- (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
- break;
- case OPCODE_FOG:
- {
- GLfloat p[4];
- p[0] = n[2].f;
- p[1] = n[3].f;
- p[2] = n[4].f;
- p[3] = n[5].f;
- CALL_Fogfv(ctx->Exec, (n[1].e, p));
- }
- break;
- case OPCODE_FRONT_FACE:
- CALL_FrontFace(ctx->Exec, (n[1].e));
- break;
- case OPCODE_FRUSTUM:
- CALL_Frustum(ctx->Exec,
- (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
- break;
- case OPCODE_HINT:
- CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
- break;
- case OPCODE_HISTOGRAM:
- CALL_Histogram(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].b));
- break;
- case OPCODE_INDEX_MASK:
- CALL_IndexMask(ctx->Exec, (n[1].ui));
- break;
- case OPCODE_INIT_NAMES:
- CALL_InitNames(ctx->Exec, ());
- break;
- case OPCODE_LIGHT:
- {
- GLfloat p[4];
- p[0] = n[3].f;
- p[1] = n[4].f;
- p[2] = n[5].f;
- p[3] = n[6].f;
- CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
- }
- break;
- case OPCODE_LIGHT_MODEL:
- {
- GLfloat p[4];
- p[0] = n[2].f;
- p[1] = n[3].f;
- p[2] = n[4].f;
- p[3] = n[5].f;
- CALL_LightModelfv(ctx->Exec, (n[1].e, p));
- }
- break;
- case OPCODE_LINE_STIPPLE:
- CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
- break;
- case OPCODE_LINE_WIDTH:
- CALL_LineWidth(ctx->Exec, (n[1].f));
- break;
- case OPCODE_LIST_BASE:
- CALL_ListBase(ctx->Exec, (n[1].ui));
- break;
- case OPCODE_LOAD_IDENTITY:
- CALL_LoadIdentity(ctx->Exec, ());
- break;
- case OPCODE_LOAD_MATRIX:
- if (sizeof(Node) == sizeof(GLfloat)) {
- CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
- }
- else {
- GLfloat m[16];
- GLuint i;
- for (i = 0; i < 16; i++) {
- m[i] = n[1 + i].f;
- }
- CALL_LoadMatrixf(ctx->Exec, (m));
- }
- break;
- case OPCODE_LOAD_NAME:
- CALL_LoadName(ctx->Exec, (n[1].ui));
- break;
- case OPCODE_LOGIC_OP:
- CALL_LogicOp(ctx->Exec, (n[1].e));
- break;
- case OPCODE_MAP1:
- {
- GLenum target = n[1].e;
- GLint ustride = _mesa_evaluator_components(target);
- GLint uorder = n[5].i;
- GLfloat u1 = n[2].f;
- GLfloat u2 = n[3].f;
- CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
- (GLfloat *) n[6].data));
- }
- break;
- case OPCODE_MAP2:
- {
- GLenum target = n[1].e;
- GLfloat u1 = n[2].f;
- GLfloat u2 = n[3].f;
- GLfloat v1 = n[4].f;
- GLfloat v2 = n[5].f;
- GLint ustride = n[6].i;
- GLint vstride = n[7].i;
- GLint uorder = n[8].i;
- GLint vorder = n[9].i;
- CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
- v1, v2, vstride, vorder,
- (GLfloat *) n[10].data));
- }
- break;
- case OPCODE_MAPGRID1:
- CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
- break;
- case OPCODE_MAPGRID2:
- CALL_MapGrid2f(ctx->Exec,
- (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
- break;
- case OPCODE_MATRIX_MODE:
- CALL_MatrixMode(ctx->Exec, (n[1].e));
- break;
- case OPCODE_MIN_MAX:
- CALL_Minmax(ctx->Exec, (n[1].e, n[2].e, n[3].b));
- break;
- case OPCODE_MULT_MATRIX:
- if (sizeof(Node) == sizeof(GLfloat)) {
- CALL_MultMatrixf(ctx->Exec, (&n[1].f));
- }
- else {
- GLfloat m[16];
- GLuint i;
- for (i = 0; i < 16; i++) {
- m[i] = n[1 + i].f;
- }
- CALL_MultMatrixf(ctx->Exec, (m));
- }
- break;
- case OPCODE_ORTHO:
- CALL_Ortho(ctx->Exec,
- (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
- break;
- case OPCODE_PASSTHROUGH:
- CALL_PassThrough(ctx->Exec, (n[1].f));
- break;
- case OPCODE_PIXEL_MAP:
- CALL_PixelMapfv(ctx->Exec,
- (n[1].e, n[2].i, (GLfloat *) n[3].data));
- break;
- case OPCODE_PIXEL_TRANSFER:
- CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
- break;
- case OPCODE_PIXEL_ZOOM:
- CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
- break;
- case OPCODE_POINT_SIZE:
- CALL_PointSize(ctx->Exec, (n[1].f));
- break;
- case OPCODE_POINT_PARAMETERS:
- {
- GLfloat params[3];
- params[0] = n[2].f;
- params[1] = n[3].f;
- params[2] = n[4].f;
- CALL_PointParameterfvEXT(ctx->Exec, (n[1].e, params));
- }
- break;
- case OPCODE_POLYGON_MODE:
- CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
- break;
- case OPCODE_POLYGON_STIPPLE:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_POLYGON_OFFSET:
- CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
- break;
- case OPCODE_POP_ATTRIB:
- CALL_PopAttrib(ctx->Exec, ());
- break;
- case OPCODE_POP_MATRIX:
- CALL_PopMatrix(ctx->Exec, ());
- break;
- case OPCODE_POP_NAME:
- CALL_PopName(ctx->Exec, ());
- break;
- case OPCODE_PRIORITIZE_TEXTURE:
- CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
- break;
- case OPCODE_PUSH_ATTRIB:
- CALL_PushAttrib(ctx->Exec, (n[1].bf));
- break;
- case OPCODE_PUSH_MATRIX:
- CALL_PushMatrix(ctx->Exec, ());
- break;
- case OPCODE_PUSH_NAME:
- CALL_PushName(ctx->Exec, (n[1].ui));
- break;
- case OPCODE_RASTER_POS:
- CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
- break;
- case OPCODE_READ_BUFFER:
- CALL_ReadBuffer(ctx->Exec, (n[1].e));
- break;
- case OPCODE_RESET_HISTOGRAM:
- CALL_ResetHistogram(ctx->Exec, (n[1].e));
- break;
- case OPCODE_RESET_MIN_MAX:
- CALL_ResetMinmax(ctx->Exec, (n[1].e));
- break;
- case OPCODE_ROTATE:
- CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
- break;
- case OPCODE_SCALE:
- CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
- break;
- case OPCODE_SCISSOR:
- CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
- break;
- case OPCODE_SHADE_MODEL:
- CALL_ShadeModel(ctx->Exec, (n[1].e));
- break;
- 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;
- case OPCODE_STENCIL_MASK:
- CALL_StencilMask(ctx->Exec, (n[1].ui));
- break;
- case OPCODE_STENCIL_OP:
- CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
- break;
- case OPCODE_STENCIL_FUNC_SEPARATE:
- CALL_StencilFuncSeparate(ctx->Exec,
- (n[1].e, n[2].e, n[3].i, n[4].ui));
- break;
- case OPCODE_STENCIL_MASK_SEPARATE:
- CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
- break;
- case OPCODE_STENCIL_OP_SEPARATE:
- CALL_StencilOpSeparate(ctx->Exec,
- (n[1].e, n[2].e, n[3].e, n[4].e));
- break;
- case OPCODE_TEXENV:
- {
- GLfloat params[4];
- params[0] = n[3].f;
- params[1] = n[4].f;
- params[2] = n[5].f;
- params[3] = n[6].f;
- CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_TEXGEN:
- {
- GLfloat params[4];
- params[0] = n[3].f;
- params[1] = n[4].f;
- params[2] = n[5].f;
- params[3] = n[6].f;
- CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_TEXPARAMETER:
- {
- GLfloat params[4];
- params[0] = n[3].f;
- params[1] = n[4].f;
- params[2] = n[5].f;
- params[3] = n[6].f;
- CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_TEX_IMAGE1D:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
- n[2].i, /* level */
- n[3].i, /* components */
- n[4].i, /* width */
- n[5].e, /* border */
- n[6].e, /* format */
- n[7].e, /* type */
- n[8].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_TEX_IMAGE2D:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
- n[2].i, /* level */
- n[3].i, /* components */
- n[4].i, /* width */
- n[5].i, /* height */
- n[6].e, /* border */
- n[7].e, /* format */
- n[8].e, /* type */
- n[9].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_TEX_IMAGE3D:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
- n[2].i, /* level */
- n[3].i, /* components */
- n[4].i, /* width */
- n[5].i, /* height */
- n[6].i, /* depth */
- n[7].e, /* border */
- n[8].e, /* format */
- n[9].e, /* type */
- n[10].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_TEX_SUB_IMAGE1D:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].i, n[5].e,
- n[6].e, n[7].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_TEX_SUB_IMAGE2D:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].i, n[5].e,
- n[6].i, n[7].e, n[8].e,
- n[9].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_TEX_SUB_IMAGE3D:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].i, n[5].i, n[6].i, n[7].i,
- n[8].i, n[9].e, n[10].e,
- n[11].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_TRANSLATE:
- CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
- break;
- case OPCODE_VIEWPORT:
- CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
- (GLsizei) n[3].i, (GLsizei) n[4].i));
- break;
- case OPCODE_WINDOW_POS:
- CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
- break;
- case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
- CALL_ActiveTextureARB(ctx->Exec, (n[1].e));
- break;
- case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
- CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
- n[4].i, n[5].i, n[6].i,
- n[7].data));
- break;
- case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
- CALL_CompressedTexImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
- n[4].i, n[5].i, n[6].i,
- n[7].i, n[8].data));
- break;
- case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
- CALL_CompressedTexImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
- n[4].i, n[5].i, n[6].i,
- n[7].i, n[8].i,
- n[9].data));
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
- CALL_CompressedTexSubImage1DARB(ctx->Exec,
- (n[1].e, n[2].i, n[3].i, n[4].i,
- n[5].e, n[6].i, n[7].data));
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
- CALL_CompressedTexSubImage2DARB(ctx->Exec,
- (n[1].e, n[2].i, n[3].i, n[4].i,
- n[5].i, n[6].i, n[7].e, n[8].i,
- n[9].data));
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
- CALL_CompressedTexSubImage3DARB(ctx->Exec,
- (n[1].e, n[2].i, n[3].i, n[4].i,
- n[5].i, n[6].i, n[7].i, n[8].i,
- n[9].e, n[10].i, n[11].data));
- break;
- case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
- CALL_SampleCoverageARB(ctx->Exec, (n[1].f, n[2].b));
- break;
- case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
- CALL_WindowPos3fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f));
- break;
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
- case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */
- CALL_BindProgramNV(ctx->Exec, (n[1].e, n[2].ui));
- break;
-#endif
-#if FEATURE_NV_vertex_program
- case OPCODE_EXECUTE_PROGRAM_NV:
- {
- GLfloat v[4];
- v[0] = n[3].f;
- v[1] = n[4].f;
- v[2] = n[5].f;
- v[3] = n[6].f;
- CALL_ExecuteProgramNV(ctx->Exec, (n[1].e, n[2].ui, v));
- }
- break;
- case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
- CALL_RequestResidentProgramsNV(ctx->Exec, (n[1].ui,
- (GLuint *) n[2].data));
- break;
- case OPCODE_LOAD_PROGRAM_NV:
- CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i,
- (const GLubyte *) n[4].data));
- break;
- case OPCODE_TRACK_MATRIX_NV:
- CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e));
- break;
-#endif
-
-#if FEATURE_NV_fragment_program
- case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
- CALL_ProgramLocalParameter4fARB(ctx->Exec,
- (n[1].e, n[2].ui, n[3].f, n[4].f,
- n[5].f, n[6].f));
- break;
- case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
- CALL_ProgramNamedParameter4fNV(ctx->Exec, (n[1].ui, n[2].i,
- (const GLubyte *) n[3].
- data, n[4].f, n[5].f,
- n[6].f, n[7].f));
- break;
-#endif
-
- case OPCODE_ACTIVE_STENCIL_FACE_EXT:
- CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
- break;
- case OPCODE_DEPTH_BOUNDS_EXT:
- CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
- break;
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
- case OPCODE_PROGRAM_STRING_ARB:
- CALL_ProgramStringARB(ctx->Exec,
- (n[1].e, n[2].e, n[3].i, n[4].data));
- break;
-#endif
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
- case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
- CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
- n[4].f, n[5].f,
- n[6].f));
- break;
-#endif
-#if FEATURE_queryobj
- case OPCODE_BEGIN_QUERY_ARB:
- CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui));
- break;
- case OPCODE_END_QUERY_ARB:
- CALL_EndQueryARB(ctx->Exec, (n[1].e));
- break;
-#endif
- case OPCODE_DRAW_BUFFERS_ARB:
- {
- GLenum buffers[MAX_DRAW_BUFFERS];
- GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
- for (i = 0; i < count; i++)
- buffers[i] = n[2 + i].e;
- CALL_DrawBuffersARB(ctx->Exec, (n[1].i, buffers));
- }
- break;
-#if FEATURE_EXT_framebuffer_blit
- case OPCODE_BLIT_FRAMEBUFFER:
- CALL_BlitFramebufferEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
- n[5].i, n[6].i, n[7].i, n[8].i,
- n[9].i, n[10].e));
- break;
-#endif
-
- case OPCODE_USE_PROGRAM:
- CALL_UseProgramObjectARB(ctx->Exec, (n[1].ui));
- break;
- case OPCODE_USE_SHADER_PROGRAM_EXT:
- CALL_UseShaderProgramEXT(ctx->Exec, (n[1].ui, n[2].ui));
- break;
- case OPCODE_ACTIVE_PROGRAM_EXT:
- CALL_ActiveProgramEXT(ctx->Exec, (n[1].ui));
- break;
- case OPCODE_UNIFORM_1F:
- CALL_Uniform1fARB(ctx->Exec, (n[1].i, n[2].f));
- break;
- case OPCODE_UNIFORM_2F:
- CALL_Uniform2fARB(ctx->Exec, (n[1].i, n[2].f, n[3].f));
- break;
- case OPCODE_UNIFORM_3F:
- CALL_Uniform3fARB(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
- break;
- case OPCODE_UNIFORM_4F:
- CALL_Uniform4fARB(ctx->Exec,
- (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
- break;
- case OPCODE_UNIFORM_1FV:
- CALL_Uniform1fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
- break;
- case OPCODE_UNIFORM_2FV:
- CALL_Uniform2fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
- break;
- case OPCODE_UNIFORM_3FV:
- CALL_Uniform3fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
- break;
- case OPCODE_UNIFORM_4FV:
- CALL_Uniform4fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
- break;
- case OPCODE_UNIFORM_1I:
- CALL_Uniform1iARB(ctx->Exec, (n[1].i, n[2].i));
- break;
- case OPCODE_UNIFORM_2I:
- CALL_Uniform2iARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));
- break;
- case OPCODE_UNIFORM_3I:
- CALL_Uniform3iARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
- break;
- case OPCODE_UNIFORM_4I:
- CALL_Uniform4iARB(ctx->Exec,
- (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
- break;
- case OPCODE_UNIFORM_1IV:
- CALL_Uniform1ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
- break;
- case OPCODE_UNIFORM_2IV:
- CALL_Uniform2ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
- break;
- case OPCODE_UNIFORM_3IV:
- CALL_Uniform3ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
- break;
- 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));
- break;
- case OPCODE_UNIFORM_MATRIX33:
- CALL_UniformMatrix3fvARB(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
- break;
- case OPCODE_UNIFORM_MATRIX44:
- CALL_UniformMatrix4fvARB(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
- break;
- case OPCODE_UNIFORM_MATRIX23:
- CALL_UniformMatrix2x3fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
- break;
- case OPCODE_UNIFORM_MATRIX32:
- CALL_UniformMatrix3x2fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
- break;
- case OPCODE_UNIFORM_MATRIX24:
- CALL_UniformMatrix2x4fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
- break;
- case OPCODE_UNIFORM_MATRIX42:
- CALL_UniformMatrix4x2fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
- break;
- case OPCODE_UNIFORM_MATRIX34:
- CALL_UniformMatrix3x4fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
- break;
- case OPCODE_UNIFORM_MATRIX43:
- CALL_UniformMatrix4x3fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
- break;
-
- case OPCODE_TEX_BUMP_PARAMETER_ATI:
- {
- GLfloat values[4];
- GLuint i, pname = n[1].ui;
-
- for (i = 0; i < 4; i++)
- values[i] = n[1 + i].f;
- CALL_TexBumpParameterfvATI(ctx->Exec, (pname, values));
- }
- break;
-#if FEATURE_ATI_fragment_shader
- case OPCODE_BIND_FRAGMENT_SHADER_ATI:
- CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
- break;
- case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
- {
- GLfloat values[4];
- GLuint i, dst = n[1].ui;
-
- for (i = 0; i < 4; i++)
- values[i] = n[1 + i].f;
- CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, values));
- }
- break;
-#endif
- case OPCODE_ATTR_1F_NV:
- CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
- break;
- case OPCODE_ATTR_2F_NV:
- /* Really shouldn't have to do this - the Node structure
- * is convenient, but it would be better to store the data
- * packed appropriately so that it can be sent directly
- * on. With x86_64 becoming common, this will start to
- * matter more.
- */
- if (sizeof(Node) == sizeof(GLfloat))
- CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
- else
- CALL_VertexAttrib2fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f));
- break;
- case OPCODE_ATTR_3F_NV:
- if (sizeof(Node) == sizeof(GLfloat))
- CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
- else
- CALL_VertexAttrib3fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
- n[4].f));
- break;
- case OPCODE_ATTR_4F_NV:
- if (sizeof(Node) == sizeof(GLfloat))
- CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
- else
- CALL_VertexAttrib4fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
- n[4].f, n[5].f));
- break;
- case OPCODE_ATTR_1F_ARB:
- CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
- break;
- case OPCODE_ATTR_2F_ARB:
- /* Really shouldn't have to do this - the Node structure
- * is convenient, but it would be better to store the data
- * packed appropriately so that it can be sent directly
- * on. With x86_64 becoming common, this will start to
- * matter more.
- */
- if (sizeof(Node) == sizeof(GLfloat))
- CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
- else
- CALL_VertexAttrib2fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f));
- break;
- case OPCODE_ATTR_3F_ARB:
- if (sizeof(Node) == sizeof(GLfloat))
- CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
- else
- CALL_VertexAttrib3fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
- n[4].f));
- break;
- case OPCODE_ATTR_4F_ARB:
- if (sizeof(Node) == sizeof(GLfloat))
- CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
- else
- CALL_VertexAttrib4fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
- n[4].f, n[5].f));
- break;
- case OPCODE_MATERIAL:
- if (sizeof(Node) == sizeof(GLfloat))
- CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
- else {
- GLfloat f[4];
- f[0] = n[3].f;
- f[1] = n[4].f;
- f[2] = n[5].f;
- f[3] = n[6].f;
- CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f));
- }
- break;
- case OPCODE_BEGIN:
- CALL_Begin(ctx->Exec, (n[1].e));
- break;
- case OPCODE_END:
- CALL_End(ctx->Exec, ());
- break;
- case OPCODE_RECTF:
- CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
- break;
- case OPCODE_EVAL_C1:
- CALL_EvalCoord1f(ctx->Exec, (n[1].f));
- break;
- case OPCODE_EVAL_C2:
- CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
- break;
- case OPCODE_EVAL_P1:
- CALL_EvalPoint1(ctx->Exec, (n[1].i));
- break;
- case OPCODE_EVAL_P2:
- CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
- break;
-
- /* GL_EXT_texture_integer */
- case OPCODE_CLEARCOLOR_I:
- CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
- break;
- case OPCODE_CLEARCOLOR_UI:
- CALL_ClearColorIuiEXT(ctx->Exec,
- (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
- break;
- case OPCODE_TEXPARAMETER_I:
- {
- GLint params[4];
- params[0] = n[3].i;
- params[1] = n[4].i;
- params[2] = n[5].i;
- params[3] = n[6].i;
- CALL_TexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_TEXPARAMETER_UI:
- {
- GLuint params[4];
- params[0] = n[3].ui;
- params[1] = n[4].ui;
- params[2] = n[5].ui;
- params[3] = n[6].ui;
- CALL_TexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, params));
- }
- break;
-
- case OPCODE_CONTINUE:
- n = (Node *) n[1].next;
- break;
- case OPCODE_END_OF_LIST:
- done = GL_TRUE;
- break;
- default:
- {
- char msg[1000];
- _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
- (int) opcode);
- _mesa_problem(ctx, "%s", msg);
- }
- done = GL_TRUE;
- }
-
- /* increment n to point to next compiled command */
- if (opcode != OPCODE_CONTINUE) {
- n += InstSize[opcode];
- }
- }
- }
-
- if (ctx->Driver.EndCallList)
- ctx->Driver.EndCallList(ctx);
-
- ctx->ListState.CallDepth--;
-}
-
-
-
-/**********************************************************************/
-/* GL functions */
-/**********************************************************************/
-
-/**
- * Test if a display list number is valid.
- */
-static GLboolean GLAPIENTRY
-_mesa_IsList(GLuint list)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0); /* must be called before assert */
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
- return islist(ctx, list);
-}
-
-
-/**
- * Delete a sequence of consecutive display lists.
- */
-static void GLAPIENTRY
-_mesa_DeleteLists(GLuint list, GLsizei range)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint i;
- FLUSH_VERTICES(ctx, 0); /* must be called before assert */
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (range < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
- return;
- }
- for (i = list; i < list + range; i++) {
- destroy_list(ctx, i);
- }
-}
-
-
-/**
- * Return a display list number, n, such that lists n through n+range-1
- * are free.
- */
-static GLuint GLAPIENTRY
-_mesa_GenLists(GLsizei range)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint base;
- FLUSH_VERTICES(ctx, 0); /* must be called before assert */
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
-
- if (range < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
- return 0;
- }
- if (range == 0) {
- return 0;
- }
-
- /*
- * Make this an atomic operation
- */
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
-
- base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
- if (base) {
- /* reserve the list IDs by with empty/dummy lists */
- GLint i;
- for (i = 0; i < range; i++) {
- _mesa_HashInsert(ctx->Shared->DisplayList, base + i,
- make_list(base + i, 1));
- }
- }
-
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-
- return base;
-}
-
-
-/**
- * Begin a new display list.
- */
-static void GLAPIENTRY
-_mesa_NewList(GLuint name, GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- FLUSH_CURRENT(ctx, 0); /* must be called before assert */
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glNewList %u %s\n", name,
- _mesa_lookup_enum_by_nr(mode));
-
- if (name == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
- return;
- }
-
- if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
- return;
- }
-
- if (ctx->ListState.CurrentList) {
- /* already compiling a display list */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
- return;
- }
-
- ctx->CompileFlag = GL_TRUE;
- ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
-
- /* Reset acumulated list state:
- */
- invalidate_saved_current_state( ctx );
-
- /* Allocate new display list */
- ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
- ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
- ctx->ListState.CurrentPos = 0;
-
- ctx->Driver.NewList(ctx, name, mode);
-
- ctx->CurrentDispatch = ctx->Save;
- _glapi_set_dispatch(ctx->CurrentDispatch);
-}
-
-
-/**
- * End definition of current display list.
- */
-static void GLAPIENTRY
-_mesa_EndList(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- SAVE_FLUSH_VERTICES(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glEndList\n");
-
- /* Check that a list is under construction */
- if (!ctx->ListState.CurrentList) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
- return;
- }
-
- /* Call before emitting END_OF_LIST, in case the driver wants to
- * emit opcodes itself.
- */
- ctx->Driver.EndList(ctx);
-
- (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
-
- /* Destroy old list, if any */
- destroy_list(ctx, ctx->ListState.CurrentList->Name);
-
- /* Install the new list */
- _mesa_HashInsert(ctx->Shared->DisplayList,
- ctx->ListState.CurrentList->Name,
- ctx->ListState.CurrentList);
-
-
- if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
- mesa_print_display_list(ctx->ListState.CurrentList->Name);
-
- ctx->ListState.CurrentList = NULL;
- ctx->ExecuteFlag = GL_TRUE;
- ctx->CompileFlag = GL_FALSE;
-
- ctx->CurrentDispatch = ctx->Exec;
- _glapi_set_dispatch(ctx->CurrentDispatch);
-}
-
-
-void GLAPIENTRY
-_mesa_CallList(GLuint list)
-{
- GLboolean save_compile_flag;
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_CURRENT(ctx, 0);
- /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
- /* execute the display list, and restore the CompileFlag. */
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glCallList %d\n", list);
-
- if (list == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
- return;
- }
-
-/* mesa_print_display_list( list ); */
-
- save_compile_flag = ctx->CompileFlag;
- if (save_compile_flag) {
- ctx->CompileFlag = GL_FALSE;
- }
-
- execute_list(ctx, list);
- ctx->CompileFlag = save_compile_flag;
-
- /* also restore API function pointers to point to "save" versions */
- if (save_compile_flag) {
- ctx->CurrentDispatch = ctx->Save;
- _glapi_set_dispatch(ctx->CurrentDispatch);
- }
-}
-
-
-/**
- * Execute glCallLists: call multiple display lists.
- */
-void GLAPIENTRY
-_mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
- GLboolean save_compile_flag;
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glCallLists %d\n", n);
-
- switch (type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- case GL_2_BYTES:
- case GL_3_BYTES:
- case GL_4_BYTES:
- /* OK */
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
- return;
- }
-
- /* Save the CompileFlag status, turn it off, execute display list,
- * and restore the CompileFlag.
- */
- save_compile_flag = ctx->CompileFlag;
- ctx->CompileFlag = GL_FALSE;
-
- for (i = 0; i < n; i++) {
- GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
- execute_list(ctx, list);
- }
-
- ctx->CompileFlag = save_compile_flag;
-
- /* also restore API function pointers to point to "save" versions */
- if (save_compile_flag) {
- ctx->CurrentDispatch = ctx->Save;
- _glapi_set_dispatch(ctx->CurrentDispatch);
- }
-}
-
-
-/**
- * Set the offset added to list numbers in glCallLists.
- */
-static void GLAPIENTRY
-_mesa_ListBase(GLuint base)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0); /* must be called before assert */
- ASSERT_OUTSIDE_BEGIN_END(ctx);
- ctx->List.ListBase = base;
-}
-
-
-/* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
- */
-static void GLAPIENTRY
-exec_Finish(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_Finish(ctx->Exec, ());
-}
-
-static void GLAPIENTRY
-exec_Flush(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_Flush(ctx->Exec, ());
-}
-
-static void GLAPIENTRY
-exec_GetBooleanv(GLenum pname, GLboolean *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetBooleanv(ctx->Exec, (pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetClipPlane(GLenum plane, GLdouble * equation)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetClipPlane(ctx->Exec, (plane, equation));
-}
-
-static void GLAPIENTRY
-exec_GetDoublev(GLenum pname, GLdouble *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetDoublev(ctx->Exec, (pname, params));
-}
-
-static GLenum GLAPIENTRY
-exec_GetError(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_GetError(ctx->Exec, ());
-}
-
-static void GLAPIENTRY
-exec_GetFloatv(GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetFloatv(ctx->Exec, (pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetIntegerv(GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetIntegerv(ctx->Exec, (pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetLightfv(ctx->Exec, (light, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetLightiv(ctx->Exec, (light, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetMapdv(GLenum target, GLenum query, GLdouble * v)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMapdv(ctx->Exec, (target, query, v));
-}
-
-static void GLAPIENTRY
-exec_GetMapfv(GLenum target, GLenum query, GLfloat * v)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMapfv(ctx->Exec, (target, query, v));
-}
-
-static void GLAPIENTRY
-exec_GetMapiv(GLenum target, GLenum query, GLint * v)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMapiv(ctx->Exec, (target, query, v));
-}
-
-static void GLAPIENTRY
-exec_GetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMaterialfv(ctx->Exec, (face, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMaterialiv(ctx->Exec, (face, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetPixelMapfv(GLenum map, GLfloat *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPixelMapfv(ctx->Exec, (map, values));
-}
-
-static void GLAPIENTRY
-exec_GetPixelMapuiv(GLenum map, GLuint *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPixelMapuiv(ctx->Exec, (map, values));
-}
-
-static void GLAPIENTRY
-exec_GetPixelMapusv(GLenum map, GLushort *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPixelMapusv(ctx->Exec, (map, values));
-}
-
-static void GLAPIENTRY
-exec_GetPolygonStipple(GLubyte * dest)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPolygonStipple(ctx->Exec, (dest));
-}
-
-static const GLubyte *GLAPIENTRY
-exec_GetString(GLenum name)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_GetString(ctx->Exec, (name));
-}
-
-static void GLAPIENTRY
-exec_GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexEnvfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexEnviv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexGendv(ctx->Exec, (coord, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexGenfv(ctx->Exec, (coord, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexGeniv(ctx->Exec, (coord, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexImage(GLenum target, GLint level, GLenum format,
- GLenum type, GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexImage(ctx->Exec, (target, level, format, type, pixels));
-}
-
-static void GLAPIENTRY
-exec_GetTexLevelParameterfv(GLenum target, GLint level,
- GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexLevelParameterfv(ctx->Exec, (target, level, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexLevelParameteriv(GLenum target, GLint level,
- GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexLevelParameteriv(ctx->Exec, (target, level, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexParameterfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexParameteriv(ctx->Exec, (target, pname, params));
-}
-
-static GLboolean GLAPIENTRY
-exec_IsEnabled(GLenum cap)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_IsEnabled(ctx->Exec, (cap));
-}
-
-static void GLAPIENTRY
-exec_PixelStoref(GLenum pname, GLfloat param)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_PixelStoref(ctx->Exec, (pname, param));
-}
-
-static void GLAPIENTRY
-exec_PixelStorei(GLenum pname, GLint param)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_PixelStorei(ctx->Exec, (pname, param));
-}
-
-static void GLAPIENTRY
-exec_ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_ReadPixels(ctx->Exec, (x, y, width, height, format, type, pixels));
-}
-
-static GLint GLAPIENTRY
-exec_RenderMode(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_RenderMode(ctx->Exec, (mode));
-}
-
-static void GLAPIENTRY
-exec_FeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_FeedbackBuffer(ctx->Exec, (size, type, buffer));
-}
-
-static void GLAPIENTRY
-exec_SelectBuffer(GLsizei size, GLuint * buffer)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_SelectBuffer(ctx->Exec, (size, buffer));
-}
-
-static GLboolean GLAPIENTRY
-exec_AreTexturesResident(GLsizei n, const GLuint * texName,
- GLboolean * residences)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_AreTexturesResident(ctx->Exec, (n, texName, residences));
-}
-
-static void GLAPIENTRY
-exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_ColorPointer(ctx->Exec, (size, type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_DeleteTextures(GLsizei n, const GLuint * texName)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_DeleteTextures(ctx->Exec, (n, texName));
-}
-
-static void GLAPIENTRY
-exec_DisableClientState(GLenum cap)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_DisableClientState(ctx->Exec, (cap));
-}
-
-static void GLAPIENTRY
-exec_EdgeFlagPointer(GLsizei stride, const GLvoid * vptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_EdgeFlagPointer(ctx->Exec, (stride, vptr));
-}
-
-static void GLAPIENTRY
-exec_EnableClientState(GLenum cap)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_EnableClientState(ctx->Exec, (cap));
-}
-
-static void GLAPIENTRY
-exec_GenTextures(GLsizei n, GLuint * texName)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GenTextures(ctx->Exec, (n, texName));
-}
-
-static void GLAPIENTRY
-exec_GetPointerv(GLenum pname, GLvoid **params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPointerv(ctx->Exec, (pname, params));
-}
-
-static void GLAPIENTRY
-exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_IndexPointer(ctx->Exec, (type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_InterleavedArrays(ctx->Exec, (format, stride, pointer));
-}
-
-static GLboolean GLAPIENTRY
-exec_IsTexture(GLuint texture)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_IsTexture(ctx->Exec, (texture));
-}
-
-static void GLAPIENTRY
-exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_NormalPointer(ctx->Exec, (type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_PopClientAttrib(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_PopClientAttrib(ctx->Exec, ());
-}
-
-static void GLAPIENTRY
-exec_PushClientAttrib(GLbitfield mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_PushClientAttrib(ctx->Exec, (mask));
-}
-
-static void GLAPIENTRY
-exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_TexCoordPointer(ctx->Exec, (size, type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetCompressedTexImageARB(ctx->Exec, (target, level, img));
-}
-
-static void GLAPIENTRY
-exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_VertexPointer(ctx->Exec, (size, type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat,
- GLint x, GLint y, GLsizei width)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_CopyConvolutionFilter1D(ctx->Exec,
- (target, internalFormat, x, y, width));
-}
-
-static void GLAPIENTRY
-exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_CopyConvolutionFilter2D(ctx->Exec,
- (target, internalFormat, x, y, width,
- height));
-}
-
-static void GLAPIENTRY
-exec_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * data)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetColorTable(ctx->Exec, (target, format, type, data));
-}
-
-static void GLAPIENTRY
-exec_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetColorTableParameterfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetColorTableParameteriv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
- GLvoid * image)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetConvolutionFilter(ctx->Exec, (target, format, type, image));
-}
-
-static void GLAPIENTRY
-exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetConvolutionParameterfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetConvolutionParameteriv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetHistogram(GLenum target, GLboolean reset, GLenum format,
- GLenum type, GLvoid *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetHistogram(ctx->Exec, (target, reset, format, type, values));
-}
-
-static void GLAPIENTRY
-exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetHistogramParameterfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetHistogramParameteriv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetMinmax(GLenum target, GLboolean reset, GLenum format,
- GLenum type, GLvoid *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMinmax(ctx->Exec, (target, reset, format, type, values));
-}
-
-static void GLAPIENTRY
-exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMinmaxParameterfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMinmaxParameteriv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
- GLvoid *row, GLvoid *column, GLvoid *span)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetSeparableFilter(ctx->Exec,
- (target, format, type, row, column, span));
-}
-
-static void GLAPIENTRY
-exec_SeparableFilter2D(GLenum target, GLenum internalFormat,
- GLsizei width, GLsizei height, GLenum format,
- GLenum type, const GLvoid *row, const GLvoid *column)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_SeparableFilter2D(ctx->Exec,
- (target, internalFormat, width, height, format,
- type, row, column));
-}
-
-static void GLAPIENTRY
-exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_ColorPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_EdgeFlagPointerEXT(ctx->Exec, (stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_IndexPointerEXT(ctx->Exec, (type, stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_NormalPointerEXT(ctx->Exec, (type, stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_TexCoordPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_VertexPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_LockArraysEXT(GLint first, GLsizei count)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_LockArraysEXT(ctx->Exec, (first, count));
-}
-
-static void GLAPIENTRY
-exec_UnlockArraysEXT(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_UnlockArraysEXT(ctx->Exec, ());
-}
-
-static void GLAPIENTRY
-exec_ClientActiveTextureARB(GLenum target)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_ClientActiveTextureARB(ctx->Exec, (target));
-}
-
-static void GLAPIENTRY
-exec_SecondaryColorPointerEXT(GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_SecondaryColorPointerEXT(ctx->Exec, (size, type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_FogCoordPointerEXT(ctx->Exec, (type, stride, ptr));
-}
-
-/* GL_EXT_multi_draw_arrays */
-static void GLAPIENTRY
-exec_MultiDrawArraysEXT(GLenum mode, const GLint *first,
- const GLsizei *count, GLsizei primcount)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_MultiDrawArraysEXT(ctx->Exec, (mode, first, count, primcount));
-}
-
-/* GL_IBM_multimode_draw_arrays */
-static void GLAPIENTRY
-exec_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
- const GLsizei * count, GLsizei primcount,
- GLint modestride)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_MultiModeDrawArraysIBM(ctx->Exec,
- (mode, first, count, primcount, modestride));
-}
-
-/* GL_IBM_multimode_draw_arrays */
-static void GLAPIENTRY
-exec_MultiModeDrawElementsIBM(const GLenum * mode,
- const GLsizei * count,
- GLenum type,
- const GLvoid * const *indices,
- GLsizei primcount, GLint modestride)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_MultiModeDrawElementsIBM(ctx->Exec,
- (mode, count, type, indices, primcount,
- modestride));
-}
-
-
-
-/**
- * Setup the given dispatch table to point to Mesa's display list
- * building functions.
- *
- * This does not include any of the tnl functions - they are
- * initialized from _mesa_init_api_defaults and from the active vtxfmt
- * struct.
- */
-struct _glapi_table *
-_mesa_create_save_table(void)
-{
- struct _glapi_table *table;
-
- table = _mesa_alloc_dispatch_table(_gloffset_COUNT);
- if (table == NULL)
- return NULL;
-
- _mesa_loopback_init_api_table(table);
-
- /* GL 1.0 */
- SET_Accum(table, save_Accum);
- SET_AlphaFunc(table, save_AlphaFunc);
- SET_Bitmap(table, save_Bitmap);
- SET_BlendFunc(table, save_BlendFunc);
- SET_CallList(table, save_CallList);
- SET_CallLists(table, save_CallLists);
- SET_Clear(table, save_Clear);
- SET_ClearAccum(table, save_ClearAccum);
- SET_ClearColor(table, save_ClearColor);
- SET_ClearDepth(table, save_ClearDepth);
- SET_ClearIndex(table, save_ClearIndex);
- SET_ClearStencil(table, save_ClearStencil);
- SET_ClipPlane(table, save_ClipPlane);
- SET_ColorMask(table, save_ColorMask);
- SET_ColorMaskIndexedEXT(table, save_ColorMaskIndexed);
- SET_ColorMaterial(table, save_ColorMaterial);
- SET_CopyPixels(table, save_CopyPixels);
- SET_CullFace(table, save_CullFace);
- SET_DeleteLists(table, _mesa_DeleteLists);
- SET_DepthFunc(table, save_DepthFunc);
- SET_DepthMask(table, save_DepthMask);
- SET_DepthRange(table, save_DepthRange);
- SET_Disable(table, save_Disable);
- SET_DisableIndexedEXT(table, save_DisableIndexed);
- SET_DrawBuffer(table, save_DrawBuffer);
- SET_DrawPixels(table, save_DrawPixels);
- SET_Enable(table, save_Enable);
- SET_EnableIndexedEXT(table, save_EnableIndexed);
- SET_EndList(table, _mesa_EndList);
- SET_EvalMesh1(table, save_EvalMesh1);
- SET_EvalMesh2(table, save_EvalMesh2);
- SET_Finish(table, exec_Finish);
- SET_Flush(table, exec_Flush);
- SET_Fogf(table, save_Fogf);
- SET_Fogfv(table, save_Fogfv);
- SET_Fogi(table, save_Fogi);
- SET_Fogiv(table, save_Fogiv);
- SET_FrontFace(table, save_FrontFace);
- SET_Frustum(table, save_Frustum);
- SET_GenLists(table, _mesa_GenLists);
- SET_GetBooleanv(table, exec_GetBooleanv);
- SET_GetClipPlane(table, exec_GetClipPlane);
- SET_GetDoublev(table, exec_GetDoublev);
- SET_GetError(table, exec_GetError);
- SET_GetFloatv(table, exec_GetFloatv);
- SET_GetIntegerv(table, exec_GetIntegerv);
- SET_GetLightfv(table, exec_GetLightfv);
- SET_GetLightiv(table, exec_GetLightiv);
- SET_GetMapdv(table, exec_GetMapdv);
- SET_GetMapfv(table, exec_GetMapfv);
- SET_GetMapiv(table, exec_GetMapiv);
- SET_GetMaterialfv(table, exec_GetMaterialfv);
- SET_GetMaterialiv(table, exec_GetMaterialiv);
- SET_GetPixelMapfv(table, exec_GetPixelMapfv);
- SET_GetPixelMapuiv(table, exec_GetPixelMapuiv);
- SET_GetPixelMapusv(table, exec_GetPixelMapusv);
- SET_GetPolygonStipple(table, exec_GetPolygonStipple);
- SET_GetString(table, exec_GetString);
- SET_GetTexEnvfv(table, exec_GetTexEnvfv);
- SET_GetTexEnviv(table, exec_GetTexEnviv);
- SET_GetTexGendv(table, exec_GetTexGendv);
- SET_GetTexGenfv(table, exec_GetTexGenfv);
- SET_GetTexGeniv(table, exec_GetTexGeniv);
- SET_GetTexImage(table, exec_GetTexImage);
- SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv);
- SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv);
- SET_GetTexParameterfv(table, exec_GetTexParameterfv);
- SET_GetTexParameteriv(table, exec_GetTexParameteriv);
- SET_Hint(table, save_Hint);
- SET_IndexMask(table, save_IndexMask);
- SET_InitNames(table, save_InitNames);
- SET_IsEnabled(table, exec_IsEnabled);
- SET_IsList(table, _mesa_IsList);
- SET_LightModelf(table, save_LightModelf);
- SET_LightModelfv(table, save_LightModelfv);
- SET_LightModeli(table, save_LightModeli);
- SET_LightModeliv(table, save_LightModeliv);
- SET_Lightf(table, save_Lightf);
- SET_Lightfv(table, save_Lightfv);
- SET_Lighti(table, save_Lighti);
- SET_Lightiv(table, save_Lightiv);
- SET_LineStipple(table, save_LineStipple);
- SET_LineWidth(table, save_LineWidth);
- SET_ListBase(table, save_ListBase);
- SET_LoadIdentity(table, save_LoadIdentity);
- SET_LoadMatrixd(table, save_LoadMatrixd);
- SET_LoadMatrixf(table, save_LoadMatrixf);
- SET_LoadName(table, save_LoadName);
- SET_LogicOp(table, save_LogicOp);
- SET_Map1d(table, save_Map1d);
- SET_Map1f(table, save_Map1f);
- SET_Map2d(table, save_Map2d);
- SET_Map2f(table, save_Map2f);
- SET_MapGrid1d(table, save_MapGrid1d);
- SET_MapGrid1f(table, save_MapGrid1f);
- SET_MapGrid2d(table, save_MapGrid2d);
- SET_MapGrid2f(table, save_MapGrid2f);
- SET_MatrixMode(table, save_MatrixMode);
- SET_MultMatrixd(table, save_MultMatrixd);
- SET_MultMatrixf(table, save_MultMatrixf);
- SET_NewList(table, save_NewList);
- SET_Ortho(table, save_Ortho);
- SET_PassThrough(table, save_PassThrough);
- SET_PixelMapfv(table, save_PixelMapfv);
- SET_PixelMapuiv(table, save_PixelMapuiv);
- SET_PixelMapusv(table, save_PixelMapusv);
- SET_PixelStoref(table, exec_PixelStoref);
- SET_PixelStorei(table, exec_PixelStorei);
- SET_PixelTransferf(table, save_PixelTransferf);
- SET_PixelTransferi(table, save_PixelTransferi);
- SET_PixelZoom(table, save_PixelZoom);
- SET_PointSize(table, save_PointSize);
- SET_PolygonMode(table, save_PolygonMode);
- SET_PolygonOffset(table, save_PolygonOffset);
- SET_PolygonStipple(table, save_PolygonStipple);
- SET_PopAttrib(table, save_PopAttrib);
- SET_PopMatrix(table, save_PopMatrix);
- SET_PopName(table, save_PopName);
- SET_PushAttrib(table, save_PushAttrib);
- SET_PushMatrix(table, save_PushMatrix);
- SET_PushName(table, save_PushName);
- SET_RasterPos2d(table, save_RasterPos2d);
- SET_RasterPos2dv(table, save_RasterPos2dv);
- SET_RasterPos2f(table, save_RasterPos2f);
- SET_RasterPos2fv(table, save_RasterPos2fv);
- SET_RasterPos2i(table, save_RasterPos2i);
- SET_RasterPos2iv(table, save_RasterPos2iv);
- SET_RasterPos2s(table, save_RasterPos2s);
- SET_RasterPos2sv(table, save_RasterPos2sv);
- SET_RasterPos3d(table, save_RasterPos3d);
- SET_RasterPos3dv(table, save_RasterPos3dv);
- SET_RasterPos3f(table, save_RasterPos3f);
- SET_RasterPos3fv(table, save_RasterPos3fv);
- SET_RasterPos3i(table, save_RasterPos3i);
- SET_RasterPos3iv(table, save_RasterPos3iv);
- SET_RasterPos3s(table, save_RasterPos3s);
- SET_RasterPos3sv(table, save_RasterPos3sv);
- SET_RasterPos4d(table, save_RasterPos4d);
- SET_RasterPos4dv(table, save_RasterPos4dv);
- SET_RasterPos4f(table, save_RasterPos4f);
- SET_RasterPos4fv(table, save_RasterPos4fv);
- SET_RasterPos4i(table, save_RasterPos4i);
- SET_RasterPos4iv(table, save_RasterPos4iv);
- SET_RasterPos4s(table, save_RasterPos4s);
- SET_RasterPos4sv(table, save_RasterPos4sv);
- SET_ReadBuffer(table, save_ReadBuffer);
- SET_ReadPixels(table, exec_ReadPixels);
- SET_RenderMode(table, exec_RenderMode);
- SET_Rotated(table, save_Rotated);
- SET_Rotatef(table, save_Rotatef);
- SET_Scaled(table, save_Scaled);
- SET_Scalef(table, save_Scalef);
- SET_Scissor(table, save_Scissor);
- SET_FeedbackBuffer(table, exec_FeedbackBuffer);
- SET_SelectBuffer(table, exec_SelectBuffer);
- SET_ShadeModel(table, save_ShadeModel);
- SET_StencilFunc(table, save_StencilFunc);
- SET_StencilMask(table, save_StencilMask);
- SET_StencilOp(table, save_StencilOp);
- SET_TexEnvf(table, save_TexEnvf);
- SET_TexEnvfv(table, save_TexEnvfv);
- SET_TexEnvi(table, save_TexEnvi);
- SET_TexEnviv(table, save_TexEnviv);
- SET_TexGend(table, save_TexGend);
- SET_TexGendv(table, save_TexGendv);
- SET_TexGenf(table, save_TexGenf);
- SET_TexGenfv(table, save_TexGenfv);
- SET_TexGeni(table, save_TexGeni);
- SET_TexGeniv(table, save_TexGeniv);
- SET_TexImage1D(table, save_TexImage1D);
- SET_TexImage2D(table, save_TexImage2D);
- SET_TexParameterf(table, save_TexParameterf);
- SET_TexParameterfv(table, save_TexParameterfv);
- SET_TexParameteri(table, save_TexParameteri);
- SET_TexParameteriv(table, save_TexParameteriv);
- SET_Translated(table, save_Translated);
- SET_Translatef(table, save_Translatef);
- SET_Viewport(table, save_Viewport);
-
- /* GL 1.1 */
- SET_AreTexturesResident(table, exec_AreTexturesResident);
- SET_BindTexture(table, save_BindTexture);
- SET_ColorPointer(table, exec_ColorPointer);
- SET_CopyTexImage1D(table, save_CopyTexImage1D);
- SET_CopyTexImage2D(table, save_CopyTexImage2D);
- SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
- SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
- SET_DeleteTextures(table, exec_DeleteTextures);
- SET_DisableClientState(table, exec_DisableClientState);
- SET_EdgeFlagPointer(table, exec_EdgeFlagPointer);
- SET_EnableClientState(table, exec_EnableClientState);
- SET_GenTextures(table, exec_GenTextures);
- SET_GetPointerv(table, exec_GetPointerv);
- SET_IndexPointer(table, exec_IndexPointer);
- SET_InterleavedArrays(table, exec_InterleavedArrays);
- SET_IsTexture(table, exec_IsTexture);
- SET_NormalPointer(table, exec_NormalPointer);
- SET_PopClientAttrib(table, exec_PopClientAttrib);
- SET_PrioritizeTextures(table, save_PrioritizeTextures);
- SET_PushClientAttrib(table, exec_PushClientAttrib);
- SET_TexCoordPointer(table, exec_TexCoordPointer);
- SET_TexSubImage1D(table, save_TexSubImage1D);
- SET_TexSubImage2D(table, save_TexSubImage2D);
- SET_VertexPointer(table, exec_VertexPointer);
-
- /* GL 1.2 */
- SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
- SET_TexImage3D(table, save_TexImage3D);
- SET_TexSubImage3D(table, save_TexSubImage3D);
-
- /* GL 2.0 */
- SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
- SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
- SET_StencilOpSeparate(table, save_StencilOpSeparate);
-
- /* ATI_separate_stencil */
- SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
-
- /* GL_ARB_imaging */
- /* Not all are supported */
- SET_BlendColor(table, save_BlendColor);
- SET_BlendEquation(table, save_BlendEquation);
- SET_ColorSubTable(table, save_ColorSubTable);
- SET_ColorTable(table, save_ColorTable);
- SET_ColorTableParameterfv(table, save_ColorTableParameterfv);
- SET_ColorTableParameteriv(table, save_ColorTableParameteriv);
- SET_ConvolutionFilter1D(table, save_ConvolutionFilter1D);
- SET_ConvolutionFilter2D(table, save_ConvolutionFilter2D);
- SET_ConvolutionParameterf(table, save_ConvolutionParameterf);
- SET_ConvolutionParameterfv(table, save_ConvolutionParameterfv);
- SET_ConvolutionParameteri(table, save_ConvolutionParameteri);
- SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv);
- SET_CopyColorSubTable(table, save_CopyColorSubTable);
- SET_CopyColorTable(table, save_CopyColorTable);
- SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D);
- SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D);
- SET_GetColorTable(table, exec_GetColorTable);
- SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv);
- SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv);
- SET_GetConvolutionFilter(table, exec_GetConvolutionFilter);
- SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv);
- SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv);
- SET_GetHistogram(table, exec_GetHistogram);
- SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv);
- SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv);
- SET_GetMinmax(table, exec_GetMinmax);
- SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv);
- SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv);
- SET_GetSeparableFilter(table, exec_GetSeparableFilter);
- SET_Histogram(table, save_Histogram);
- SET_Minmax(table, save_Minmax);
- SET_ResetHistogram(table, save_ResetHistogram);
- SET_ResetMinmax(table, save_ResetMinmax);
- SET_SeparableFilter2D(table, exec_SeparableFilter2D);
-
- /* 2. GL_EXT_blend_color */
-#if 0
- SET_BlendColorEXT(table, save_BlendColorEXT);
-#endif
-
- /* 3. GL_EXT_polygon_offset */
- SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT);
-
- /* 6. GL_EXT_texture3d */
-#if 0
- SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
- SET_TexImage3DEXT(table, save_TexImage3DEXT);
- SET_TexSubImage3DEXT(table, save_TexSubImage3D);
-#endif
-
- /* 14. GL_SGI_color_table */
-#if 0
- SET_ColorTableSGI(table, save_ColorTable);
- SET_ColorSubTableSGI(table, save_ColorSubTable);
- SET_GetColorTableSGI(table, exec_GetColorTable);
- SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv);
- SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv);
-#endif
-
- /* 30. GL_EXT_vertex_array */
- SET_ColorPointerEXT(table, exec_ColorPointerEXT);
- SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT);
- SET_IndexPointerEXT(table, exec_IndexPointerEXT);
- SET_NormalPointerEXT(table, exec_NormalPointerEXT);
- SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT);
- SET_VertexPointerEXT(table, exec_VertexPointerEXT);
-
- /* 37. GL_EXT_blend_minmax */
-#if 0
- SET_BlendEquationEXT(table, save_BlendEquationEXT);
-#endif
-
- /* 54. GL_EXT_point_parameters */
- SET_PointParameterfEXT(table, save_PointParameterfEXT);
- SET_PointParameterfvEXT(table, save_PointParameterfvEXT);
-
- /* 97. GL_EXT_compiled_vertex_array */
- SET_LockArraysEXT(table, exec_LockArraysEXT);
- SET_UnlockArraysEXT(table, exec_UnlockArraysEXT);
-
- /* 145. GL_EXT_secondary_color */
- SET_SecondaryColorPointerEXT(table, exec_SecondaryColorPointerEXT);
-
- /* 148. GL_EXT_multi_draw_arrays */
- SET_MultiDrawArraysEXT(table, exec_MultiDrawArraysEXT);
-
- /* 149. GL_EXT_fog_coord */
- SET_FogCoordPointerEXT(table, exec_FogCoordPointerEXT);
-
- /* 173. GL_EXT_blend_func_separate */
- SET_BlendFuncSeparateEXT(table, save_BlendFuncSeparateEXT);
-
- /* 196. GL_MESA_resize_buffers */
- SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA);
-
- /* 197. GL_MESA_window_pos */
- SET_WindowPos2dMESA(table, save_WindowPos2dMESA);
- SET_WindowPos2dvMESA(table, save_WindowPos2dvMESA);
- SET_WindowPos2fMESA(table, save_WindowPos2fMESA);
- SET_WindowPos2fvMESA(table, save_WindowPos2fvMESA);
- SET_WindowPos2iMESA(table, save_WindowPos2iMESA);
- SET_WindowPos2ivMESA(table, save_WindowPos2ivMESA);
- SET_WindowPos2sMESA(table, save_WindowPos2sMESA);
- SET_WindowPos2svMESA(table, save_WindowPos2svMESA);
- SET_WindowPos3dMESA(table, save_WindowPos3dMESA);
- SET_WindowPos3dvMESA(table, save_WindowPos3dvMESA);
- SET_WindowPos3fMESA(table, save_WindowPos3fMESA);
- SET_WindowPos3fvMESA(table, save_WindowPos3fvMESA);
- SET_WindowPos3iMESA(table, save_WindowPos3iMESA);
- SET_WindowPos3ivMESA(table, save_WindowPos3ivMESA);
- SET_WindowPos3sMESA(table, save_WindowPos3sMESA);
- SET_WindowPos3svMESA(table, save_WindowPos3svMESA);
- SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
- SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
- SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
- SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
- SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
- SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
- SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
- SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
-
- /* 200. GL_IBM_multimode_draw_arrays */
- SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM);
- SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM);
-
-#if FEATURE_NV_vertex_program
- /* 233. GL_NV_vertex_program */
- /* The following commands DO NOT go into display lists:
- * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
- * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
- */
- SET_BindProgramNV(table, save_BindProgramNV);
- SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
- SET_ExecuteProgramNV(table, save_ExecuteProgramNV);
- SET_GenProgramsNV(table, _mesa_GenPrograms);
- SET_AreProgramsResidentNV(table, _mesa_AreProgramsResidentNV);
- SET_RequestResidentProgramsNV(table, save_RequestResidentProgramsNV);
- SET_GetProgramParameterfvNV(table, _mesa_GetProgramParameterfvNV);
- SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV);
- SET_GetProgramivNV(table, _mesa_GetProgramivNV);
- SET_GetProgramStringNV(table, _mesa_GetProgramStringNV);
- SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV);
- SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
- SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
- SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
- SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
- SET_IsProgramNV(table, _mesa_IsProgramARB);
- SET_LoadProgramNV(table, save_LoadProgramNV);
- SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
- SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
- SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
- SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
- SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV);
- SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV);
- SET_TrackMatrixNV(table, save_TrackMatrixNV);
- SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV);
-#endif
-
- /* 244. GL_ATI_envmap_bumpmap */
- SET_TexBumpParameterivATI(table, save_TexBumpParameterivATI);
- SET_TexBumpParameterfvATI(table, save_TexBumpParameterfvATI);
-
- /* 245. GL_ATI_fragment_shader */
-#if FEATURE_ATI_fragment_shader
- SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
- SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
-#endif
-
- /* 282. GL_NV_fragment_program */
-#if FEATURE_NV_fragment_program
- SET_ProgramNamedParameter4fNV(table, save_ProgramNamedParameter4fNV);
- SET_ProgramNamedParameter4dNV(table, save_ProgramNamedParameter4dNV);
- SET_ProgramNamedParameter4fvNV(table, save_ProgramNamedParameter4fvNV);
- SET_ProgramNamedParameter4dvNV(table, save_ProgramNamedParameter4dvNV);
- SET_GetProgramNamedParameterfvNV(table,
- _mesa_GetProgramNamedParameterfvNV);
- SET_GetProgramNamedParameterdvNV(table,
- _mesa_GetProgramNamedParameterdvNV);
- SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
- SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
- SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
- SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
- SET_GetProgramLocalParameterdvARB(table,
- _mesa_GetProgramLocalParameterdvARB);
- SET_GetProgramLocalParameterfvARB(table,
- _mesa_GetProgramLocalParameterfvARB);
-#endif
-
- /* 262. GL_NV_point_sprite */
- SET_PointParameteriNV(table, save_PointParameteriNV);
- SET_PointParameterivNV(table, save_PointParameterivNV);
-
- /* 268. GL_EXT_stencil_two_side */
- SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
-
- /* 273. GL_APPLE_vertex_array_object */
- SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE);
- SET_DeleteVertexArraysAPPLE(table, _mesa_DeleteVertexArraysAPPLE);
- SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE);
- SET_IsVertexArrayAPPLE(table, _mesa_IsVertexArrayAPPLE);
-
- /* ???. GL_EXT_depth_bounds_test */
- SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
-
- /* ARB 1. GL_ARB_multitexture */
- SET_ActiveTextureARB(table, save_ActiveTextureARB);
- SET_ClientActiveTextureARB(table, exec_ClientActiveTextureARB);
-
- /* ARB 3. GL_ARB_transpose_matrix */
- SET_LoadTransposeMatrixdARB(table, save_LoadTransposeMatrixdARB);
- SET_LoadTransposeMatrixfARB(table, save_LoadTransposeMatrixfARB);
- SET_MultTransposeMatrixdARB(table, save_MultTransposeMatrixdARB);
- SET_MultTransposeMatrixfARB(table, save_MultTransposeMatrixfARB);
-
- /* ARB 5. GL_ARB_multisample */
- SET_SampleCoverageARB(table, save_SampleCoverageARB);
-
- /* ARB 12. GL_ARB_texture_compression */
- SET_CompressedTexImage3DARB(table, save_CompressedTexImage3DARB);
- SET_CompressedTexImage2DARB(table, save_CompressedTexImage2DARB);
- SET_CompressedTexImage1DARB(table, save_CompressedTexImage1DARB);
- SET_CompressedTexSubImage3DARB(table, save_CompressedTexSubImage3DARB);
- SET_CompressedTexSubImage2DARB(table, save_CompressedTexSubImage2DARB);
- SET_CompressedTexSubImage1DARB(table, save_CompressedTexSubImage1DARB);
- SET_GetCompressedTexImageARB(table, exec_GetCompressedTexImageARB);
-
- /* ARB 14. GL_ARB_point_parameters */
- /* aliased with EXT_point_parameters functions */
-
- /* ARB 25. GL_ARB_window_pos */
- /* aliased with MESA_window_pos functions */
-
- /* ARB 26. GL_ARB_vertex_program */
- /* ARB 27. GL_ARB_fragment_program */
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
- /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
- SET_VertexAttribPointerARB(table, _mesa_VertexAttribPointerARB);
- SET_EnableVertexAttribArrayARB(table, _mesa_EnableVertexAttribArrayARB);
- SET_DisableVertexAttribArrayARB(table, _mesa_DisableVertexAttribArrayARB);
- SET_ProgramStringARB(table, save_ProgramStringARB);
- SET_BindProgramNV(table, save_BindProgramNV);
- SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
- SET_GenProgramsNV(table, _mesa_GenPrograms);
- SET_IsProgramNV(table, _mesa_IsProgramARB);
- SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
- SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
- SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
- SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
- SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
- SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
- SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
- SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
- SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
- SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
- SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
- SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
- SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB);
- SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB);
- SET_GetProgramLocalParameterdvARB(table,
- _mesa_GetProgramLocalParameterdvARB);
- SET_GetProgramLocalParameterfvARB(table,
- _mesa_GetProgramLocalParameterfvARB);
- SET_GetProgramivARB(table, _mesa_GetProgramivARB);
- SET_GetProgramStringARB(table, _mesa_GetProgramStringARB);
-#endif
-
- /* ARB 28. GL_ARB_vertex_buffer_object */
-#if FEATURE_ARB_vertex_buffer_object
- /* None of the extension's functions get compiled */
- SET_BindBufferARB(table, _mesa_BindBufferARB);
- SET_BufferDataARB(table, _mesa_BufferDataARB);
- SET_BufferSubDataARB(table, _mesa_BufferSubDataARB);
- SET_DeleteBuffersARB(table, _mesa_DeleteBuffersARB);
- SET_GenBuffersARB(table, _mesa_GenBuffersARB);
- SET_GetBufferParameterivARB(table, _mesa_GetBufferParameterivARB);
- SET_GetBufferPointervARB(table, _mesa_GetBufferPointervARB);
- SET_GetBufferSubDataARB(table, _mesa_GetBufferSubDataARB);
- SET_IsBufferARB(table, _mesa_IsBufferARB);
- SET_MapBufferARB(table, _mesa_MapBufferARB);
- SET_UnmapBufferARB(table, _mesa_UnmapBufferARB);
-#endif
-
-#if FEATURE_queryobj
- SET_BeginQueryARB(table, save_BeginQueryARB);
- SET_EndQueryARB(table, save_EndQueryARB);
- SET_GenQueriesARB(table, _mesa_GenQueriesARB);
- SET_DeleteQueriesARB(table, _mesa_DeleteQueriesARB);
- SET_IsQueryARB(table, _mesa_IsQueryARB);
- SET_GetQueryivARB(table, _mesa_GetQueryivARB);
- SET_GetQueryObjectivARB(table, _mesa_GetQueryObjectivARB);
- SET_GetQueryObjectuivARB(table, _mesa_GetQueryObjectuivARB);
-#endif
- SET_DrawBuffersARB(table, save_DrawBuffersARB);
-
-#if FEATURE_EXT_framebuffer_blit
- SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT);
-#endif
-
- /* GL_ARB_shader_objects */
- SET_UseProgramObjectARB(table, save_UseProgramObjectARB);
- SET_Uniform1fARB(table, save_Uniform1fARB);
- SET_Uniform2fARB(table, save_Uniform2fARB);
- SET_Uniform3fARB(table, save_Uniform3fARB);
- SET_Uniform4fARB(table, save_Uniform4fARB);
- SET_Uniform1fvARB(table, save_Uniform1fvARB);
- SET_Uniform2fvARB(table, save_Uniform2fvARB);
- SET_Uniform3fvARB(table, save_Uniform3fvARB);
- SET_Uniform4fvARB(table, save_Uniform4fvARB);
- SET_Uniform1iARB(table, save_Uniform1iARB);
- SET_Uniform2iARB(table, save_Uniform2iARB);
- SET_Uniform3iARB(table, save_Uniform3iARB);
- SET_Uniform4iARB(table, save_Uniform4iARB);
- SET_Uniform1ivARB(table, save_Uniform1ivARB);
- SET_Uniform2ivARB(table, save_Uniform2ivARB);
- SET_Uniform3ivARB(table, save_Uniform3ivARB);
- SET_Uniform4ivARB(table, save_Uniform4ivARB);
- SET_UniformMatrix2fvARB(table, save_UniformMatrix2fvARB);
- SET_UniformMatrix3fvARB(table, save_UniformMatrix3fvARB);
- SET_UniformMatrix4fvARB(table, save_UniformMatrix4fvARB);
- SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
- SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
- SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
- SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
- SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
- SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
-
- /* 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_parameters */
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
- SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
- SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
-#endif
-
- /* ARB 50. GL_ARB_map_buffer_range */
-#if FEATURE_ARB_map_buffer_range
- SET_MapBufferRange(table, _mesa_MapBufferRange); /* no dlist save */
- SET_FlushMappedBufferRange(table, _mesa_FlushMappedBufferRange); /* no dl */
-#endif
-
- /* 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);
-
- /* 371. GL_APPLE_object_purgeable */
-#if FEATURE_APPLE_object_purgeable
- SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE);
- SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE);
-#endif
-
- /* GL_EXT_texture_integer */
- SET_ClearColorIiEXT(table, save_ClearColorIi);
- SET_ClearColorIuiEXT(table, save_ClearColorIui);
- SET_TexParameterIivEXT(table, save_TexParameterIiv);
- SET_TexParameterIuivEXT(table, save_TexParameterIuiv);
- SET_GetTexParameterIivEXT(table, exec_GetTexParameterIiv);
- SET_GetTexParameterIuivEXT(table, exec_GetTexParameterIuiv);
-
- /* 377. GL_EXT_separate_shader_objects */
- SET_UseShaderProgramEXT(table, save_UseShaderProgramEXT);
- SET_ActiveProgramEXT(table, save_ActiveProgramEXT);
-
- /* GL 3.0 */
-#if 0
- SET_ClearBufferiv(table, save_ClearBufferiv);
- 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;
-}
-
-
-
-static const char *
-enum_string(GLenum k)
-{
- return _mesa_lookup_enum_by_nr(k);
-}
-
-
-/**
- * Print the commands in a display list. For debugging only.
- * TODO: many commands aren't handled yet.
- */
-static void GLAPIENTRY
-print_list(struct gl_context *ctx, GLuint list)
-{
- struct gl_display_list *dlist;
- Node *n;
- GLboolean done;
-
- if (!islist(ctx, list)) {
- printf("%u is not a display list ID\n", list);
- return;
- }
-
- dlist = lookup_list(ctx, list);
- if (!dlist)
- return;
-
- n = dlist->Head;
-
- printf("START-LIST %u, address %p\n", list, (void *) n);
-
- done = n ? GL_FALSE : GL_TRUE;
- while (!done) {
- const OpCode opcode = n[0].opcode;
-
- if (is_ext_opcode(opcode)) {
- n += ext_opcode_print(ctx, n);
- }
- else {
- switch (opcode) {
- case OPCODE_ACCUM:
- printf("Accum %s %g\n", enum_string(n[1].e), n[2].f);
- break;
- case OPCODE_BITMAP:
- printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
- n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data);
- break;
- case OPCODE_CALL_LIST:
- printf("CallList %d\n", (int) n[1].ui);
- break;
- case OPCODE_CALL_LIST_OFFSET:
- printf("CallList %d + offset %u = %u\n", (int) n[1].ui,
- ctx->List.ListBase, ctx->List.ListBase + n[1].ui);
- break;
- case OPCODE_COLOR_TABLE_PARAMETER_FV:
- printf("ColorTableParameterfv %s %s %f %f %f %f\n",
- enum_string(n[1].e), enum_string(n[2].e),
- n[3].f, n[4].f, n[5].f, n[6].f);
- break;
- case OPCODE_COLOR_TABLE_PARAMETER_IV:
- printf("ColorTableParameteriv %s %s %d %d %d %d\n",
- enum_string(n[1].e), enum_string(n[2].e),
- n[3].i, n[4].i, n[5].i, n[6].i);
- break;
- case OPCODE_DISABLE:
- printf("Disable %s\n", enum_string(n[1].e));
- break;
- case OPCODE_ENABLE:
- printf("Enable %s\n", enum_string(n[1].e));
- break;
- case OPCODE_FRUSTUM:
- printf("Frustum %g %g %g %g %g %g\n",
- n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
- break;
- case OPCODE_LINE_STIPPLE:
- printf("LineStipple %d %x\n", n[1].i, (int) n[2].us);
- break;
- case OPCODE_LOAD_IDENTITY:
- printf("LoadIdentity\n");
- break;
- case OPCODE_LOAD_MATRIX:
- printf("LoadMatrix\n");
- printf(" %8f %8f %8f %8f\n",
- n[1].f, n[5].f, n[9].f, n[13].f);
- printf(" %8f %8f %8f %8f\n",
- n[2].f, n[6].f, n[10].f, n[14].f);
- printf(" %8f %8f %8f %8f\n",
- n[3].f, n[7].f, n[11].f, n[15].f);
- printf(" %8f %8f %8f %8f\n",
- n[4].f, n[8].f, n[12].f, n[16].f);
- break;
- case OPCODE_MULT_MATRIX:
- printf("MultMatrix (or Rotate)\n");
- printf(" %8f %8f %8f %8f\n",
- n[1].f, n[5].f, n[9].f, n[13].f);
- printf(" %8f %8f %8f %8f\n",
- n[2].f, n[6].f, n[10].f, n[14].f);
- printf(" %8f %8f %8f %8f\n",
- n[3].f, n[7].f, n[11].f, n[15].f);
- printf(" %8f %8f %8f %8f\n",
- n[4].f, n[8].f, n[12].f, n[16].f);
- break;
- case OPCODE_ORTHO:
- printf("Ortho %g %g %g %g %g %g\n",
- n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
- break;
- case OPCODE_POP_ATTRIB:
- printf("PopAttrib\n");
- break;
- case OPCODE_POP_MATRIX:
- printf("PopMatrix\n");
- break;
- case OPCODE_POP_NAME:
- printf("PopName\n");
- break;
- case OPCODE_PUSH_ATTRIB:
- printf("PushAttrib %x\n", n[1].bf);
- break;
- case OPCODE_PUSH_MATRIX:
- printf("PushMatrix\n");
- break;
- case OPCODE_PUSH_NAME:
- printf("PushName %d\n", (int) n[1].ui);
- break;
- case OPCODE_RASTER_POS:
- printf("RasterPos %g %g %g %g\n",
- n[1].f, n[2].f, n[3].f, n[4].f);
- break;
- case OPCODE_ROTATE:
- printf("Rotate %g %g %g %g\n",
- n[1].f, n[2].f, n[3].f, n[4].f);
- break;
- case OPCODE_SCALE:
- printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
- break;
- case OPCODE_TRANSLATE:
- printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
- break;
- case OPCODE_BIND_TEXTURE:
- printf("BindTexture %s %d\n",
- _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui);
- break;
- case OPCODE_SHADE_MODEL:
- printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui));
- break;
- case OPCODE_MAP1:
- printf("Map1 %s %.3f %.3f %d %d\n",
- _mesa_lookup_enum_by_nr(n[1].ui),
- n[2].f, n[3].f, n[4].i, n[5].i);
- break;
- case OPCODE_MAP2:
- printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
- _mesa_lookup_enum_by_nr(n[1].ui),
- n[2].f, n[3].f, n[4].f, n[5].f,
- n[6].i, n[7].i, n[8].i, n[9].i);
- break;
- case OPCODE_MAPGRID1:
- printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
- break;
- case OPCODE_MAPGRID2:
- printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
- n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
- break;
- case OPCODE_EVALMESH1:
- printf("EvalMesh1 %d %d\n", n[1].i, n[2].i);
- break;
- case OPCODE_EVALMESH2:
- printf("EvalMesh2 %d %d %d %d\n",
- n[1].i, n[2].i, n[3].i, n[4].i);
- break;
-
- case OPCODE_ATTR_1F_NV:
- printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
- break;
- case OPCODE_ATTR_2F_NV:
- printf("ATTR_2F_NV attr %d: %f %f\n",
- n[1].i, n[2].f, n[3].f);
- break;
- case OPCODE_ATTR_3F_NV:
- printf("ATTR_3F_NV attr %d: %f %f %f\n",
- n[1].i, n[2].f, n[3].f, n[4].f);
- break;
- case OPCODE_ATTR_4F_NV:
- printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
- n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
- break;
- case OPCODE_ATTR_1F_ARB:
- printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
- break;
- case OPCODE_ATTR_2F_ARB:
- printf("ATTR_2F_ARB attr %d: %f %f\n",
- n[1].i, n[2].f, n[3].f);
- break;
- case OPCODE_ATTR_3F_ARB:
- printf("ATTR_3F_ARB attr %d: %f %f %f\n",
- n[1].i, n[2].f, n[3].f, n[4].f);
- break;
- case OPCODE_ATTR_4F_ARB:
- printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
- n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
- break;
-
- case OPCODE_MATERIAL:
- printf("MATERIAL %x %x: %f %f %f %f\n",
- n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
- break;
- case OPCODE_BEGIN:
- printf("BEGIN %x\n", n[1].i);
- break;
- case OPCODE_END:
- printf("END\n");
- break;
- case OPCODE_RECTF:
- printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
- n[4].f);
- break;
- case OPCODE_EVAL_C1:
- printf("EVAL_C1 %f\n", n[1].f);
- break;
- case OPCODE_EVAL_C2:
- printf("EVAL_C2 %f %f\n", n[1].f, n[2].f);
- break;
- case OPCODE_EVAL_P1:
- printf("EVAL_P1 %d\n", n[1].i);
- break;
- case OPCODE_EVAL_P2:
- printf("EVAL_P2 %d %d\n", n[1].i, n[2].i);
- break;
-
- case OPCODE_PROVOKING_VERTEX:
- printf("ProvokingVertex %s\n",
- _mesa_lookup_enum_by_nr(n[1].ui));
- break;
-
- /*
- * meta opcodes/commands
- */
- case OPCODE_ERROR:
- printf("Error: %s %s\n",
- enum_string(n[1].e), (const char *) n[2].data);
- break;
- case OPCODE_CONTINUE:
- printf("DISPLAY-LIST-CONTINUE\n");
- n = (Node *) n[1].next;
- break;
- case OPCODE_END_OF_LIST:
- printf("END-LIST %u\n", list);
- done = GL_TRUE;
- break;
- default:
- if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
- printf
- ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
- opcode, (void *) n);
- return;
- }
- else {
- printf("command %d, %u operands\n", opcode,
- InstSize[opcode]);
- }
- }
- /* increment n to point to next compiled command */
- if (opcode != OPCODE_CONTINUE) {
- n += InstSize[opcode];
- }
- }
- }
-}
-
-
-
-/**
- * Clients may call this function to help debug display list problems.
- * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
- * changed, or break in the future without notice.
- */
-void
-mesa_print_display_list(GLuint list)
-{
- GET_CURRENT_CONTEXT(ctx);
- print_list(ctx, list);
-}
-
-
-/**********************************************************************/
-/***** Initialization *****/
-/**********************************************************************/
-
-void
-_mesa_save_vtxfmt_init(GLvertexformat * vfmt)
-{
- _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
-
- vfmt->Begin = save_Begin;
-
- _MESA_INIT_DLIST_VTXFMT(vfmt, save_);
-
- vfmt->Color3f = save_Color3f;
- vfmt->Color3fv = save_Color3fv;
- vfmt->Color4f = save_Color4f;
- vfmt->Color4fv = save_Color4fv;
- vfmt->EdgeFlag = save_EdgeFlag;
- vfmt->End = save_End;
-
- _MESA_INIT_EVAL_VTXFMT(vfmt, save_);
-
- vfmt->FogCoordfEXT = save_FogCoordfEXT;
- vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
- vfmt->Indexf = save_Indexf;
- vfmt->Indexfv = save_Indexfv;
- vfmt->Materialfv = save_Materialfv;
- vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
- vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
- vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
- vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
- vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
- vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
- vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
- vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
- vfmt->Normal3f = save_Normal3f;
- vfmt->Normal3fv = save_Normal3fv;
- vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
- vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
- vfmt->TexCoord1f = save_TexCoord1f;
- vfmt->TexCoord1fv = save_TexCoord1fv;
- vfmt->TexCoord2f = save_TexCoord2f;
- vfmt->TexCoord2fv = save_TexCoord2fv;
- vfmt->TexCoord3f = save_TexCoord3f;
- vfmt->TexCoord3fv = save_TexCoord3fv;
- vfmt->TexCoord4f = save_TexCoord4f;
- vfmt->TexCoord4fv = save_TexCoord4fv;
- vfmt->Vertex2f = save_Vertex2f;
- vfmt->Vertex2fv = save_Vertex2fv;
- vfmt->Vertex3f = save_Vertex3f;
- vfmt->Vertex3fv = save_Vertex3fv;
- vfmt->Vertex4f = save_Vertex4f;
- vfmt->Vertex4fv = save_Vertex4fv;
- vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV;
- vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV;
- vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV;
- vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV;
- vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV;
- vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV;
- vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV;
- vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV;
- vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
- vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
- vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
- vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
- vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
- vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
- vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
- vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
-
- vfmt->Rectf = save_Rectf;
-
- /* The driver is required to implement these as
- * 1) They can probably do a better job.
- * 2) A lot of new mechanisms would have to be added to this module
- * to support it. That code would probably never get used,
- * because of (1).
- */
-#if 0
- vfmt->DrawArrays = 0;
- vfmt->DrawElements = 0;
- vfmt->DrawRangeElements = 0;
- vfmt->MultiDrawElemementsEXT = 0;
- vfmt->DrawElementsBaseVertex = 0;
- vfmt->DrawRangeElementsBaseVertex = 0;
- vfmt->MultiDrawElemementsBaseVertex = 0;
-#endif
-}
-
-
-void
-_mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
- const GLvertexformat *vfmt)
-{
- SET_CallList(disp, vfmt->CallList);
- SET_CallLists(disp, vfmt->CallLists);
-}
-
-
-void _mesa_init_dlist_dispatch(struct _glapi_table *disp)
-{
- SET_CallList(disp, _mesa_CallList);
- SET_CallLists(disp, _mesa_CallLists);
-
- SET_DeleteLists(disp, _mesa_DeleteLists);
- SET_EndList(disp, _mesa_EndList);
- SET_GenLists(disp, _mesa_GenLists);
- SET_IsList(disp, _mesa_IsList);
- SET_ListBase(disp, _mesa_ListBase);
- SET_NewList(disp, _mesa_NewList);
-}
-
-
-#endif /* FEATURE_dlist */
-
-
-/**
- * Initialize display list state for given context.
- */
-void
-_mesa_init_display_list(struct gl_context *ctx)
-{
- static GLboolean tableInitialized = GL_FALSE;
-
- /* zero-out the instruction size table, just once */
- if (!tableInitialized) {
- memset(InstSize, 0, sizeof(InstSize));
- tableInitialized = GL_TRUE;
- }
-
- /* extension info */
- ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
-
- /* Display list */
- ctx->ListState.CallDepth = 0;
- ctx->ExecuteFlag = GL_TRUE;
- ctx->CompileFlag = GL_FALSE;
- ctx->ListState.CurrentBlock = NULL;
- ctx->ListState.CurrentPos = 0;
-
- /* Display List group */
- ctx->List.ListBase = 0;
-
-#if FEATURE_dlist
- _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
-#endif
-}
-
-
-void
-_mesa_free_display_list_data(struct gl_context *ctx)
-{
- free(ctx->ListExt);
- ctx->ListExt = NULL;
-}
diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h
deleted file mode 100644
index 24241a4..0000000
--- a/src/mesa/main/dlist.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * \file dlist.h
- * Display lists management.
- */
-
-/*
- * 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 DLIST_H
-#define DLIST_H
-
-
-#include "main/mtypes.h"
-
-
-#if FEATURE_dlist
-
-#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) \
- do { \
- (vfmt)->CallList = impl ## CallList; \
- (vfmt)->CallLists = impl ## CallLists; \
- } while (0)
-
-extern void GLAPIENTRY _mesa_CallList( GLuint list );
-
-extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists );
-
-
-extern void _mesa_compile_error( struct gl_context *ctx, GLenum error, const char *s );
-
-extern void *_mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint sz);
-
-extern GLint _mesa_dlist_alloc_opcode( struct gl_context *ctx, GLuint sz,
- void (*execute)( struct gl_context *, void * ),
- void (*destroy)( struct gl_context *, void * ),
- void (*print)( struct gl_context *, void * ) );
-
-extern void _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist);
-
-extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt );
-
-extern struct _glapi_table *_mesa_create_save_table(void);
-
-extern void _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
- const GLvertexformat *vfmt);
-
-extern void _mesa_init_dlist_dispatch(struct _glapi_table *disp);
-
-#else /* FEATURE_dlist */
-
-#include "main/compiler.h"
-
-#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) do { } while (0)
-
-static INLINE void
-_mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
-{
- /* there should be no list to delete */
- ASSERT_NO_FEATURE();
-}
-
-static INLINE void
-_mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
- const GLvertexformat *vfmt)
-{
-}
-
-static INLINE void
-_mesa_init_dlist_dispatch(struct _glapi_table *disp)
-{
-}
-
-#endif /* FEATURE_dlist */
-
-extern void _mesa_init_display_list( struct gl_context * ctx );
-
-extern void _mesa_free_display_list_data(struct gl_context *ctx);
-
-
-#endif /* DLIST_H */
diff --git a/src/mesa/main/dlopen.c b/src/mesa/main/dlopen.c
deleted file mode 100644
index 57a3329..0000000
--- a/src/mesa/main/dlopen.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * 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.
- */
-
-
-/**
- * Wrapper functions for dlopen(), dlsym(), dlclose().
- * Note that the #ifdef tests for various environments should be expanded.
- */
-
-
-#include "compiler.h"
-#include "dlopen.h"
-
-#if defined(_GNU_SOURCE) && !defined(__MINGW32__) && !defined(__blrts)
-#include <dlfcn.h>
-#endif
-#if defined(_WIN32)
-#include <windows.h>
-#endif
-
-
-/**
- * Wrapper for dlopen().
- * Note that 'flags' isn't used at this time.
- */
-void *
-_mesa_dlopen(const char *libname, int flags)
-{
-#if defined(__blrts)
- return NULL;
-#elif defined(_GNU_SOURCE)
- flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */
- return dlopen(libname, flags);
-#elif defined(__MINGW32__)
- return LoadLibraryA(libname);
-#else
- return NULL;
-#endif
-}
-
-
-/**
- * Wrapper for dlsym() that does a cast to a generic function type,
- * rather than a void *. This reduces the number of warnings that are
- * generated.
- */
-GenericFunc
-_mesa_dlsym(void *handle, const char *fname)
-{
- union {
- void *v;
- GenericFunc f;
- } u;
-#if defined(__blrts)
- u.v = NULL;
-#elif defined(__DJGPP__)
- /* need '_' prefix on symbol names */
- char fname2[1000];
- fname2[0] = '_';
- strncpy(fname2 + 1, fname, 998);
- fname2[999] = 0;
- u.v = dlsym(handle, fname2);
-#elif defined(_GNU_SOURCE)
- u.v = dlsym(handle, fname);
-#elif defined(__MINGW32__)
- u.v = (void *) GetProcAddress(handle, fname);
-#else
- u.v = NULL;
-#endif
- return u.f;
-}
-
-
-/**
- * Wrapper for dlclose().
- */
-void
-_mesa_dlclose(void *handle)
-{
-#if defined(__blrts)
- (void) handle;
-#elif defined(_GNU_SOURCE)
- dlclose(handle);
-#elif defined(__MINGW32__)
- FreeLibrary(handle);
-#else
- (void) handle;
-#endif
-}
-
-
-
diff --git a/src/mesa/main/dlopen.h b/src/mesa/main/dlopen.h
deleted file mode 100644
index 9895a22..0000000
--- a/src/mesa/main/dlopen.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * 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 DLOPEN_H
-#define DLOPEN_H
-
-
-typedef void (*GenericFunc)(void);
-
-
-extern void *
-_mesa_dlopen(const char *libname, int flags);
-
-extern GenericFunc
-_mesa_dlsym(void *handle, const char *fname);
-
-extern void
-_mesa_dlclose(void *handle);
-
-
-#endif
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
deleted file mode 100644
index a038a95..0000000
--- a/src/mesa/main/enable.c
+++ /dev/null
@@ -1,1491 +0,0 @@
-/**
- * \file enable.c
- * Enable/disable/query GL capabilities.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 7.0.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.
- */
-
-
-#include "glheader.h"
-#include "context.h"
-#include "enable.h"
-#include "light.h"
-#include "simple_list.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "api_arrayelt.h"
-#include "texstate.h"
-
-
-
-#define CHECK_EXTENSION(EXTNAME, CAP) \
- if (!ctx->Extensions.EXTNAME) { \
- goto invalid_enum_error; \
- }
-
-
-/**
- * Helper to enable/disable client-side state.
- */
-static void
-client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
-{
- struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
- GLuint flag;
- GLboolean *var;
-
- switch (cap) {
- case GL_VERTEX_ARRAY:
- var = &arrayObj->Vertex.Enabled;
- flag = _NEW_ARRAY_VERTEX;
- break;
- case GL_NORMAL_ARRAY:
- var = &arrayObj->Normal.Enabled;
- flag = _NEW_ARRAY_NORMAL;
- break;
- case GL_COLOR_ARRAY:
- var = &arrayObj->Color.Enabled;
- flag = _NEW_ARRAY_COLOR0;
- break;
- case GL_INDEX_ARRAY:
- var = &arrayObj->Index.Enabled;
- flag = _NEW_ARRAY_INDEX;
- break;
- case GL_TEXTURE_COORD_ARRAY:
- var = &arrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled;
- flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture);
- break;
- case GL_EDGE_FLAG_ARRAY:
- var = &arrayObj->EdgeFlag.Enabled;
- flag = _NEW_ARRAY_EDGEFLAG;
- break;
- case GL_FOG_COORDINATE_ARRAY_EXT:
- var = &arrayObj->FogCoord.Enabled;
- flag = _NEW_ARRAY_FOGCOORD;
- break;
- case GL_SECONDARY_COLOR_ARRAY_EXT:
- var = &arrayObj->SecondaryColor.Enabled;
- flag = _NEW_ARRAY_COLOR1;
- break;
-
-#if FEATURE_point_size_array
- case GL_POINT_SIZE_ARRAY_OES:
- var = &arrayObj->PointSize.Enabled;
- flag = _NEW_ARRAY_POINT_SIZE;
- break;
-#endif
-
-#if FEATURE_NV_vertex_program
- case GL_VERTEX_ATTRIB_ARRAY0_NV:
- case GL_VERTEX_ATTRIB_ARRAY1_NV:
- case GL_VERTEX_ATTRIB_ARRAY2_NV:
- case GL_VERTEX_ATTRIB_ARRAY3_NV:
- case GL_VERTEX_ATTRIB_ARRAY4_NV:
- case GL_VERTEX_ATTRIB_ARRAY5_NV:
- case GL_VERTEX_ATTRIB_ARRAY6_NV:
- case GL_VERTEX_ATTRIB_ARRAY7_NV:
- case GL_VERTEX_ATTRIB_ARRAY8_NV:
- case GL_VERTEX_ATTRIB_ARRAY9_NV:
- case GL_VERTEX_ATTRIB_ARRAY10_NV:
- case GL_VERTEX_ATTRIB_ARRAY11_NV:
- case GL_VERTEX_ATTRIB_ARRAY12_NV:
- case GL_VERTEX_ATTRIB_ARRAY13_NV:
- case GL_VERTEX_ATTRIB_ARRAY14_NV:
- case GL_VERTEX_ATTRIB_ARRAY15_NV:
- CHECK_EXTENSION(NV_vertex_program, cap);
- {
- GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
- ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib));
- var = &arrayObj->VertexAttrib[n].Enabled;
- flag = _NEW_ARRAY_ATTRIB(n);
- }
- break;
-#endif /* FEATURE_NV_vertex_program */
-
- /* GL_NV_primitive_restart */
- case GL_PRIMITIVE_RESTART_NV:
- if (!ctx->Extensions.NV_primitive_restart) {
- goto invalid_enum_error;
- }
- var = &ctx->Array.PrimitiveRestart;
- flag = 0;
- break;
-
- default:
- goto invalid_enum_error;
- }
-
- if (*var == state)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_ARRAY);
- ctx->Array.NewState |= flag;
-
- _ae_invalidate_state(ctx, _NEW_ARRAY);
-
- *var = state;
-
- if (state)
- ctx->Array.ArrayObj->_Enabled |= flag;
- else
- ctx->Array.ArrayObj->_Enabled &= ~flag;
-
- 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);
-}
-
-
-/**
- * Enable GL capability.
- * \param cap state to enable/disable.
- *
- * Get's the current context, assures that we're outside glBegin()/glEnd() and
- * calls client_state().
- */
-void GLAPIENTRY
-_mesa_EnableClientState( GLenum cap )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
- client_state( ctx, cap, GL_TRUE );
-}
-
-
-/**
- * Disable GL capability.
- * \param cap state to enable/disable.
- *
- * Get's the current context, assures that we're outside glBegin()/glEnd() and
- * calls client_state().
- */
-void GLAPIENTRY
-_mesa_DisableClientState( GLenum cap )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
- client_state( ctx, cap, GL_FALSE );
-}
-
-
-#undef CHECK_EXTENSION
-#define CHECK_EXTENSION(EXTNAME, CAP) \
- if (!ctx->Extensions.EXTNAME) { \
- goto invalid_enum_error; \
- }
-
-#define CHECK_EXTENSION2(EXT1, EXT2, CAP) \
- if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \
- goto invalid_enum_error; \
- }
-
-
-
-/**
- * Return pointer to current texture unit for setting/getting coordinate
- * state.
- * Note that we'll set GL_INVALID_OPERATION if the active texture unit is
- * higher than the number of supported coordinate units. And we'll return NULL.
- */
-static struct gl_texture_unit *
-get_texcoord_unit(struct gl_context *ctx)
-{
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glEnable/Disable(texcoord unit)");
- return NULL;
- }
- else {
- return &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- }
-}
-
-
-/**
- * Helper function to enable or disable a texture target.
- * \param bit one of the TEXTURE_x_BIT values
- * \return GL_TRUE if state is changing or GL_FALSE if no change
- */
-static GLboolean
-enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit)
-{
- struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
- const GLbitfield newenabled = state
- ? (texUnit->Enabled | texBit) : (texUnit->Enabled & ~texBit);
-
- if (texUnit->Enabled == newenabled)
- return GL_FALSE;
-
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Enabled = newenabled;
- return GL_TRUE;
-}
-
-
-/**
- * Helper function to enable or disable state.
- *
- * \param ctx GL context.
- * \param cap the state to enable/disable
- * \param state whether to enable or disable the specified capability.
- *
- * Updates the current context and flushes the vertices as needed. For
- * capabilities associated with extensions it verifies that those extensions
- * are effectivly present before updating. Notifies the driver via
- * dd_function_table::Enable.
- */
-void
-_mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
-{
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "%s %s (newstate is %x)\n",
- state ? "glEnable" : "glDisable",
- _mesa_lookup_enum_by_nr(cap),
- ctx->NewState);
-
- switch (cap) {
- case GL_ALPHA_TEST:
- if (ctx->Color.AlphaEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_COLOR);
- ctx->Color.AlphaEnabled = state;
- break;
- case GL_AUTO_NORMAL:
- if (ctx->Eval.AutoNormal == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.AutoNormal = state;
- break;
- case GL_BLEND:
- {
- GLbitfield newEnabled = state * ((1 << ctx->Const.MaxDrawBuffers) - 1);
- if (newEnabled != ctx->Color.BlendEnabled) {
- FLUSH_VERTICES(ctx, _NEW_COLOR);
- ctx->Color.BlendEnabled = newEnabled;
- }
- }
- break;
-#if FEATURE_userclip
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- {
- const GLuint p = cap - GL_CLIP_PLANE0;
-
- if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == ((GLuint) state << p))
- return;
-
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
-
- if (state) {
- ctx->Transform.ClipPlanesEnabled |= (1 << p);
-
- if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top))
- _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
-
- /* This derived state also calculated in clip.c and
- * from _mesa_update_state() on changes to EyeUserPlane
- * and ctx->ProjectionMatrix respectively.
- */
- _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
- ctx->Transform.EyeUserPlane[p],
- ctx->ProjectionMatrixStack.Top->inv );
- }
- else {
- ctx->Transform.ClipPlanesEnabled &= ~(1 << p);
- }
- }
- break;
-#endif
- case GL_COLOR_MATERIAL:
- if (ctx->Light.ColorMaterialEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_LIGHT);
- FLUSH_CURRENT(ctx, 0);
- ctx->Light.ColorMaterialEnabled = state;
- if (state) {
- _mesa_update_color_material( ctx,
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
- }
- break;
- case GL_CULL_FACE:
- if (ctx->Polygon.CullFlag == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.CullFlag = state;
- break;
- case GL_DEPTH_TEST:
- if (ctx->Depth.Test == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
- ctx->Depth.Test = state;
- break;
- case GL_DITHER:
- if (ctx->NoDither) {
- state = GL_FALSE; /* MESA_NO_DITHER env var */
- }
- if (ctx->Color.DitherFlag == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_COLOR);
- ctx->Color.DitherFlag = state;
- break;
- case GL_FOG:
- if (ctx->Fog.Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_FOG);
- ctx->Fog.Enabled = state;
- break;
- case GL_LIGHT0:
- case GL_LIGHT1:
- case GL_LIGHT2:
- case GL_LIGHT3:
- case GL_LIGHT4:
- case GL_LIGHT5:
- case GL_LIGHT6:
- case GL_LIGHT7:
- if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_LIGHT);
- ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
- if (state) {
- insert_at_tail(&ctx->Light.EnabledList,
- &ctx->Light.Light[cap-GL_LIGHT0]);
- }
- else {
- remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]);
- }
- break;
- case GL_LIGHTING:
- if (ctx->Light.Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_LIGHT);
- ctx->Light.Enabled = state;
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
- ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
- else
- ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
- break;
- case GL_LINE_SMOOTH:
- if (ctx->Line.SmoothFlag == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_LINE);
- ctx->Line.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
- break;
- case GL_LINE_STIPPLE:
- if (ctx->Line.StippleFlag == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_LINE);
- ctx->Line.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
- break;
- case GL_INDEX_LOGIC_OP:
- if (ctx->Color.IndexLogicOpEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_COLOR);
- ctx->Color.IndexLogicOpEnabled = state;
- break;
- case GL_COLOR_LOGIC_OP:
- if (ctx->Color.ColorLogicOpEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_COLOR);
- ctx->Color.ColorLogicOpEnabled = state;
- break;
- case GL_MAP1_COLOR_4:
- if (ctx->Eval.Map1Color4 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1Color4 = state;
- break;
- case GL_MAP1_INDEX:
- if (ctx->Eval.Map1Index == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1Index = state;
- break;
- case GL_MAP1_NORMAL:
- if (ctx->Eval.Map1Normal == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1Normal = state;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- if (ctx->Eval.Map1TextureCoord1 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1TextureCoord1 = state;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- if (ctx->Eval.Map1TextureCoord2 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1TextureCoord2 = state;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- if (ctx->Eval.Map1TextureCoord3 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1TextureCoord3 = state;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- if (ctx->Eval.Map1TextureCoord4 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1TextureCoord4 = state;
- break;
- case GL_MAP1_VERTEX_3:
- if (ctx->Eval.Map1Vertex3 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1Vertex3 = state;
- break;
- case GL_MAP1_VERTEX_4:
- if (ctx->Eval.Map1Vertex4 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1Vertex4 = state;
- break;
- case GL_MAP2_COLOR_4:
- if (ctx->Eval.Map2Color4 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2Color4 = state;
- break;
- case GL_MAP2_INDEX:
- if (ctx->Eval.Map2Index == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2Index = state;
- break;
- case GL_MAP2_NORMAL:
- if (ctx->Eval.Map2Normal == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2Normal = state;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- if (ctx->Eval.Map2TextureCoord1 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2TextureCoord1 = state;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- if (ctx->Eval.Map2TextureCoord2 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2TextureCoord2 = state;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- if (ctx->Eval.Map2TextureCoord3 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2TextureCoord3 = state;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- if (ctx->Eval.Map2TextureCoord4 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2TextureCoord4 = state;
- break;
- case GL_MAP2_VERTEX_3:
- if (ctx->Eval.Map2Vertex3 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2Vertex3 = state;
- break;
- case GL_MAP2_VERTEX_4:
- if (ctx->Eval.Map2Vertex4 == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2Vertex4 = state;
- break;
- case GL_NORMALIZE:
- if (ctx->Transform.Normalize == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
- ctx->Transform.Normalize = state;
- break;
- case GL_POINT_SMOOTH:
- if (ctx->Point.SmoothFlag == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
- break;
- case GL_POLYGON_SMOOTH:
- if (ctx->Polygon.SmoothFlag == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
- break;
- case GL_POLYGON_STIPPLE:
- if (ctx->Polygon.StippleFlag == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
- break;
- case GL_POLYGON_OFFSET_POINT:
- if (ctx->Polygon.OffsetPoint == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.OffsetPoint = state;
- break;
- case GL_POLYGON_OFFSET_LINE:
- if (ctx->Polygon.OffsetLine == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.OffsetLine = state;
- break;
- case GL_POLYGON_OFFSET_FILL:
- /*case GL_POLYGON_OFFSET_EXT:*/
- if (ctx->Polygon.OffsetFill == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.OffsetFill = state;
- break;
- case GL_RESCALE_NORMAL_EXT:
- if (ctx->Transform.RescaleNormals == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
- ctx->Transform.RescaleNormals = state;
- break;
- case GL_SCISSOR_TEST:
- if (ctx->Scissor.Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_SCISSOR);
- ctx->Scissor.Enabled = state;
- break;
- case GL_SHARED_TEXTURE_PALETTE_EXT:
- if (ctx->Texture.SharedPalette == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- ctx->Texture.SharedPalette = state;
- break;
- case GL_STENCIL_TEST:
- if (ctx->Stencil.Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.Enabled = state;
- break;
- case GL_TEXTURE_1D:
- if (!enable_texture(ctx, state, TEXTURE_1D_BIT)) {
- return;
- }
- break;
- case GL_TEXTURE_2D:
- if (!enable_texture(ctx, state, TEXTURE_2D_BIT)) {
- return;
- }
- break;
- case GL_TEXTURE_3D:
- if (!enable_texture(ctx, state, TEXTURE_3D_BIT)) {
- return;
- }
- break;
- case GL_TEXTURE_GEN_Q:
- {
- struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (texUnit) {
- GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT;
- if (state)
- newenabled |= Q_BIT;
- if (texUnit->TexGenEnabled == newenabled)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->TexGenEnabled = newenabled;
- }
- }
- break;
- case GL_TEXTURE_GEN_R:
- {
- struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (texUnit) {
- GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT;
- if (state)
- newenabled |= R_BIT;
- if (texUnit->TexGenEnabled == newenabled)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->TexGenEnabled = newenabled;
- }
- }
- break;
- case GL_TEXTURE_GEN_S:
- {
- struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (texUnit) {
- GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT;
- if (state)
- newenabled |= S_BIT;
- if (texUnit->TexGenEnabled == newenabled)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->TexGenEnabled = newenabled;
- }
- }
- break;
- case GL_TEXTURE_GEN_T:
- {
- struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (texUnit) {
- GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT;
- if (state)
- newenabled |= T_BIT;
- if (texUnit->TexGenEnabled == newenabled)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->TexGenEnabled = newenabled;
- }
- }
- 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!!!
- */
- case GL_VERTEX_ARRAY:
- case GL_NORMAL_ARRAY:
- case GL_COLOR_ARRAY:
- case GL_INDEX_ARRAY:
- case GL_TEXTURE_COORD_ARRAY:
- case GL_EDGE_FLAG_ARRAY:
- case GL_FOG_COORDINATE_ARRAY_EXT:
- case GL_SECONDARY_COLOR_ARRAY_EXT:
- case GL_POINT_SIZE_ARRAY_OES:
- client_state( ctx, cap, state );
- return;
-
- /* GL_SGI_texture_color_table */
- case GL_TEXTURE_COLOR_TABLE_SGI:
- CHECK_EXTENSION(SGI_texture_color_table, cap);
- if (ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled = state;
- break;
-
- /* GL_ARB_texture_cube_map */
- case GL_TEXTURE_CUBE_MAP_ARB:
- CHECK_EXTENSION(ARB_texture_cube_map, cap);
- if (!enable_texture(ctx, state, TEXTURE_CUBE_BIT)) {
- return;
- }
- break;
-
- /* GL_EXT_secondary_color */
- case GL_COLOR_SUM_EXT:
- CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program, cap);
- if (ctx->Fog.ColorSumEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_FOG);
- ctx->Fog.ColorSumEnabled = state;
- break;
-
- /* GL_ARB_multisample */
- case GL_MULTISAMPLE_ARB:
- if (ctx->Multisample.Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
- ctx->Multisample.Enabled = state;
- break;
- case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
- if (ctx->Multisample.SampleAlphaToCoverage == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
- ctx->Multisample.SampleAlphaToCoverage = state;
- break;
- case GL_SAMPLE_ALPHA_TO_ONE_ARB:
- if (ctx->Multisample.SampleAlphaToOne == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
- ctx->Multisample.SampleAlphaToOne = state;
- break;
- case GL_SAMPLE_COVERAGE_ARB:
- if (ctx->Multisample.SampleCoverage == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
- ctx->Multisample.SampleCoverage = state;
- break;
- case GL_SAMPLE_COVERAGE_INVERT_ARB:
- if (ctx->Multisample.SampleCoverageInvert == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
- ctx->Multisample.SampleCoverageInvert = state;
- break;
-
- /* GL_IBM_rasterpos_clip */
- case GL_RASTER_POSITION_UNCLIPPED_IBM:
- CHECK_EXTENSION(IBM_rasterpos_clip, cap);
- if (ctx->Transform.RasterPositionUnclipped == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
- ctx->Transform.RasterPositionUnclipped = state;
- break;
-
- /* GL_NV_point_sprite */
- case GL_POINT_SPRITE_NV:
- CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite, cap);
- if (ctx->Point.PointSprite == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.PointSprite = state;
- break;
-
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
- case GL_VERTEX_PROGRAM_ARB:
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap);
- if (ctx->VertexProgram.Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
- ctx->VertexProgram.Enabled = state;
- break;
- case GL_VERTEX_PROGRAM_POINT_SIZE_ARB:
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap);
- if (ctx->VertexProgram.PointSizeEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
- ctx->VertexProgram.PointSizeEnabled = state;
- break;
- case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap);
- if (ctx->VertexProgram.TwoSideEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
- ctx->VertexProgram.TwoSideEnabled = state;
- break;
-#endif
-#if FEATURE_NV_vertex_program
- case GL_MAP1_VERTEX_ATTRIB0_4_NV:
- case GL_MAP1_VERTEX_ATTRIB1_4_NV:
- case GL_MAP1_VERTEX_ATTRIB2_4_NV:
- case GL_MAP1_VERTEX_ATTRIB3_4_NV:
- case GL_MAP1_VERTEX_ATTRIB4_4_NV:
- case GL_MAP1_VERTEX_ATTRIB5_4_NV:
- case GL_MAP1_VERTEX_ATTRIB6_4_NV:
- case GL_MAP1_VERTEX_ATTRIB7_4_NV:
- case GL_MAP1_VERTEX_ATTRIB8_4_NV:
- case GL_MAP1_VERTEX_ATTRIB9_4_NV:
- case GL_MAP1_VERTEX_ATTRIB10_4_NV:
- case GL_MAP1_VERTEX_ATTRIB11_4_NV:
- case GL_MAP1_VERTEX_ATTRIB12_4_NV:
- case GL_MAP1_VERTEX_ATTRIB13_4_NV:
- case GL_MAP1_VERTEX_ATTRIB14_4_NV:
- case GL_MAP1_VERTEX_ATTRIB15_4_NV:
- CHECK_EXTENSION(NV_vertex_program, cap);
- {
- const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1Attrib[map] = state;
- }
- break;
- case GL_MAP2_VERTEX_ATTRIB0_4_NV:
- case GL_MAP2_VERTEX_ATTRIB1_4_NV:
- case GL_MAP2_VERTEX_ATTRIB2_4_NV:
- case GL_MAP2_VERTEX_ATTRIB3_4_NV:
- case GL_MAP2_VERTEX_ATTRIB4_4_NV:
- case GL_MAP2_VERTEX_ATTRIB5_4_NV:
- case GL_MAP2_VERTEX_ATTRIB6_4_NV:
- case GL_MAP2_VERTEX_ATTRIB7_4_NV:
- case GL_MAP2_VERTEX_ATTRIB8_4_NV:
- case GL_MAP2_VERTEX_ATTRIB9_4_NV:
- case GL_MAP2_VERTEX_ATTRIB10_4_NV:
- case GL_MAP2_VERTEX_ATTRIB11_4_NV:
- case GL_MAP2_VERTEX_ATTRIB12_4_NV:
- case GL_MAP2_VERTEX_ATTRIB13_4_NV:
- case GL_MAP2_VERTEX_ATTRIB14_4_NV:
- case GL_MAP2_VERTEX_ATTRIB15_4_NV:
- CHECK_EXTENSION(NV_vertex_program, cap);
- {
- const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2Attrib[map] = state;
- }
- break;
-#endif /* FEATURE_NV_vertex_program */
-
-#if FEATURE_NV_fragment_program
- case GL_FRAGMENT_PROGRAM_NV:
- CHECK_EXTENSION(NV_fragment_program, cap);
- if (ctx->FragmentProgram.Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
- ctx->FragmentProgram.Enabled = state;
- break;
-#endif /* FEATURE_NV_fragment_program */
-
- /* GL_NV_texture_rectangle */
- case GL_TEXTURE_RECTANGLE_NV:
- CHECK_EXTENSION(NV_texture_rectangle, cap);
- if (!enable_texture(ctx, state, TEXTURE_RECT_BIT)) {
- return;
- }
- break;
-
- /* GL_EXT_stencil_two_side */
- case GL_STENCIL_TEST_TWO_SIDE_EXT:
- CHECK_EXTENSION(EXT_stencil_two_side, cap);
- if (ctx->Stencil.TestTwoSide == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.TestTwoSide = state;
- if (state) {
- ctx->Stencil._BackFace = 2;
- ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
- } else {
- ctx->Stencil._BackFace = 1;
- ctx->_TriangleCaps &= ~DD_TRI_TWOSTENCIL;
- }
- break;
-
-#if FEATURE_ARB_fragment_program
- case GL_FRAGMENT_PROGRAM_ARB:
- CHECK_EXTENSION(ARB_fragment_program, cap);
- if (ctx->FragmentProgram.Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
- ctx->FragmentProgram.Enabled = state;
- break;
-#endif /* FEATURE_ARB_fragment_program */
-
- /* GL_EXT_depth_bounds_test */
- case GL_DEPTH_BOUNDS_TEST_EXT:
- CHECK_EXTENSION(EXT_depth_bounds_test, cap);
- if (ctx->Depth.BoundsTest == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
- ctx->Depth.BoundsTest = state;
- break;
-
- case GL_DEPTH_CLAMP:
- if (ctx->Transform.DepthClamp == state)
- return;
- CHECK_EXTENSION(ARB_depth_clamp, cap);
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
- ctx->Transform.DepthClamp = state;
- break;
-
-#if FEATURE_ATI_fragment_shader
- case GL_FRAGMENT_SHADER_ATI:
- CHECK_EXTENSION(ATI_fragment_shader, cap);
- if (ctx->ATIFragmentShader.Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
- ctx->ATIFragmentShader.Enabled = state;
- break;
-#endif
-
- /* GL_MESA_texture_array */
- case GL_TEXTURE_1D_ARRAY_EXT:
- CHECK_EXTENSION(MESA_texture_array, cap);
- if (!enable_texture(ctx, state, TEXTURE_1D_ARRAY_BIT)) {
- return;
- }
- break;
-
- case GL_TEXTURE_2D_ARRAY_EXT:
- CHECK_EXTENSION(MESA_texture_array, cap);
- if (!enable_texture(ctx, state, TEXTURE_2D_ARRAY_BIT)) {
- return;
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP_SEAMLESS:
- CHECK_EXTENSION(ARB_seamless_cube_map, cap);
- 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. Note: this enum is different from
- * GL_PRIMITIVE_RESTART_NV (which is client state).
- */
- 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:
- 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);
-}
-
-
-/**
- * Enable GL capability. Called by glEnable()
- * \param cap state to enable.
- */
-void GLAPIENTRY
-_mesa_Enable( GLenum cap )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- _mesa_set_enable( ctx, cap, GL_TRUE );
-}
-
-
-/**
- * Disable GL capability. Called by glDisable()
- * \param cap state to disable.
- */
-void GLAPIENTRY
-_mesa_Disable( GLenum cap )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- _mesa_set_enable( ctx, cap, GL_FALSE );
-}
-
-
-
-/**
- * Enable/disable an indexed state var.
- */
-void
-_mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state)
-{
- ASSERT(state == 0 || state == 1);
- switch (cap) {
- case GL_BLEND:
- if (!ctx->Extensions.EXT_draw_buffers2) {
- goto invalid_enum_error;
- }
- if (index >= ctx->Const.MaxDrawBuffers) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)",
- state ? "glEnableIndexed" : "glDisableIndexed", index);
- return;
- }
- if (((ctx->Color.BlendEnabled >> index) & 1) != state) {
- FLUSH_VERTICES(ctx, _NEW_COLOR);
- if (state)
- ctx->Color.BlendEnabled |= (1 << index);
- else
- ctx->Color.BlendEnabled &= ~(1 << index);
- }
- break;
- default:
- goto invalid_enum_error;
- }
- return;
-
-invalid_enum_error:
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(cap=%s)",
- state ? "glEnablei" : "glDisablei",
- _mesa_lookup_enum_by_nr(cap));
-}
-
-
-void GLAPIENTRY
-_mesa_DisableIndexed( GLenum cap, GLuint index )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
- _mesa_set_enablei(ctx, cap, index, GL_FALSE);
-}
-
-
-void GLAPIENTRY
-_mesa_EnableIndexed( GLenum cap, GLuint index )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
- _mesa_set_enablei(ctx, cap, index, GL_TRUE);
-}
-
-
-GLboolean GLAPIENTRY
-_mesa_IsEnabledIndexed( GLenum cap, GLuint index )
-{
- GET_CURRENT_CONTEXT(ctx);
- switch (cap) {
- case GL_BLEND:
- if (index >= ctx->Const.MaxDrawBuffers) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glIsEnabledIndexed(index=%u)",
- index);
- return GL_FALSE;
- }
- return (ctx->Color.BlendEnabled >> index) & 1;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabledIndexed(cap=%s)",
- _mesa_lookup_enum_by_nr(cap));
- return GL_FALSE;
- }
-}
-
-
-
-
-#undef CHECK_EXTENSION
-#define CHECK_EXTENSION(EXTNAME) \
- if (!ctx->Extensions.EXTNAME) { \
- goto invalid_enum_error; \
- }
-
-#undef CHECK_EXTENSION2
-#define CHECK_EXTENSION2(EXT1, EXT2) \
- if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \
- goto invalid_enum_error; \
- }
-
-
-/**
- * Helper function to determine whether a texture target is enabled.
- */
-static GLboolean
-is_texture_enabled(struct gl_context *ctx, GLbitfield bit)
-{
- const struct gl_texture_unit *const texUnit =
- &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- return (texUnit->Enabled & bit) ? GL_TRUE : GL_FALSE;
-}
-
-
-/**
- * Return simple enable/disable state.
- *
- * \param cap state variable to query.
- *
- * Returns the state of the specified capability from the current GL context.
- * For the capabilities associated with extensions verifies that those
- * extensions are effectively present before reporting.
- */
-GLboolean GLAPIENTRY
-_mesa_IsEnabled( GLenum cap )
-{
- GET_CURRENT_CONTEXT(ctx);
- switch (cap) {
- case GL_ALPHA_TEST:
- return ctx->Color.AlphaEnabled;
- case GL_AUTO_NORMAL:
- return ctx->Eval.AutoNormal;
- case GL_BLEND:
- return ctx->Color.BlendEnabled & 1; /* return state for buffer[0] */
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1;
- case GL_COLOR_MATERIAL:
- return ctx->Light.ColorMaterialEnabled;
- case GL_CULL_FACE:
- return ctx->Polygon.CullFlag;
- case GL_DEPTH_TEST:
- return ctx->Depth.Test;
- case GL_DITHER:
- return ctx->Color.DitherFlag;
- case GL_FOG:
- return ctx->Fog.Enabled;
- case GL_LIGHTING:
- return ctx->Light.Enabled;
- case GL_LIGHT0:
- case GL_LIGHT1:
- case GL_LIGHT2:
- case GL_LIGHT3:
- case GL_LIGHT4:
- case GL_LIGHT5:
- case GL_LIGHT6:
- case GL_LIGHT7:
- return ctx->Light.Light[cap-GL_LIGHT0].Enabled;
- case GL_LINE_SMOOTH:
- return ctx->Line.SmoothFlag;
- case GL_LINE_STIPPLE:
- return ctx->Line.StippleFlag;
- case GL_INDEX_LOGIC_OP:
- return ctx->Color.IndexLogicOpEnabled;
- case GL_COLOR_LOGIC_OP:
- return ctx->Color.ColorLogicOpEnabled;
- case GL_MAP1_COLOR_4:
- return ctx->Eval.Map1Color4;
- case GL_MAP1_INDEX:
- return ctx->Eval.Map1Index;
- case GL_MAP1_NORMAL:
- return ctx->Eval.Map1Normal;
- case GL_MAP1_TEXTURE_COORD_1:
- return ctx->Eval.Map1TextureCoord1;
- case GL_MAP1_TEXTURE_COORD_2:
- return ctx->Eval.Map1TextureCoord2;
- case GL_MAP1_TEXTURE_COORD_3:
- return ctx->Eval.Map1TextureCoord3;
- case GL_MAP1_TEXTURE_COORD_4:
- return ctx->Eval.Map1TextureCoord4;
- case GL_MAP1_VERTEX_3:
- return ctx->Eval.Map1Vertex3;
- case GL_MAP1_VERTEX_4:
- return ctx->Eval.Map1Vertex4;
- case GL_MAP2_COLOR_4:
- return ctx->Eval.Map2Color4;
- case GL_MAP2_INDEX:
- return ctx->Eval.Map2Index;
- case GL_MAP2_NORMAL:
- return ctx->Eval.Map2Normal;
- case GL_MAP2_TEXTURE_COORD_1:
- return ctx->Eval.Map2TextureCoord1;
- case GL_MAP2_TEXTURE_COORD_2:
- return ctx->Eval.Map2TextureCoord2;
- case GL_MAP2_TEXTURE_COORD_3:
- return ctx->Eval.Map2TextureCoord3;
- case GL_MAP2_TEXTURE_COORD_4:
- return ctx->Eval.Map2TextureCoord4;
- case GL_MAP2_VERTEX_3:
- return ctx->Eval.Map2Vertex3;
- case GL_MAP2_VERTEX_4:
- return ctx->Eval.Map2Vertex4;
- case GL_NORMALIZE:
- return ctx->Transform.Normalize;
- case GL_POINT_SMOOTH:
- return ctx->Point.SmoothFlag;
- case GL_POLYGON_SMOOTH:
- return ctx->Polygon.SmoothFlag;
- case GL_POLYGON_STIPPLE:
- return ctx->Polygon.StippleFlag;
- case GL_POLYGON_OFFSET_POINT:
- return ctx->Polygon.OffsetPoint;
- case GL_POLYGON_OFFSET_LINE:
- return ctx->Polygon.OffsetLine;
- case GL_POLYGON_OFFSET_FILL:
- /*case GL_POLYGON_OFFSET_EXT:*/
- return ctx->Polygon.OffsetFill;
- case GL_RESCALE_NORMAL_EXT:
- return ctx->Transform.RescaleNormals;
- case GL_SCISSOR_TEST:
- return ctx->Scissor.Enabled;
- case GL_SHARED_TEXTURE_PALETTE_EXT:
- return ctx->Texture.SharedPalette;
- case GL_STENCIL_TEST:
- return ctx->Stencil.Enabled;
- case GL_TEXTURE_1D:
- return is_texture_enabled(ctx, TEXTURE_1D_BIT);
- case GL_TEXTURE_2D:
- return is_texture_enabled(ctx, TEXTURE_2D_BIT);
- case GL_TEXTURE_3D:
- return is_texture_enabled(ctx, TEXTURE_3D_BIT);
- case GL_TEXTURE_GEN_Q:
- {
- const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (texUnit) {
- return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE;
- }
- }
- return GL_FALSE;
- case GL_TEXTURE_GEN_R:
- {
- const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (texUnit) {
- return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE;
- }
- }
- return GL_FALSE;
- case GL_TEXTURE_GEN_S:
- {
- const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (texUnit) {
- return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE;
- }
- }
- return GL_FALSE;
- case GL_TEXTURE_GEN_T:
- {
- const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (texUnit) {
- return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE;
- }
- }
- 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!!!
- */
- case GL_VERTEX_ARRAY:
- return (ctx->Array.ArrayObj->Vertex.Enabled != 0);
- case GL_NORMAL_ARRAY:
- return (ctx->Array.ArrayObj->Normal.Enabled != 0);
- case GL_COLOR_ARRAY:
- return (ctx->Array.ArrayObj->Color.Enabled != 0);
- case GL_INDEX_ARRAY:
- return (ctx->Array.ArrayObj->Index.Enabled != 0);
- case GL_TEXTURE_COORD_ARRAY:
- return (ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled != 0);
- case GL_EDGE_FLAG_ARRAY:
- return (ctx->Array.ArrayObj->EdgeFlag.Enabled != 0);
- case GL_FOG_COORDINATE_ARRAY_EXT:
- CHECK_EXTENSION(EXT_fog_coord);
- return (ctx->Array.ArrayObj->FogCoord.Enabled != 0);
- case GL_SECONDARY_COLOR_ARRAY_EXT:
- CHECK_EXTENSION(EXT_secondary_color);
- return (ctx->Array.ArrayObj->SecondaryColor.Enabled != 0);
-#if FEATURE_point_size_array
- case GL_POINT_SIZE_ARRAY_OES:
- return (ctx->Array.ArrayObj->PointSize.Enabled != 0);
-#endif
-
- /* GL_SGI_texture_color_table */
- case GL_TEXTURE_COLOR_TABLE_SGI:
- CHECK_EXTENSION(SGI_texture_color_table);
- return ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled;
-
- /* GL_ARB_texture_cube_map */
- case GL_TEXTURE_CUBE_MAP_ARB:
- CHECK_EXTENSION(ARB_texture_cube_map);
- return is_texture_enabled(ctx, TEXTURE_CUBE_BIT);
-
- /* GL_EXT_secondary_color */
- case GL_COLOR_SUM_EXT:
- CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program);
- return ctx->Fog.ColorSumEnabled;
-
- /* GL_ARB_multisample */
- case GL_MULTISAMPLE_ARB:
- return ctx->Multisample.Enabled;
- case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
- return ctx->Multisample.SampleAlphaToCoverage;
- case GL_SAMPLE_ALPHA_TO_ONE_ARB:
- return ctx->Multisample.SampleAlphaToOne;
- case GL_SAMPLE_COVERAGE_ARB:
- return ctx->Multisample.SampleCoverage;
- case GL_SAMPLE_COVERAGE_INVERT_ARB:
- return ctx->Multisample.SampleCoverageInvert;
-
- /* GL_IBM_rasterpos_clip */
- case GL_RASTER_POSITION_UNCLIPPED_IBM:
- CHECK_EXTENSION(IBM_rasterpos_clip);
- return ctx->Transform.RasterPositionUnclipped;
-
- /* GL_NV_point_sprite */
- case GL_POINT_SPRITE_NV:
- CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite)
- return ctx->Point.PointSprite;
-
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
- case GL_VERTEX_PROGRAM_ARB:
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
- return ctx->VertexProgram.Enabled;
- case GL_VERTEX_PROGRAM_POINT_SIZE_ARB:
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
- return ctx->VertexProgram.PointSizeEnabled;
- case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
- return ctx->VertexProgram.TwoSideEnabled;
-#endif
-#if FEATURE_NV_vertex_program
- case GL_VERTEX_ATTRIB_ARRAY0_NV:
- case GL_VERTEX_ATTRIB_ARRAY1_NV:
- case GL_VERTEX_ATTRIB_ARRAY2_NV:
- case GL_VERTEX_ATTRIB_ARRAY3_NV:
- case GL_VERTEX_ATTRIB_ARRAY4_NV:
- case GL_VERTEX_ATTRIB_ARRAY5_NV:
- case GL_VERTEX_ATTRIB_ARRAY6_NV:
- case GL_VERTEX_ATTRIB_ARRAY7_NV:
- case GL_VERTEX_ATTRIB_ARRAY8_NV:
- case GL_VERTEX_ATTRIB_ARRAY9_NV:
- case GL_VERTEX_ATTRIB_ARRAY10_NV:
- case GL_VERTEX_ATTRIB_ARRAY11_NV:
- case GL_VERTEX_ATTRIB_ARRAY12_NV:
- case GL_VERTEX_ATTRIB_ARRAY13_NV:
- case GL_VERTEX_ATTRIB_ARRAY14_NV:
- case GL_VERTEX_ATTRIB_ARRAY15_NV:
- CHECK_EXTENSION(NV_vertex_program);
- {
- GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
- ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib));
- return (ctx->Array.ArrayObj->VertexAttrib[n].Enabled != 0);
- }
- case GL_MAP1_VERTEX_ATTRIB0_4_NV:
- case GL_MAP1_VERTEX_ATTRIB1_4_NV:
- case GL_MAP1_VERTEX_ATTRIB2_4_NV:
- case GL_MAP1_VERTEX_ATTRIB3_4_NV:
- case GL_MAP1_VERTEX_ATTRIB4_4_NV:
- case GL_MAP1_VERTEX_ATTRIB5_4_NV:
- case GL_MAP1_VERTEX_ATTRIB6_4_NV:
- case GL_MAP1_VERTEX_ATTRIB7_4_NV:
- case GL_MAP1_VERTEX_ATTRIB8_4_NV:
- case GL_MAP1_VERTEX_ATTRIB9_4_NV:
- case GL_MAP1_VERTEX_ATTRIB10_4_NV:
- case GL_MAP1_VERTEX_ATTRIB11_4_NV:
- case GL_MAP1_VERTEX_ATTRIB12_4_NV:
- case GL_MAP1_VERTEX_ATTRIB13_4_NV:
- case GL_MAP1_VERTEX_ATTRIB14_4_NV:
- case GL_MAP1_VERTEX_ATTRIB15_4_NV:
- CHECK_EXTENSION(NV_vertex_program);
- {
- const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
- return ctx->Eval.Map1Attrib[map];
- }
- case GL_MAP2_VERTEX_ATTRIB0_4_NV:
- case GL_MAP2_VERTEX_ATTRIB1_4_NV:
- case GL_MAP2_VERTEX_ATTRIB2_4_NV:
- case GL_MAP2_VERTEX_ATTRIB3_4_NV:
- case GL_MAP2_VERTEX_ATTRIB4_4_NV:
- case GL_MAP2_VERTEX_ATTRIB5_4_NV:
- case GL_MAP2_VERTEX_ATTRIB6_4_NV:
- case GL_MAP2_VERTEX_ATTRIB7_4_NV:
- case GL_MAP2_VERTEX_ATTRIB8_4_NV:
- case GL_MAP2_VERTEX_ATTRIB9_4_NV:
- case GL_MAP2_VERTEX_ATTRIB10_4_NV:
- case GL_MAP2_VERTEX_ATTRIB11_4_NV:
- case GL_MAP2_VERTEX_ATTRIB12_4_NV:
- case GL_MAP2_VERTEX_ATTRIB13_4_NV:
- case GL_MAP2_VERTEX_ATTRIB14_4_NV:
- case GL_MAP2_VERTEX_ATTRIB15_4_NV:
- CHECK_EXTENSION(NV_vertex_program);
- {
- const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
- return ctx->Eval.Map2Attrib[map];
- }
-#endif /* FEATURE_NV_vertex_program */
-
-#if FEATURE_NV_fragment_program
- case GL_FRAGMENT_PROGRAM_NV:
- CHECK_EXTENSION(NV_fragment_program);
- return ctx->FragmentProgram.Enabled;
-#endif /* FEATURE_NV_fragment_program */
-
- /* GL_NV_texture_rectangle */
- case GL_TEXTURE_RECTANGLE_NV:
- CHECK_EXTENSION(NV_texture_rectangle);
- return is_texture_enabled(ctx, TEXTURE_RECT_BIT);
-
- /* GL_EXT_stencil_two_side */
- case GL_STENCIL_TEST_TWO_SIDE_EXT:
- CHECK_EXTENSION(EXT_stencil_two_side);
- return ctx->Stencil.TestTwoSide;
-
-#if FEATURE_ARB_fragment_program
- case GL_FRAGMENT_PROGRAM_ARB:
- return ctx->FragmentProgram.Enabled;
-#endif /* FEATURE_ARB_fragment_program */
-
- /* GL_EXT_depth_bounds_test */
- case GL_DEPTH_BOUNDS_TEST_EXT:
- CHECK_EXTENSION(EXT_depth_bounds_test);
- return ctx->Depth.BoundsTest;
-
- /* GL_ARB_depth_clamp */
- case GL_DEPTH_CLAMP:
- CHECK_EXTENSION(ARB_depth_clamp);
- return ctx->Transform.DepthClamp;
-
-#if FEATURE_ATI_fragment_shader
- case GL_FRAGMENT_SHADER_ATI:
- CHECK_EXTENSION(ATI_fragment_shader);
- return ctx->ATIFragmentShader.Enabled;
-#endif /* FEATURE_ATI_fragment_shader */
-
- case GL_TEXTURE_CUBE_MAP_SEAMLESS:
- 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_NV_primitive_restart */
- case GL_PRIMITIVE_RESTART_NV:
- if (!ctx->Extensions.NV_primitive_restart) {
- goto invalid_enum_error;
- }
- return ctx->Array.PrimitiveRestart;
-
- /* 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:
- 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/src/mesa/main/enable.h b/src/mesa/main/enable.h
deleted file mode 100644
index 6d90c17..0000000
--- a/src/mesa/main/enable.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * \file enable.h
- * Enable/disable/query GL capabilities.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * Copyright (C) 1999-2001 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 ENABLE_H
-#define ENABLE_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-
-extern void
-_mesa_set_enable( struct gl_context* ctx, GLenum cap, GLboolean state );
-
-extern void GLAPIENTRY
-_mesa_Disable( GLenum cap );
-
-extern void GLAPIENTRY
-_mesa_Enable( GLenum cap );
-
-extern GLboolean GLAPIENTRY
-_mesa_IsEnabled( GLenum cap );
-
-extern void
-_mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state);
-
-extern void GLAPIENTRY
-_mesa_DisableIndexed( GLenum cap, GLuint index );
-
-extern void GLAPIENTRY
-_mesa_EnableIndexed( GLenum cap, GLuint index );
-
-extern GLboolean GLAPIENTRY
-_mesa_IsEnabledIndexed( GLenum cap, GLuint index );
-
-extern void GLAPIENTRY
-_mesa_EnableClientState( GLenum cap );
-
-extern void GLAPIENTRY
-_mesa_DisableClientState( GLenum cap );
-
-
-#endif
diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c
deleted file mode 100644
index 0ce62c0..0000000
--- a/src/mesa/main/enums.c
+++ /dev/null
@@ -1,6280 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by gl_enums.py (from Mesa) script */
-
-/*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
- * 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,
- * 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 "main/glheader.h"
-#include "main/mfeatures.h"
-#include "main/enums.h"
-#include "main/imports.h"
-
-typedef struct {
- size_t offset;
- int n;
-} enum_elt;
-
-LONGSTRING static const char enum_string_table[] =
- "GL_2D\0"
- "GL_2_BYTES\0"
- "GL_3D\0"
- "GL_3D_COLOR\0"
- "GL_3D_COLOR_TEXTURE\0"
- "GL_3_BYTES\0"
- "GL_4D_COLOR_TEXTURE\0"
- "GL_4_BYTES\0"
- "GL_ACCUM\0"
- "GL_ACCUM_ALPHA_BITS\0"
- "GL_ACCUM_BLUE_BITS\0"
- "GL_ACCUM_BUFFER_BIT\0"
- "GL_ACCUM_CLEAR_VALUE\0"
- "GL_ACCUM_GREEN_BITS\0"
- "GL_ACCUM_RED_BITS\0"
- "GL_ACTIVE_ATTRIBUTES\0"
- "GL_ACTIVE_ATTRIBUTE_MAX_LENGTH\0"
- "GL_ACTIVE_PROGRAM_EXT\0"
- "GL_ACTIVE_STENCIL_FACE_EXT\0"
- "GL_ACTIVE_TEXTURE\0"
- "GL_ACTIVE_TEXTURE_ARB\0"
- "GL_ACTIVE_UNIFORMS\0"
- "GL_ACTIVE_UNIFORM_MAX_LENGTH\0"
- "GL_ACTIVE_VERTEX_UNITS_ARB\0"
- "GL_ADD\0"
- "GL_ADD_SIGNED\0"
- "GL_ADD_SIGNED_ARB\0"
- "GL_ADD_SIGNED_EXT\0"
- "GL_ALIASED_LINE_WIDTH_RANGE\0"
- "GL_ALIASED_POINT_SIZE_RANGE\0"
- "GL_ALL_ATTRIB_BITS\0"
- "GL_ALL_CLIENT_ATTRIB_BITS\0"
- "GL_ALPHA\0"
- "GL_ALPHA12\0"
- "GL_ALPHA12_EXT\0"
- "GL_ALPHA16\0"
- "GL_ALPHA16I_EXT\0"
- "GL_ALPHA16UI_EXT\0"
- "GL_ALPHA16_EXT\0"
- "GL_ALPHA32I_EXT\0"
- "GL_ALPHA32UI_EXT\0"
- "GL_ALPHA4\0"
- "GL_ALPHA4_EXT\0"
- "GL_ALPHA8\0"
- "GL_ALPHA8I_EXT\0"
- "GL_ALPHA8UI_EXT\0"
- "GL_ALPHA8_EXT\0"
- "GL_ALPHA_BIAS\0"
- "GL_ALPHA_BITS\0"
- "GL_ALPHA_INTEGER_EXT\0"
- "GL_ALPHA_SCALE\0"
- "GL_ALPHA_TEST\0"
- "GL_ALPHA_TEST_FUNC\0"
- "GL_ALPHA_TEST_REF\0"
- "GL_ALREADY_SIGNALED\0"
- "GL_ALWAYS\0"
- "GL_AMBIENT\0"
- "GL_AMBIENT_AND_DIFFUSE\0"
- "GL_AND\0"
- "GL_AND_INVERTED\0"
- "GL_AND_REVERSE\0"
- "GL_ARRAY_BUFFER\0"
- "GL_ARRAY_BUFFER_BINDING\0"
- "GL_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_ATTACHED_SHADERS\0"
- "GL_ATTRIB_ARRAY_POINTER_NV\0"
- "GL_ATTRIB_ARRAY_SIZE_NV\0"
- "GL_ATTRIB_ARRAY_STRIDE_NV\0"
- "GL_ATTRIB_ARRAY_TYPE_NV\0"
- "GL_ATTRIB_STACK_DEPTH\0"
- "GL_AUTO_NORMAL\0"
- "GL_AUX0\0"
- "GL_AUX1\0"
- "GL_AUX2\0"
- "GL_AUX3\0"
- "GL_AUX_BUFFERS\0"
- "GL_BACK\0"
- "GL_BACK_LEFT\0"
- "GL_BACK_RIGHT\0"
- "GL_BGR\0"
- "GL_BGRA\0"
- "GL_BGRA_EXT\0"
- "GL_BGRA_INTEGER\0"
- "GL_BGRA_INTEGER_EXT\0"
- "GL_BGR_INTEGER\0"
- "GL_BGR_INTEGER_EXT\0"
- "GL_BITMAP\0"
- "GL_BITMAP_TOKEN\0"
- "GL_BLEND\0"
- "GL_BLEND_COLOR\0"
- "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"
- "GL_BLUE_INTEGER\0"
- "GL_BLUE_INTEGER_EXT\0"
- "GL_BLUE_SCALE\0"
- "GL_BOOL\0"
- "GL_BOOL_ARB\0"
- "GL_BOOL_VEC2\0"
- "GL_BOOL_VEC2_ARB\0"
- "GL_BOOL_VEC3\0"
- "GL_BOOL_VEC3_ARB\0"
- "GL_BOOL_VEC4\0"
- "GL_BOOL_VEC4_ARB\0"
- "GL_BUFFER_ACCESS\0"
- "GL_BUFFER_ACCESS_ARB\0"
- "GL_BUFFER_ACCESS_FLAGS\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_LENGTH\0"
- "GL_BUFFER_MAP_OFFSET\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"
- "GL_BUFFER_SIZE_ARB\0"
- "GL_BUFFER_USAGE\0"
- "GL_BUFFER_USAGE_ARB\0"
- "GL_BUMP_ENVMAP_ATI\0"
- "GL_BUMP_NUM_TEX_UNITS_ATI\0"
- "GL_BUMP_ROT_MATRIX_ATI\0"
- "GL_BUMP_ROT_MATRIX_SIZE_ATI\0"
- "GL_BUMP_TARGET_ATI\0"
- "GL_BUMP_TEX_UNITS_ATI\0"
- "GL_BYTE\0"
- "GL_C3F_V3F\0"
- "GL_C4F_N3F_V3F\0"
- "GL_C4UB_V2F\0"
- "GL_C4UB_V3F\0"
- "GL_CCW\0"
- "GL_CLAMP\0"
- "GL_CLAMP_READ_COLOR\0"
- "GL_CLAMP_TO_BORDER\0"
- "GL_CLAMP_TO_BORDER_ARB\0"
- "GL_CLAMP_TO_BORDER_SGIS\0"
- "GL_CLAMP_TO_EDGE\0"
- "GL_CLAMP_TO_EDGE_SGIS\0"
- "GL_CLEAR\0"
- "GL_CLIENT_ACTIVE_TEXTURE\0"
- "GL_CLIENT_ACTIVE_TEXTURE_ARB\0"
- "GL_CLIENT_ALL_ATTRIB_BITS\0"
- "GL_CLIENT_ATTRIB_STACK_DEPTH\0"
- "GL_CLIENT_PIXEL_STORE_BIT\0"
- "GL_CLIENT_VERTEX_ARRAY_BIT\0"
- "GL_CLIP_DISTANCE0\0"
- "GL_CLIP_DISTANCE1\0"
- "GL_CLIP_DISTANCE2\0"
- "GL_CLIP_DISTANCE3\0"
- "GL_CLIP_DISTANCE4\0"
- "GL_CLIP_DISTANCE5\0"
- "GL_CLIP_DISTANCE6\0"
- "GL_CLIP_DISTANCE7\0"
- "GL_CLIP_PLANE0\0"
- "GL_CLIP_PLANE1\0"
- "GL_CLIP_PLANE2\0"
- "GL_CLIP_PLANE3\0"
- "GL_CLIP_PLANE4\0"
- "GL_CLIP_PLANE5\0"
- "GL_CLIP_VOLUME_CLIPPING_HINT_EXT\0"
- "GL_COEFF\0"
- "GL_COLOR\0"
- "GL_COLOR_ARRAY\0"
- "GL_COLOR_ARRAY_BUFFER_BINDING\0"
- "GL_COLOR_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_COLOR_ARRAY_POINTER\0"
- "GL_COLOR_ARRAY_SIZE\0"
- "GL_COLOR_ARRAY_STRIDE\0"
- "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"
- "GL_COLOR_ATTACHMENT11\0"
- "GL_COLOR_ATTACHMENT11_EXT\0"
- "GL_COLOR_ATTACHMENT12\0"
- "GL_COLOR_ATTACHMENT12_EXT\0"
- "GL_COLOR_ATTACHMENT13\0"
- "GL_COLOR_ATTACHMENT13_EXT\0"
- "GL_COLOR_ATTACHMENT14\0"
- "GL_COLOR_ATTACHMENT14_EXT\0"
- "GL_COLOR_ATTACHMENT15\0"
- "GL_COLOR_ATTACHMENT15_EXT\0"
- "GL_COLOR_ATTACHMENT1_EXT\0"
- "GL_COLOR_ATTACHMENT2\0"
- "GL_COLOR_ATTACHMENT2_EXT\0"
- "GL_COLOR_ATTACHMENT3\0"
- "GL_COLOR_ATTACHMENT3_EXT\0"
- "GL_COLOR_ATTACHMENT4\0"
- "GL_COLOR_ATTACHMENT4_EXT\0"
- "GL_COLOR_ATTACHMENT5\0"
- "GL_COLOR_ATTACHMENT5_EXT\0"
- "GL_COLOR_ATTACHMENT6\0"
- "GL_COLOR_ATTACHMENT6_EXT\0"
- "GL_COLOR_ATTACHMENT7\0"
- "GL_COLOR_ATTACHMENT7_EXT\0"
- "GL_COLOR_ATTACHMENT8\0"
- "GL_COLOR_ATTACHMENT8_EXT\0"
- "GL_COLOR_ATTACHMENT9\0"
- "GL_COLOR_ATTACHMENT9_EXT\0"
- "GL_COLOR_BUFFER_BIT\0"
- "GL_COLOR_CLEAR_VALUE\0"
- "GL_COLOR_INDEX\0"
- "GL_COLOR_INDEXES\0"
- "GL_COLOR_LOGIC_OP\0"
- "GL_COLOR_MATERIAL\0"
- "GL_COLOR_MATERIAL_FACE\0"
- "GL_COLOR_MATERIAL_PARAMETER\0"
- "GL_COLOR_MATRIX\0"
- "GL_COLOR_MATRIX_SGI\0"
- "GL_COLOR_MATRIX_STACK_DEPTH\0"
- "GL_COLOR_MATRIX_STACK_DEPTH_SGI\0"
- "GL_COLOR_SUM\0"
- "GL_COLOR_SUM_ARB\0"
- "GL_COLOR_TABLE\0"
- "GL_COLOR_TABLE_ALPHA_SIZE\0"
- "GL_COLOR_TABLE_ALPHA_SIZE_EXT\0"
- "GL_COLOR_TABLE_ALPHA_SIZE_SGI\0"
- "GL_COLOR_TABLE_BIAS\0"
- "GL_COLOR_TABLE_BIAS_SGI\0"
- "GL_COLOR_TABLE_BLUE_SIZE\0"
- "GL_COLOR_TABLE_BLUE_SIZE_EXT\0"
- "GL_COLOR_TABLE_BLUE_SIZE_SGI\0"
- "GL_COLOR_TABLE_FORMAT\0"
- "GL_COLOR_TABLE_FORMAT_EXT\0"
- "GL_COLOR_TABLE_FORMAT_SGI\0"
- "GL_COLOR_TABLE_GREEN_SIZE\0"
- "GL_COLOR_TABLE_GREEN_SIZE_EXT\0"
- "GL_COLOR_TABLE_GREEN_SIZE_SGI\0"
- "GL_COLOR_TABLE_INTENSITY_SIZE\0"
- "GL_COLOR_TABLE_INTENSITY_SIZE_EXT\0"
- "GL_COLOR_TABLE_INTENSITY_SIZE_SGI\0"
- "GL_COLOR_TABLE_LUMINANCE_SIZE\0"
- "GL_COLOR_TABLE_LUMINANCE_SIZE_EXT\0"
- "GL_COLOR_TABLE_LUMINANCE_SIZE_SGI\0"
- "GL_COLOR_TABLE_RED_SIZE\0"
- "GL_COLOR_TABLE_RED_SIZE_EXT\0"
- "GL_COLOR_TABLE_RED_SIZE_SGI\0"
- "GL_COLOR_TABLE_SCALE\0"
- "GL_COLOR_TABLE_SCALE_SGI\0"
- "GL_COLOR_TABLE_WIDTH\0"
- "GL_COLOR_TABLE_WIDTH_EXT\0"
- "GL_COLOR_TABLE_WIDTH_SGI\0"
- "GL_COLOR_WRITEMASK\0"
- "GL_COMBINE\0"
- "GL_COMBINE4\0"
- "GL_COMBINE_ALPHA\0"
- "GL_COMBINE_ALPHA_ARB\0"
- "GL_COMBINE_ALPHA_EXT\0"
- "GL_COMBINE_ARB\0"
- "GL_COMBINE_EXT\0"
- "GL_COMBINE_RGB\0"
- "GL_COMBINE_RGB_ARB\0"
- "GL_COMBINE_RGB_EXT\0"
- "GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT\0"
- "GL_COMPARE_REF_TO_TEXTURE\0"
- "GL_COMPARE_R_TO_TEXTURE\0"
- "GL_COMPARE_R_TO_TEXTURE_ARB\0"
- "GL_COMPILE\0"
- "GL_COMPILE_AND_EXECUTE\0"
- "GL_COMPILE_STATUS\0"
- "GL_COMPRESSED_ALPHA\0"
- "GL_COMPRESSED_ALPHA_ARB\0"
- "GL_COMPRESSED_INTENSITY\0"
- "GL_COMPRESSED_INTENSITY_ARB\0"
- "GL_COMPRESSED_LUMINANCE\0"
- "GL_COMPRESSED_LUMINANCE_ALPHA\0"
- "GL_COMPRESSED_LUMINANCE_ALPHA_ARB\0"
- "GL_COMPRESSED_LUMINANCE_ARB\0"
- "GL_COMPRESSED_RED\0"
- "GL_COMPRESSED_RG\0"
- "GL_COMPRESSED_RGB\0"
- "GL_COMPRESSED_RGBA\0"
- "GL_COMPRESSED_RGBA_ARB\0"
- "GL_COMPRESSED_RGBA_FXT1_3DFX\0"
- "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT\0"
- "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT\0"
- "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT\0"
- "GL_COMPRESSED_RGB_ARB\0"
- "GL_COMPRESSED_RGB_FXT1_3DFX\0"
- "GL_COMPRESSED_RGB_S3TC_DXT1_EXT\0"
- "GL_COMPRESSED_SLUMINANCE\0"
- "GL_COMPRESSED_SLUMINANCE_ALPHA\0"
- "GL_COMPRESSED_SRGB\0"
- "GL_COMPRESSED_SRGB_ALPHA\0"
- "GL_COMPRESSED_TEXTURE_FORMATS\0"
- "GL_CONDITION_SATISFIED\0"
- "GL_CONSTANT\0"
- "GL_CONSTANT_ALPHA\0"
- "GL_CONSTANT_ALPHA_EXT\0"
- "GL_CONSTANT_ARB\0"
- "GL_CONSTANT_ATTENUATION\0"
- "GL_CONSTANT_BORDER_HP\0"
- "GL_CONSTANT_COLOR\0"
- "GL_CONSTANT_COLOR_EXT\0"
- "GL_CONSTANT_EXT\0"
- "GL_CONTEXT_COMPATIBILITY_PROFILE_BIT\0"
- "GL_CONTEXT_CORE_PROFILE_BIT\0"
- "GL_CONTEXT_FLAGS\0"
- "GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT\0"
- "GL_CONTEXT_PROFILE_MASK\0"
- "GL_CONVOLUTION_1D\0"
- "GL_CONVOLUTION_2D\0"
- "GL_CONVOLUTION_BORDER_COLOR\0"
- "GL_CONVOLUTION_BORDER_COLOR_HP\0"
- "GL_CONVOLUTION_BORDER_MODE\0"
- "GL_CONVOLUTION_BORDER_MODE_EXT\0"
- "GL_CONVOLUTION_FILTER_BIAS\0"
- "GL_CONVOLUTION_FILTER_BIAS_EXT\0"
- "GL_CONVOLUTION_FILTER_SCALE\0"
- "GL_CONVOLUTION_FILTER_SCALE_EXT\0"
- "GL_CONVOLUTION_FORMAT\0"
- "GL_CONVOLUTION_FORMAT_EXT\0"
- "GL_CONVOLUTION_HEIGHT\0"
- "GL_CONVOLUTION_HEIGHT_EXT\0"
- "GL_CONVOLUTION_WIDTH\0"
- "GL_CONVOLUTION_WIDTH_EXT\0"
- "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"
- "GL_COPY_READ_BUFFER\0"
- "GL_COPY_WRITE_BUFFER\0"
- "GL_CULL_FACE\0"
- "GL_CULL_FACE_MODE\0"
- "GL_CULL_VERTEX_EXT\0"
- "GL_CULL_VERTEX_EYE_POSITION_EXT\0"
- "GL_CULL_VERTEX_OBJECT_POSITION_EXT\0"
- "GL_CURRENT_ATTRIB_NV\0"
- "GL_CURRENT_BIT\0"
- "GL_CURRENT_COLOR\0"
- "GL_CURRENT_FOG_COORD\0"
- "GL_CURRENT_FOG_COORDINATE\0"
- "GL_CURRENT_INDEX\0"
- "GL_CURRENT_MATRIX_ARB\0"
- "GL_CURRENT_MATRIX_INDEX_ARB\0"
- "GL_CURRENT_MATRIX_NV\0"
- "GL_CURRENT_MATRIX_STACK_DEPTH_ARB\0"
- "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"
- "GL_CURRENT_RASTER_COLOR\0"
- "GL_CURRENT_RASTER_DISTANCE\0"
- "GL_CURRENT_RASTER_INDEX\0"
- "GL_CURRENT_RASTER_POSITION\0"
- "GL_CURRENT_RASTER_POSITION_VALID\0"
- "GL_CURRENT_RASTER_SECONDARY_COLOR\0"
- "GL_CURRENT_RASTER_TEXTURE_COORDS\0"
- "GL_CURRENT_SECONDARY_COLOR\0"
- "GL_CURRENT_TEXTURE_COORDS\0"
- "GL_CURRENT_VERTEX_ATTRIB\0"
- "GL_CURRENT_VERTEX_ATTRIB_ARB\0"
- "GL_CURRENT_WEIGHT_ARB\0"
- "GL_CW\0"
- "GL_DEBUG_ASSERT_MESA\0"
- "GL_DEBUG_OBJECT_MESA\0"
- "GL_DEBUG_PRINT_MESA\0"
- "GL_DECAL\0"
- "GL_DECR\0"
- "GL_DECR_WRAP\0"
- "GL_DECR_WRAP_EXT\0"
- "GL_DELETE_STATUS\0"
- "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"
- "GL_DEPTH_BOUNDS_TEST_EXT\0"
- "GL_DEPTH_BUFFER\0"
- "GL_DEPTH_BUFFER_BIT\0"
- "GL_DEPTH_CLAMP\0"
- "GL_DEPTH_CLAMP_NV\0"
- "GL_DEPTH_CLEAR_VALUE\0"
- "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"
- "GL_DEPTH_SCALE\0"
- "GL_DEPTH_STENCIL\0"
- "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"
- "GL_DEPTH_TEXTURE_MODE\0"
- "GL_DEPTH_TEXTURE_MODE_ARB\0"
- "GL_DEPTH_WRITEMASK\0"
- "GL_DIFFUSE\0"
- "GL_DITHER\0"
- "GL_DOMAIN\0"
- "GL_DONT_CARE\0"
- "GL_DOT3_RGB\0"
- "GL_DOT3_RGBA\0"
- "GL_DOT3_RGBA_ARB\0"
- "GL_DOT3_RGBA_EXT\0"
- "GL_DOT3_RGB_ARB\0"
- "GL_DOT3_RGB_EXT\0"
- "GL_DOUBLE\0"
- "GL_DOUBLEBUFFER\0"
- "GL_DRAW_BUFFER\0"
- "GL_DRAW_BUFFER0\0"
- "GL_DRAW_BUFFER0_ARB\0"
- "GL_DRAW_BUFFER0_ATI\0"
- "GL_DRAW_BUFFER1\0"
- "GL_DRAW_BUFFER10\0"
- "GL_DRAW_BUFFER10_ARB\0"
- "GL_DRAW_BUFFER10_ATI\0"
- "GL_DRAW_BUFFER11\0"
- "GL_DRAW_BUFFER11_ARB\0"
- "GL_DRAW_BUFFER11_ATI\0"
- "GL_DRAW_BUFFER12\0"
- "GL_DRAW_BUFFER12_ARB\0"
- "GL_DRAW_BUFFER12_ATI\0"
- "GL_DRAW_BUFFER13\0"
- "GL_DRAW_BUFFER13_ARB\0"
- "GL_DRAW_BUFFER13_ATI\0"
- "GL_DRAW_BUFFER14\0"
- "GL_DRAW_BUFFER14_ARB\0"
- "GL_DRAW_BUFFER14_ATI\0"
- "GL_DRAW_BUFFER15\0"
- "GL_DRAW_BUFFER15_ARB\0"
- "GL_DRAW_BUFFER15_ATI\0"
- "GL_DRAW_BUFFER1_ARB\0"
- "GL_DRAW_BUFFER1_ATI\0"
- "GL_DRAW_BUFFER2\0"
- "GL_DRAW_BUFFER2_ARB\0"
- "GL_DRAW_BUFFER2_ATI\0"
- "GL_DRAW_BUFFER3\0"
- "GL_DRAW_BUFFER3_ARB\0"
- "GL_DRAW_BUFFER3_ATI\0"
- "GL_DRAW_BUFFER4\0"
- "GL_DRAW_BUFFER4_ARB\0"
- "GL_DRAW_BUFFER4_ATI\0"
- "GL_DRAW_BUFFER5\0"
- "GL_DRAW_BUFFER5_ARB\0"
- "GL_DRAW_BUFFER5_ATI\0"
- "GL_DRAW_BUFFER6\0"
- "GL_DRAW_BUFFER6_ARB\0"
- "GL_DRAW_BUFFER6_ATI\0"
- "GL_DRAW_BUFFER7\0"
- "GL_DRAW_BUFFER7_ARB\0"
- "GL_DRAW_BUFFER7_ATI\0"
- "GL_DRAW_BUFFER8\0"
- "GL_DRAW_BUFFER8_ARB\0"
- "GL_DRAW_BUFFER8_ATI\0"
- "GL_DRAW_BUFFER9\0"
- "GL_DRAW_BUFFER9_ARB\0"
- "GL_DRAW_BUFFER9_ATI\0"
- "GL_DRAW_FRAMEBUFFER\0"
- "GL_DRAW_FRAMEBUFFER_BINDING\0"
- "GL_DRAW_FRAMEBUFFER_BINDING_EXT\0"
- "GL_DRAW_FRAMEBUFFER_EXT\0"
- "GL_DRAW_PIXEL_TOKEN\0"
- "GL_DST_ALPHA\0"
- "GL_DST_COLOR\0"
- "GL_DU8DV8_ATI\0"
- "GL_DUDV_ATI\0"
- "GL_DYNAMIC_COPY\0"
- "GL_DYNAMIC_COPY_ARB\0"
- "GL_DYNAMIC_DRAW\0"
- "GL_DYNAMIC_DRAW_ARB\0"
- "GL_DYNAMIC_READ\0"
- "GL_DYNAMIC_READ_ARB\0"
- "GL_EDGE_FLAG\0"
- "GL_EDGE_FLAG_ARRAY\0"
- "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING\0"
- "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_EDGE_FLAG_ARRAY_POINTER\0"
- "GL_EDGE_FLAG_ARRAY_STRIDE\0"
- "GL_ELEMENT_ARRAY_BUFFER\0"
- "GL_ELEMENT_ARRAY_BUFFER_BINDING\0"
- "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_EMISSION\0"
- "GL_ENABLE_BIT\0"
- "GL_EQUAL\0"
- "GL_EQUIV\0"
- "GL_EVAL_BIT\0"
- "GL_EXP\0"
- "GL_EXP2\0"
- "GL_EXTENSIONS\0"
- "GL_EYE_LINEAR\0"
- "GL_EYE_PLANE\0"
- "GL_EYE_PLANE_ABSOLUTE_NV\0"
- "GL_EYE_RADIAL_NV\0"
- "GL_FALSE\0"
- "GL_FASTEST\0"
- "GL_FEEDBACK\0"
- "GL_FEEDBACK_BUFFER_POINTER\0"
- "GL_FEEDBACK_BUFFER_SIZE\0"
- "GL_FEEDBACK_BUFFER_TYPE\0"
- "GL_FILL\0"
- "GL_FIRST_VERTEX_CONVENTION\0"
- "GL_FIRST_VERTEX_CONVENTION_EXT\0"
- "GL_FIXED\0"
- "GL_FIXED_OES\0"
- "GL_FIXED_ONLY\0"
- "GL_FLAT\0"
- "GL_FLOAT\0"
- "GL_FLOAT_MAT2\0"
- "GL_FLOAT_MAT2_ARB\0"
- "GL_FLOAT_MAT2x3\0"
- "GL_FLOAT_MAT2x4\0"
- "GL_FLOAT_MAT3\0"
- "GL_FLOAT_MAT3_ARB\0"
- "GL_FLOAT_MAT3x2\0"
- "GL_FLOAT_MAT3x4\0"
- "GL_FLOAT_MAT4\0"
- "GL_FLOAT_MAT4_ARB\0"
- "GL_FLOAT_MAT4x2\0"
- "GL_FLOAT_MAT4x3\0"
- "GL_FLOAT_VEC2\0"
- "GL_FLOAT_VEC2_ARB\0"
- "GL_FLOAT_VEC3\0"
- "GL_FLOAT_VEC3_ARB\0"
- "GL_FLOAT_VEC4\0"
- "GL_FLOAT_VEC4_ARB\0"
- "GL_FOG\0"
- "GL_FOG_BIT\0"
- "GL_FOG_COLOR\0"
- "GL_FOG_COORD\0"
- "GL_FOG_COORDINATE\0"
- "GL_FOG_COORDINATE_ARRAY\0"
- "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING\0"
- "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_FOG_COORDINATE_ARRAY_POINTER\0"
- "GL_FOG_COORDINATE_ARRAY_STRIDE\0"
- "GL_FOG_COORDINATE_ARRAY_TYPE\0"
- "GL_FOG_COORDINATE_SOURCE\0"
- "GL_FOG_COORD_ARRAY\0"
- "GL_FOG_COORD_ARRAY_BUFFER_BINDING\0"
- "GL_FOG_COORD_ARRAY_POINTER\0"
- "GL_FOG_COORD_ARRAY_STRIDE\0"
- "GL_FOG_COORD_ARRAY_TYPE\0"
- "GL_FOG_COORD_SRC\0"
- "GL_FOG_DENSITY\0"
- "GL_FOG_DISTANCE_MODE_NV\0"
- "GL_FOG_END\0"
- "GL_FOG_HINT\0"
- "GL_FOG_INDEX\0"
- "GL_FOG_MODE\0"
- "GL_FOG_OFFSET_SGIX\0"
- "GL_FOG_OFFSET_VALUE_SGIX\0"
- "GL_FOG_START\0"
- "GL_FRAGMENT_DEPTH\0"
- "GL_FRAGMENT_PROGRAM_ARB\0"
- "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"
- "GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING\0"
- "GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE\0"
- "GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE\0"
- "GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE\0"
- "GL_FRAMEBUFFER_ATTACHMENT_LAYERED\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\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"
- "GL_FRONT_LEFT\0"
- "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\0"
- "GL_GEOMETRY_INPUT_TYPE_ARB\0"
- "GL_GEOMETRY_OUTPUT_TYPE\0"
- "GL_GEOMETRY_OUTPUT_TYPE_ARB\0"
- "GL_GEOMETRY_SHADER\0"
- "GL_GEOMETRY_SHADER_ARB\0"
- "GL_GEOMETRY_VERTICES_OUT\0"
- "GL_GEOMETRY_VERTICES_OUT_ARB\0"
- "GL_GEQUAL\0"
- "GL_GREATER\0"
- "GL_GREEN\0"
- "GL_GREEN_BIAS\0"
- "GL_GREEN_BITS\0"
- "GL_GREEN_INTEGER\0"
- "GL_GREEN_INTEGER_EXT\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"
- "GL_HISTOGRAM_ALPHA_SIZE_EXT\0"
- "GL_HISTOGRAM_BLUE_SIZE\0"
- "GL_HISTOGRAM_BLUE_SIZE_EXT\0"
- "GL_HISTOGRAM_EXT\0"
- "GL_HISTOGRAM_FORMAT\0"
- "GL_HISTOGRAM_FORMAT_EXT\0"
- "GL_HISTOGRAM_GREEN_SIZE\0"
- "GL_HISTOGRAM_GREEN_SIZE_EXT\0"
- "GL_HISTOGRAM_LUMINANCE_SIZE\0"
- "GL_HISTOGRAM_LUMINANCE_SIZE_EXT\0"
- "GL_HISTOGRAM_RED_SIZE\0"
- "GL_HISTOGRAM_RED_SIZE_EXT\0"
- "GL_HISTOGRAM_SINK\0"
- "GL_HISTOGRAM_SINK_EXT\0"
- "GL_HISTOGRAM_WIDTH\0"
- "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"
- "GL_INCR_WRAP_EXT\0"
- "GL_INDEX\0"
- "GL_INDEX_ARRAY\0"
- "GL_INDEX_ARRAY_BUFFER_BINDING\0"
- "GL_INDEX_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_INDEX_ARRAY_POINTER\0"
- "GL_INDEX_ARRAY_STRIDE\0"
- "GL_INDEX_ARRAY_TYPE\0"
- "GL_INDEX_BITS\0"
- "GL_INDEX_CLEAR_VALUE\0"
- "GL_INDEX_LOGIC_OP\0"
- "GL_INDEX_MODE\0"
- "GL_INDEX_OFFSET\0"
- "GL_INDEX_SHIFT\0"
- "GL_INDEX_WRITEMASK\0"
- "GL_INFO_LOG_LENGTH\0"
- "GL_INT\0"
- "GL_INTENSITY\0"
- "GL_INTENSITY12\0"
- "GL_INTENSITY12_EXT\0"
- "GL_INTENSITY16\0"
- "GL_INTENSITY16I_EXT\0"
- "GL_INTENSITY16UI_EXT\0"
- "GL_INTENSITY16_EXT\0"
- "GL_INTENSITY32I_EXT\0"
- "GL_INTENSITY32UI_EXT\0"
- "GL_INTENSITY4\0"
- "GL_INTENSITY4_EXT\0"
- "GL_INTENSITY8\0"
- "GL_INTENSITY8I_EXT\0"
- "GL_INTENSITY8UI_EXT\0"
- "GL_INTENSITY8_EXT\0"
- "GL_INTENSITY_EXT\0"
- "GL_INTERLEAVED_ATTRIBS\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_SAMPLER_1D\0"
- "GL_INT_SAMPLER_1D_ARRAY\0"
- "GL_INT_SAMPLER_1D_ARRAY_EXT\0"
- "GL_INT_SAMPLER_1D_EXT\0"
- "GL_INT_SAMPLER_2D\0"
- "GL_INT_SAMPLER_2D_ARRAY\0"
- "GL_INT_SAMPLER_2D_ARRAY_EXT\0"
- "GL_INT_SAMPLER_2D_EXT\0"
- "GL_INT_SAMPLER_2D_RECT\0"
- "GL_INT_SAMPLER_2D_RECT_EXT\0"
- "GL_INT_SAMPLER_3D\0"
- "GL_INT_SAMPLER_3D_EXT\0"
- "GL_INT_SAMPLER_BUFFER\0"
- "GL_INT_SAMPLER_BUFFER_EXT\0"
- "GL_INT_SAMPLER_CUBE\0"
- "GL_INT_SAMPLER_CUBE_EXT\0"
- "GL_INT_VEC2\0"
- "GL_INT_VEC2_ARB\0"
- "GL_INT_VEC3\0"
- "GL_INT_VEC3_ARB\0"
- "GL_INT_VEC4\0"
- "GL_INT_VEC4_ARB\0"
- "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"
- "GL_INVERSE_TRANSPOSE_NV\0"
- "GL_INVERT\0"
- "GL_KEEP\0"
- "GL_LAST_VERTEX_CONVENTION\0"
- "GL_LAST_VERTEX_CONVENTION_EXT\0"
- "GL_LEFT\0"
- "GL_LEQUAL\0"
- "GL_LESS\0"
- "GL_LIGHT0\0"
- "GL_LIGHT1\0"
- "GL_LIGHT2\0"
- "GL_LIGHT3\0"
- "GL_LIGHT4\0"
- "GL_LIGHT5\0"
- "GL_LIGHT6\0"
- "GL_LIGHT7\0"
- "GL_LIGHTING\0"
- "GL_LIGHTING_BIT\0"
- "GL_LIGHT_MODEL_AMBIENT\0"
- "GL_LIGHT_MODEL_COLOR_CONTROL\0"
- "GL_LIGHT_MODEL_COLOR_CONTROL_EXT\0"
- "GL_LIGHT_MODEL_LOCAL_VIEWER\0"
- "GL_LIGHT_MODEL_TWO_SIDE\0"
- "GL_LINE\0"
- "GL_LINEAR\0"
- "GL_LINEAR_ATTENUATION\0"
- "GL_LINEAR_CLIPMAP_LINEAR_SGIX\0"
- "GL_LINEAR_CLIPMAP_NEAREST_SGIX\0"
- "GL_LINEAR_MIPMAP_LINEAR\0"
- "GL_LINEAR_MIPMAP_NEAREST\0"
- "GL_LINES\0"
- "GL_LINES_ADJACENCY\0"
- "GL_LINES_ADJACENCY_ARB\0"
- "GL_LINE_BIT\0"
- "GL_LINE_LOOP\0"
- "GL_LINE_RESET_TOKEN\0"
- "GL_LINE_SMOOTH\0"
- "GL_LINE_SMOOTH_HINT\0"
- "GL_LINE_STIPPLE\0"
- "GL_LINE_STIPPLE_PATTERN\0"
- "GL_LINE_STIPPLE_REPEAT\0"
- "GL_LINE_STRIP\0"
- "GL_LINE_STRIP_ADJACENCY\0"
- "GL_LINE_STRIP_ADJACENCY_ARB\0"
- "GL_LINE_TOKEN\0"
- "GL_LINE_WIDTH\0"
- "GL_LINE_WIDTH_GRANULARITY\0"
- "GL_LINE_WIDTH_RANGE\0"
- "GL_LINK_STATUS\0"
- "GL_LIST_BASE\0"
- "GL_LIST_BIT\0"
- "GL_LIST_INDEX\0"
- "GL_LIST_MODE\0"
- "GL_LOAD\0"
- "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"
- "GL_LUMINANCE12_ALPHA12_EXT\0"
- "GL_LUMINANCE12_ALPHA4\0"
- "GL_LUMINANCE12_ALPHA4_EXT\0"
- "GL_LUMINANCE12_EXT\0"
- "GL_LUMINANCE16\0"
- "GL_LUMINANCE16I_EXT\0"
- "GL_LUMINANCE16UI_EXT\0"
- "GL_LUMINANCE16_ALPHA16\0"
- "GL_LUMINANCE16_ALPHA16_EXT\0"
- "GL_LUMINANCE16_EXT\0"
- "GL_LUMINANCE32I_EXT\0"
- "GL_LUMINANCE32UI_EXT\0"
- "GL_LUMINANCE4\0"
- "GL_LUMINANCE4_ALPHA4\0"
- "GL_LUMINANCE4_ALPHA4_EXT\0"
- "GL_LUMINANCE4_EXT\0"
- "GL_LUMINANCE6_ALPHA2\0"
- "GL_LUMINANCE6_ALPHA2_EXT\0"
- "GL_LUMINANCE8\0"
- "GL_LUMINANCE8I_EXT\0"
- "GL_LUMINANCE8UI_EXT\0"
- "GL_LUMINANCE8_ALPHA8\0"
- "GL_LUMINANCE8_ALPHA8_EXT\0"
- "GL_LUMINANCE8_EXT\0"
- "GL_LUMINANCE_ALPHA\0"
- "GL_LUMINANCE_ALPHA16I_EXT\0"
- "GL_LUMINANCE_ALPHA16UI_EXT\0"
- "GL_LUMINANCE_ALPHA32I_EXT\0"
- "GL_LUMINANCE_ALPHA32UI_EXT\0"
- "GL_LUMINANCE_ALPHA8I_EXT\0"
- "GL_LUMINANCE_ALPHA8UI_EXT\0"
- "GL_LUMINANCE_ALPHA_INTEGER_EXT\0"
- "GL_LUMINANCE_INTEGER_EXT\0"
- "GL_MAJOR_VERSION\0"
- "GL_MAP1_COLOR_4\0"
- "GL_MAP1_GRID_DOMAIN\0"
- "GL_MAP1_GRID_SEGMENTS\0"
- "GL_MAP1_INDEX\0"
- "GL_MAP1_NORMAL\0"
- "GL_MAP1_TEXTURE_COORD_1\0"
- "GL_MAP1_TEXTURE_COORD_2\0"
- "GL_MAP1_TEXTURE_COORD_3\0"
- "GL_MAP1_TEXTURE_COORD_4\0"
- "GL_MAP1_VERTEX_3\0"
- "GL_MAP1_VERTEX_4\0"
- "GL_MAP1_VERTEX_ATTRIB0_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB10_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB11_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB12_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB13_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB14_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB15_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB1_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB2_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB3_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB4_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB5_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB6_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB7_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB8_4_NV\0"
- "GL_MAP1_VERTEX_ATTRIB9_4_NV\0"
- "GL_MAP2_COLOR_4\0"
- "GL_MAP2_GRID_DOMAIN\0"
- "GL_MAP2_GRID_SEGMENTS\0"
- "GL_MAP2_INDEX\0"
- "GL_MAP2_NORMAL\0"
- "GL_MAP2_TEXTURE_COORD_1\0"
- "GL_MAP2_TEXTURE_COORD_2\0"
- "GL_MAP2_TEXTURE_COORD_3\0"
- "GL_MAP2_TEXTURE_COORD_4\0"
- "GL_MAP2_VERTEX_3\0"
- "GL_MAP2_VERTEX_4\0"
- "GL_MAP2_VERTEX_ATTRIB0_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB10_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB11_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB12_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB13_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB14_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB15_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB1_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB2_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB3_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB4_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB5_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB6_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB7_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB8_4_NV\0"
- "GL_MAP2_VERTEX_ATTRIB9_4_NV\0"
- "GL_MAP_COLOR\0"
- "GL_MAP_FLUSH_EXPLICIT_BIT\0"
- "GL_MAP_INVALIDATE_BUFFER_BIT\0"
- "GL_MAP_INVALIDATE_RANGE_BIT\0"
- "GL_MAP_READ_BIT\0"
- "GL_MAP_STENCIL\0"
- "GL_MAP_UNSYNCHRONIZED_BIT\0"
- "GL_MAP_WRITE_BIT\0"
- "GL_MATRIX0_ARB\0"
- "GL_MATRIX0_NV\0"
- "GL_MATRIX10_ARB\0"
- "GL_MATRIX11_ARB\0"
- "GL_MATRIX12_ARB\0"
- "GL_MATRIX13_ARB\0"
- "GL_MATRIX14_ARB\0"
- "GL_MATRIX15_ARB\0"
- "GL_MATRIX16_ARB\0"
- "GL_MATRIX17_ARB\0"
- "GL_MATRIX18_ARB\0"
- "GL_MATRIX19_ARB\0"
- "GL_MATRIX1_ARB\0"
- "GL_MATRIX1_NV\0"
- "GL_MATRIX20_ARB\0"
- "GL_MATRIX21_ARB\0"
- "GL_MATRIX22_ARB\0"
- "GL_MATRIX23_ARB\0"
- "GL_MATRIX24_ARB\0"
- "GL_MATRIX25_ARB\0"
- "GL_MATRIX26_ARB\0"
- "GL_MATRIX27_ARB\0"
- "GL_MATRIX28_ARB\0"
- "GL_MATRIX29_ARB\0"
- "GL_MATRIX2_ARB\0"
- "GL_MATRIX2_NV\0"
- "GL_MATRIX30_ARB\0"
- "GL_MATRIX31_ARB\0"
- "GL_MATRIX3_ARB\0"
- "GL_MATRIX3_NV\0"
- "GL_MATRIX4_ARB\0"
- "GL_MATRIX4_NV\0"
- "GL_MATRIX5_ARB\0"
- "GL_MATRIX5_NV\0"
- "GL_MATRIX6_ARB\0"
- "GL_MATRIX6_NV\0"
- "GL_MATRIX7_ARB\0"
- "GL_MATRIX7_NV\0"
- "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\0"
- "GL_MAX_ARRAY_TEXTURE_LAYERS_EXT\0"
- "GL_MAX_ATTRIB_STACK_DEPTH\0"
- "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH\0"
- "GL_MAX_CLIPMAP_DEPTH_SGIX\0"
- "GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX\0"
- "GL_MAX_CLIP_DISTANCES\0"
- "GL_MAX_CLIP_PLANES\0"
- "GL_MAX_COLOR_ATTACHMENTS\0"
- "GL_MAX_COLOR_ATTACHMENTS_EXT\0"
- "GL_MAX_COLOR_MATRIX_STACK_DEPTH\0"
- "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI\0"
- "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS\0"
- "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB\0"
- "GL_MAX_CONVOLUTION_HEIGHT\0"
- "GL_MAX_CONVOLUTION_HEIGHT_EXT\0"
- "GL_MAX_CONVOLUTION_WIDTH\0"
- "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"
- "GL_MAX_ELEMENTS_INDICES\0"
- "GL_MAX_ELEMENTS_VERTICES\0"
- "GL_MAX_EVAL_ORDER\0"
- "GL_MAX_EXT\0"
- "GL_MAX_FRAGMENT_INPUT_COMPONENTS\0"
- "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS\0"
- "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB\0"
- "GL_MAX_FRAGMENT_UNIFORM_VECTORS\0"
- "GL_MAX_GEOMETRY_INPUT_COMPONENTS\0"
- "GL_MAX_GEOMETRY_OUTPUT_COMPONENTS\0"
- "GL_MAX_GEOMETRY_OUTPUT_VERTICES\0"
- "GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB\0"
- "GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS\0"
- "GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB\0"
- "GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS\0"
- "GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB\0"
- "GL_MAX_GEOMETRY_UNIFORM_COMPONENTS\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"
- "GL_MAX_PROGRAM_ATTRIBS_ARB\0"
- "GL_MAX_PROGRAM_CALL_DEPTH_NV\0"
- "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB\0"
- "GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV\0"
- "GL_MAX_PROGRAM_IF_DEPTH_NV\0"
- "GL_MAX_PROGRAM_INSTRUCTIONS_ARB\0"
- "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB\0"
- "GL_MAX_PROGRAM_LOOP_COUNT_NV\0"
- "GL_MAX_PROGRAM_LOOP_DEPTH_NV\0"
- "GL_MAX_PROGRAM_MATRICES_ARB\0"
- "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB\0"
- "GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB\0"
- "GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB\0"
- "GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB\0"
- "GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB\0"
- "GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB\0"
- "GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB\0"
- "GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB\0"
- "GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB\0"
- "GL_MAX_PROGRAM_PARAMETERS_ARB\0"
- "GL_MAX_PROGRAM_TEMPORARIES_ARB\0"
- "GL_MAX_PROGRAM_TEXEL_OFFSET\0"
- "GL_MAX_PROGRAM_TEXEL_OFFSET_EXT\0"
- "GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB\0"
- "GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB\0"
- "GL_MAX_PROJECTION_STACK_DEPTH\0"
- "GL_MAX_RECTANGLE_TEXTURE_SIZE\0"
- "GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB\0"
- "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"
- "GL_MAX_SHININESS_NV\0"
- "GL_MAX_SPOT_EXPONENT_NV\0"
- "GL_MAX_TEXTURE_BUFFER_SIZE\0"
- "GL_MAX_TEXTURE_COORDS\0"
- "GL_MAX_TEXTURE_COORDS_ARB\0"
- "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"
- "GL_MAX_TEXTURE_UNITS\0"
- "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\0"
- "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT\0"
- "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS\0"
- "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT\0"
- "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS\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_OUTPUT_COMPONENTS\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"
- "GL_MINMAX_FORMAT\0"
- "GL_MINMAX_FORMAT_EXT\0"
- "GL_MINMAX_SINK\0"
- "GL_MINMAX_SINK_EXT\0"
- "GL_MINOR_VERSION\0"
- "GL_MIN_EXT\0"
- "GL_MIN_PROGRAM_TEXEL_OFFSET\0"
- "GL_MIN_PROGRAM_TEXEL_OFFSET_EXT\0"
- "GL_MIRRORED_REPEAT\0"
- "GL_MIRRORED_REPEAT_ARB\0"
- "GL_MIRRORED_REPEAT_IBM\0"
- "GL_MIRROR_CLAMP_ATI\0"
- "GL_MIRROR_CLAMP_EXT\0"
- "GL_MIRROR_CLAMP_TO_BORDER_EXT\0"
- "GL_MIRROR_CLAMP_TO_EDGE_ATI\0"
- "GL_MIRROR_CLAMP_TO_EDGE_EXT\0"
- "GL_MODELVIEW\0"
- "GL_MODELVIEW0_ARB\0"
- "GL_MODELVIEW10_ARB\0"
- "GL_MODELVIEW11_ARB\0"
- "GL_MODELVIEW12_ARB\0"
- "GL_MODELVIEW13_ARB\0"
- "GL_MODELVIEW14_ARB\0"
- "GL_MODELVIEW15_ARB\0"
- "GL_MODELVIEW16_ARB\0"
- "GL_MODELVIEW17_ARB\0"
- "GL_MODELVIEW18_ARB\0"
- "GL_MODELVIEW19_ARB\0"
- "GL_MODELVIEW1_ARB\0"
- "GL_MODELVIEW20_ARB\0"
- "GL_MODELVIEW21_ARB\0"
- "GL_MODELVIEW22_ARB\0"
- "GL_MODELVIEW23_ARB\0"
- "GL_MODELVIEW24_ARB\0"
- "GL_MODELVIEW25_ARB\0"
- "GL_MODELVIEW26_ARB\0"
- "GL_MODELVIEW27_ARB\0"
- "GL_MODELVIEW28_ARB\0"
- "GL_MODELVIEW29_ARB\0"
- "GL_MODELVIEW2_ARB\0"
- "GL_MODELVIEW30_ARB\0"
- "GL_MODELVIEW31_ARB\0"
- "GL_MODELVIEW3_ARB\0"
- "GL_MODELVIEW4_ARB\0"
- "GL_MODELVIEW5_ARB\0"
- "GL_MODELVIEW6_ARB\0"
- "GL_MODELVIEW7_ARB\0"
- "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"
- "GL_MODULATE_ADD_ATI\0"
- "GL_MODULATE_SIGNED_ADD_ATI\0"
- "GL_MODULATE_SUBTRACT_ATI\0"
- "GL_MULT\0"
- "GL_MULTISAMPLE\0"
- "GL_MULTISAMPLE_3DFX\0"
- "GL_MULTISAMPLE_ARB\0"
- "GL_MULTISAMPLE_BIT\0"
- "GL_MULTISAMPLE_BIT_3DFX\0"
- "GL_MULTISAMPLE_BIT_ARB\0"
- "GL_MULTISAMPLE_FILTER_HINT_NV\0"
- "GL_N3F_V3F\0"
- "GL_NAME_STACK_DEPTH\0"
- "GL_NAND\0"
- "GL_NEAREST\0"
- "GL_NEAREST_CLIPMAP_LINEAR_SGIX\0"
- "GL_NEAREST_CLIPMAP_NEAREST_SGIX\0"
- "GL_NEAREST_MIPMAP_LINEAR\0"
- "GL_NEAREST_MIPMAP_NEAREST\0"
- "GL_NEVER\0"
- "GL_NICEST\0"
- "GL_NONE\0"
- "GL_NONE_OES\0"
- "GL_NOOP\0"
- "GL_NOR\0"
- "GL_NORMALIZE\0"
- "GL_NORMAL_ARRAY\0"
- "GL_NORMAL_ARRAY_BUFFER_BINDING\0"
- "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_NORMAL_ARRAY_POINTER\0"
- "GL_NORMAL_ARRAY_STRIDE\0"
- "GL_NORMAL_ARRAY_TYPE\0"
- "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_EXTENSIONS\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"
- "GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB\0"
- "GL_OBJECT_ATTACHED_OBJECTS_ARB\0"
- "GL_OBJECT_COMPILE_STATUS_ARB\0"
- "GL_OBJECT_DELETE_STATUS_ARB\0"
- "GL_OBJECT_INFO_LOG_LENGTH_ARB\0"
- "GL_OBJECT_LINEAR\0"
- "GL_OBJECT_LINK_STATUS_ARB\0"
- "GL_OBJECT_PLANE\0"
- "GL_OBJECT_SHADER_SOURCE_LENGTH_ARB\0"
- "GL_OBJECT_SUBTYPE_ARB\0"
- "GL_OBJECT_TYPE\0"
- "GL_OBJECT_TYPE_ARB\0"
- "GL_OBJECT_VALIDATE_STATUS_ARB\0"
- "GL_OCCLUSION_TEST_HP\0"
- "GL_OCCLUSION_TEST_RESULT_HP\0"
- "GL_ONE\0"
- "GL_ONE_MINUS_CONSTANT_ALPHA\0"
- "GL_ONE_MINUS_CONSTANT_ALPHA_EXT\0"
- "GL_ONE_MINUS_CONSTANT_COLOR\0"
- "GL_ONE_MINUS_CONSTANT_COLOR_EXT\0"
- "GL_ONE_MINUS_DST_ALPHA\0"
- "GL_ONE_MINUS_DST_COLOR\0"
- "GL_ONE_MINUS_SRC_ALPHA\0"
- "GL_ONE_MINUS_SRC_COLOR\0"
- "GL_OPERAND0_ALPHA\0"
- "GL_OPERAND0_ALPHA_ARB\0"
- "GL_OPERAND0_ALPHA_EXT\0"
- "GL_OPERAND0_RGB\0"
- "GL_OPERAND0_RGB_ARB\0"
- "GL_OPERAND0_RGB_EXT\0"
- "GL_OPERAND1_ALPHA\0"
- "GL_OPERAND1_ALPHA_ARB\0"
- "GL_OPERAND1_ALPHA_EXT\0"
- "GL_OPERAND1_RGB\0"
- "GL_OPERAND1_RGB_ARB\0"
- "GL_OPERAND1_RGB_EXT\0"
- "GL_OPERAND2_ALPHA\0"
- "GL_OPERAND2_ALPHA_ARB\0"
- "GL_OPERAND2_ALPHA_EXT\0"
- "GL_OPERAND2_RGB\0"
- "GL_OPERAND2_RGB_ARB\0"
- "GL_OPERAND2_RGB_EXT\0"
- "GL_OPERAND3_ALPHA_NV\0"
- "GL_OPERAND3_RGB_NV\0"
- "GL_OR\0"
- "GL_ORDER\0"
- "GL_OR_INVERTED\0"
- "GL_OR_REVERSE\0"
- "GL_OUT_OF_MEMORY\0"
- "GL_PACK_ALIGNMENT\0"
- "GL_PACK_IMAGE_HEIGHT\0"
- "GL_PACK_INVERT_MESA\0"
- "GL_PACK_LSB_FIRST\0"
- "GL_PACK_ROW_LENGTH\0"
- "GL_PACK_SKIP_IMAGES\0"
- "GL_PACK_SKIP_PIXELS\0"
- "GL_PACK_SKIP_ROWS\0"
- "GL_PACK_SWAP_BYTES\0"
- "GL_PALETTE4_R5_G6_B5_OES\0"
- "GL_PALETTE4_RGB5_A1_OES\0"
- "GL_PALETTE4_RGB8_OES\0"
- "GL_PALETTE4_RGBA4_OES\0"
- "GL_PALETTE4_RGBA8_OES\0"
- "GL_PALETTE8_R5_G6_B5_OES\0"
- "GL_PALETTE8_RGB5_A1_OES\0"
- "GL_PALETTE8_RGB8_OES\0"
- "GL_PALETTE8_RGBA4_OES\0"
- "GL_PALETTE8_RGBA8_OES\0"
- "GL_PASS_THROUGH_TOKEN\0"
- "GL_PERSPECTIVE_CORRECTION_HINT\0"
- "GL_PIXEL_MAP_A_TO_A\0"
- "GL_PIXEL_MAP_A_TO_A_SIZE\0"
- "GL_PIXEL_MAP_B_TO_B\0"
- "GL_PIXEL_MAP_B_TO_B_SIZE\0"
- "GL_PIXEL_MAP_G_TO_G\0"
- "GL_PIXEL_MAP_G_TO_G_SIZE\0"
- "GL_PIXEL_MAP_I_TO_A\0"
- "GL_PIXEL_MAP_I_TO_A_SIZE\0"
- "GL_PIXEL_MAP_I_TO_B\0"
- "GL_PIXEL_MAP_I_TO_B_SIZE\0"
- "GL_PIXEL_MAP_I_TO_G\0"
- "GL_PIXEL_MAP_I_TO_G_SIZE\0"
- "GL_PIXEL_MAP_I_TO_I\0"
- "GL_PIXEL_MAP_I_TO_I_SIZE\0"
- "GL_PIXEL_MAP_I_TO_R\0"
- "GL_PIXEL_MAP_I_TO_R_SIZE\0"
- "GL_PIXEL_MAP_R_TO_R\0"
- "GL_PIXEL_MAP_R_TO_R_SIZE\0"
- "GL_PIXEL_MAP_S_TO_S\0"
- "GL_PIXEL_MAP_S_TO_S_SIZE\0"
- "GL_PIXEL_MODE_BIT\0"
- "GL_PIXEL_PACK_BUFFER\0"
- "GL_PIXEL_PACK_BUFFER_BINDING\0"
- "GL_PIXEL_PACK_BUFFER_BINDING_EXT\0"
- "GL_PIXEL_PACK_BUFFER_EXT\0"
- "GL_PIXEL_UNPACK_BUFFER\0"
- "GL_PIXEL_UNPACK_BUFFER_BINDING\0"
- "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT\0"
- "GL_PIXEL_UNPACK_BUFFER_EXT\0"
- "GL_POINT\0"
- "GL_POINTS\0"
- "GL_POINT_BIT\0"
- "GL_POINT_DISTANCE_ATTENUATION\0"
- "GL_POINT_DISTANCE_ATTENUATION_ARB\0"
- "GL_POINT_DISTANCE_ATTENUATION_EXT\0"
- "GL_POINT_DISTANCE_ATTENUATION_SGIS\0"
- "GL_POINT_FADE_THRESHOLD_SIZE\0"
- "GL_POINT_FADE_THRESHOLD_SIZE_ARB\0"
- "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"
- "GL_POINT_SIZE_MAX_EXT\0"
- "GL_POINT_SIZE_MAX_SGIS\0"
- "GL_POINT_SIZE_MIN\0"
- "GL_POINT_SIZE_MIN_ARB\0"
- "GL_POINT_SIZE_MIN_EXT\0"
- "GL_POINT_SIZE_MIN_SGIS\0"
- "GL_POINT_SIZE_RANGE\0"
- "GL_POINT_SMOOTH\0"
- "GL_POINT_SMOOTH_HINT\0"
- "GL_POINT_SPRITE\0"
- "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"
- "GL_POLYGON_BIT\0"
- "GL_POLYGON_MODE\0"
- "GL_POLYGON_OFFSET_BIAS\0"
- "GL_POLYGON_OFFSET_FACTOR\0"
- "GL_POLYGON_OFFSET_FILL\0"
- "GL_POLYGON_OFFSET_LINE\0"
- "GL_POLYGON_OFFSET_POINT\0"
- "GL_POLYGON_OFFSET_UNITS\0"
- "GL_POLYGON_SMOOTH\0"
- "GL_POLYGON_SMOOTH_HINT\0"
- "GL_POLYGON_STIPPLE\0"
- "GL_POLYGON_STIPPLE_BIT\0"
- "GL_POLYGON_TOKEN\0"
- "GL_POSITION\0"
- "GL_POST_COLOR_MATRIX_ALPHA_BIAS\0"
- "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI\0"
- "GL_POST_COLOR_MATRIX_ALPHA_SCALE\0"
- "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI\0"
- "GL_POST_COLOR_MATRIX_BLUE_BIAS\0"
- "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI\0"
- "GL_POST_COLOR_MATRIX_BLUE_SCALE\0"
- "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI\0"
- "GL_POST_COLOR_MATRIX_COLOR_TABLE\0"
- "GL_POST_COLOR_MATRIX_GREEN_BIAS\0"
- "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI\0"
- "GL_POST_COLOR_MATRIX_GREEN_SCALE\0"
- "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI\0"
- "GL_POST_COLOR_MATRIX_RED_BIAS\0"
- "GL_POST_COLOR_MATRIX_RED_BIAS_SGI\0"
- "GL_POST_COLOR_MATRIX_RED_SCALE\0"
- "GL_POST_COLOR_MATRIX_RED_SCALE_SGI\0"
- "GL_POST_CONVOLUTION_ALPHA_BIAS\0"
- "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT\0"
- "GL_POST_CONVOLUTION_ALPHA_SCALE\0"
- "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT\0"
- "GL_POST_CONVOLUTION_BLUE_BIAS\0"
- "GL_POST_CONVOLUTION_BLUE_BIAS_EXT\0"
- "GL_POST_CONVOLUTION_BLUE_SCALE\0"
- "GL_POST_CONVOLUTION_BLUE_SCALE_EXT\0"
- "GL_POST_CONVOLUTION_COLOR_TABLE\0"
- "GL_POST_CONVOLUTION_GREEN_BIAS\0"
- "GL_POST_CONVOLUTION_GREEN_BIAS_EXT\0"
- "GL_POST_CONVOLUTION_GREEN_SCALE\0"
- "GL_POST_CONVOLUTION_GREEN_SCALE_EXT\0"
- "GL_POST_CONVOLUTION_RED_BIAS\0"
- "GL_POST_CONVOLUTION_RED_BIAS_EXT\0"
- "GL_POST_CONVOLUTION_RED_SCALE\0"
- "GL_POST_CONVOLUTION_RED_SCALE_EXT\0"
- "GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX\0"
- "GL_POST_TEXTURE_FILTER_BIAS_SGIX\0"
- "GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX\0"
- "GL_POST_TEXTURE_FILTER_SCALE_SGIX\0"
- "GL_PREVIOUS\0"
- "GL_PREVIOUS_ARB\0"
- "GL_PREVIOUS_EXT\0"
- "GL_PRIMARY_COLOR\0"
- "GL_PRIMARY_COLOR_ARB\0"
- "GL_PRIMARY_COLOR_EXT\0"
- "GL_PRIMITIVES_GENERATED\0"
- "GL_PRIMITIVES_GENERATED_EXT\0"
- "GL_PRIMITIVE_RESTART\0"
- "GL_PRIMITIVE_RESTART_INDEX\0"
- "GL_PRIMITIVE_RESTART_INDEX_NV\0"
- "GL_PRIMITIVE_RESTART_NV\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"
- "GL_PROGRAM_ERROR_STRING_ARB\0"
- "GL_PROGRAM_FORMAT_ARB\0"
- "GL_PROGRAM_FORMAT_ASCII_ARB\0"
- "GL_PROGRAM_INSTRUCTIONS_ARB\0"
- "GL_PROGRAM_LENGTH_ARB\0"
- "GL_PROGRAM_LENGTH_NV\0"
- "GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB\0"
- "GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB\0"
- "GL_PROGRAM_NATIVE_ATTRIBS_ARB\0"
- "GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB\0"
- "GL_PROGRAM_NATIVE_PARAMETERS_ARB\0"
- "GL_PROGRAM_NATIVE_TEMPORARIES_ARB\0"
- "GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB\0"
- "GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB\0"
- "GL_PROGRAM_OBJECT_ARB\0"
- "GL_PROGRAM_PARAMETERS_ARB\0"
- "GL_PROGRAM_PARAMETER_NV\0"
- "GL_PROGRAM_POINT_SIZE\0"
- "GL_PROGRAM_POINT_SIZE_ARB\0"
- "GL_PROGRAM_RESIDENT_NV\0"
- "GL_PROGRAM_STRING_ARB\0"
- "GL_PROGRAM_STRING_NV\0"
- "GL_PROGRAM_TARGET_NV\0"
- "GL_PROGRAM_TEMPORARIES_ARB\0"
- "GL_PROGRAM_TEX_INDIRECTIONS_ARB\0"
- "GL_PROGRAM_TEX_INSTRUCTIONS_ARB\0"
- "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"
- "GL_PROXY_COLOR_TABLE\0"
- "GL_PROXY_HISTOGRAM\0"
- "GL_PROXY_HISTOGRAM_EXT\0"
- "GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE\0"
- "GL_PROXY_POST_CONVOLUTION_COLOR_TABLE\0"
- "GL_PROXY_TEXTURE_1D\0"
- "GL_PROXY_TEXTURE_1D_ARRAY\0"
- "GL_PROXY_TEXTURE_1D_ARRAY_EXT\0"
- "GL_PROXY_TEXTURE_1D_EXT\0"
- "GL_PROXY_TEXTURE_2D\0"
- "GL_PROXY_TEXTURE_2D_ARRAY\0"
- "GL_PROXY_TEXTURE_2D_ARRAY_EXT\0"
- "GL_PROXY_TEXTURE_2D_EXT\0"
- "GL_PROXY_TEXTURE_3D\0"
- "GL_PROXY_TEXTURE_COLOR_TABLE_SGI\0"
- "GL_PROXY_TEXTURE_CUBE_MAP\0"
- "GL_PROXY_TEXTURE_CUBE_MAP_ARB\0"
- "GL_PROXY_TEXTURE_RECTANGLE\0"
- "GL_PROXY_TEXTURE_RECTANGLE_ARB\0"
- "GL_PROXY_TEXTURE_RECTANGLE_NV\0"
- "GL_PURGEABLE_APPLE\0"
- "GL_Q\0"
- "GL_QUADRATIC_ATTENUATION\0"
- "GL_QUADS\0"
- "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION\0"
- "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT\0"
- "GL_QUAD_MESH_SUN\0"
- "GL_QUAD_STRIP\0"
- "GL_QUERY_BY_REGION_NO_WAIT\0"
- "GL_QUERY_BY_REGION_NO_WAIT_NV\0"
- "GL_QUERY_BY_REGION_WAIT\0"
- "GL_QUERY_BY_REGION_WAIT_NV\0"
- "GL_QUERY_COUNTER_BITS\0"
- "GL_QUERY_COUNTER_BITS_ARB\0"
- "GL_QUERY_NO_WAIT\0"
- "GL_QUERY_NO_WAIT_NV\0"
- "GL_QUERY_RESULT\0"
- "GL_QUERY_RESULT_ARB\0"
- "GL_QUERY_RESULT_AVAILABLE\0"
- "GL_QUERY_RESULT_AVAILABLE_ARB\0"
- "GL_QUERY_WAIT\0"
- "GL_QUERY_WAIT_NV\0"
- "GL_R\0"
- "GL_R11F_G11F_B10F\0"
- "GL_R16_SNORM\0"
- "GL_R3_G3_B2\0"
- "GL_R8_SNORM\0"
- "GL_RASTERIZER_DISCARD\0"
- "GL_RASTERIZER_DISCARD_EXT\0"
- "GL_RASTER_POSITION_UNCLIPPED_IBM\0"
- "GL_READ_BUFFER\0"
- "GL_READ_FRAMEBUFFER\0"
- "GL_READ_FRAMEBUFFER_BINDING\0"
- "GL_READ_FRAMEBUFFER_BINDING_EXT\0"
- "GL_READ_FRAMEBUFFER_EXT\0"
- "GL_READ_ONLY\0"
- "GL_READ_ONLY_ARB\0"
- "GL_READ_WRITE\0"
- "GL_READ_WRITE_ARB\0"
- "GL_RED\0"
- "GL_REDUCE\0"
- "GL_REDUCE_EXT\0"
- "GL_RED_BIAS\0"
- "GL_RED_BITS\0"
- "GL_RED_INTEGER\0"
- "GL_RED_INTEGER_EXT\0"
- "GL_RED_SCALE\0"
- "GL_RED_SNORM\0"
- "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"
- "GL_REPLACE\0"
- "GL_REPLACE_EXT\0"
- "GL_REPLICATE_BORDER_HP\0"
- "GL_RESCALE_NORMAL\0"
- "GL_RESCALE_NORMAL_EXT\0"
- "GL_RETAINED_APPLE\0"
- "GL_RETURN\0"
- "GL_RG16_SNORM\0"
- "GL_RG8_SNORM\0"
- "GL_RGB\0"
- "GL_RGB10\0"
- "GL_RGB10_A2\0"
- "GL_RGB10_A2_EXT\0"
- "GL_RGB10_EXT\0"
- "GL_RGB12\0"
- "GL_RGB12_EXT\0"
- "GL_RGB16\0"
- "GL_RGB16F\0"
- "GL_RGB16I\0"
- "GL_RGB16I_EXT\0"
- "GL_RGB16UI\0"
- "GL_RGB16UI_EXT\0"
- "GL_RGB16_EXT\0"
- "GL_RGB16_SNORM\0"
- "GL_RGB2_EXT\0"
- "GL_RGB32F\0"
- "GL_RGB32I\0"
- "GL_RGB32I_EXT\0"
- "GL_RGB32UI\0"
- "GL_RGB32UI_EXT\0"
- "GL_RGB4\0"
- "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_RGB8I\0"
- "GL_RGB8I_EXT\0"
- "GL_RGB8UI\0"
- "GL_RGB8UI_EXT\0"
- "GL_RGB8_EXT\0"
- "GL_RGB8_OES\0"
- "GL_RGB8_SNORM\0"
- "GL_RGB9_E5\0"
- "GL_RGBA\0"
- "GL_RGBA12\0"
- "GL_RGBA12_EXT\0"
- "GL_RGBA16\0"
- "GL_RGBA16F\0"
- "GL_RGBA16I\0"
- "GL_RGBA16I_EXT\0"
- "GL_RGBA16UI\0"
- "GL_RGBA16UI_EXT\0"
- "GL_RGBA16_EXT\0"
- "GL_RGBA16_SNORM\0"
- "GL_RGBA2\0"
- "GL_RGBA2_EXT\0"
- "GL_RGBA32F\0"
- "GL_RGBA32I\0"
- "GL_RGBA32I_EXT\0"
- "GL_RGBA32UI\0"
- "GL_RGBA32UI_EXT\0"
- "GL_RGBA4\0"
- "GL_RGBA4_DXT5_S3TC\0"
- "GL_RGBA4_EXT\0"
- "GL_RGBA4_OES\0"
- "GL_RGBA4_S3TC\0"
- "GL_RGBA8\0"
- "GL_RGBA8I\0"
- "GL_RGBA8I_EXT\0"
- "GL_RGBA8UI\0"
- "GL_RGBA8UI_EXT\0"
- "GL_RGBA8_EXT\0"
- "GL_RGBA8_OES\0"
- "GL_RGBA8_SNORM\0"
- "GL_RGBA_DXT5_S3TC\0"
- "GL_RGBA_INTEGER\0"
- "GL_RGBA_INTEGER_EXT\0"
- "GL_RGBA_INTEGER_MODE_EXT\0"
- "GL_RGBA_MODE\0"
- "GL_RGBA_S3TC\0"
- "GL_RGBA_SNORM\0"
- "GL_RGB_INTEGER\0"
- "GL_RGB_INTEGER_EXT\0"
- "GL_RGB_S3TC\0"
- "GL_RGB_SCALE\0"
- "GL_RGB_SCALE_ARB\0"
- "GL_RGB_SCALE_EXT\0"
- "GL_RGB_SNORM\0"
- "GL_RG_SNORM\0"
- "GL_RIGHT\0"
- "GL_S\0"
- "GL_SAMPLER_1D\0"
- "GL_SAMPLER_1D_ARRAY\0"
- "GL_SAMPLER_1D_ARRAY_EXT\0"
- "GL_SAMPLER_1D_ARRAY_SHADOW\0"
- "GL_SAMPLER_1D_ARRAY_SHADOW_EXT\0"
- "GL_SAMPLER_1D_SHADOW\0"
- "GL_SAMPLER_2D\0"
- "GL_SAMPLER_2D_ARRAY\0"
- "GL_SAMPLER_2D_ARRAY_EXT\0"
- "GL_SAMPLER_2D_ARRAY_SHADOW\0"
- "GL_SAMPLER_2D_ARRAY_SHADOW_EXT\0"
- "GL_SAMPLER_2D_RECT\0"
- "GL_SAMPLER_2D_RECT_SHADOW\0"
- "GL_SAMPLER_2D_SHADOW\0"
- "GL_SAMPLER_3D\0"
- "GL_SAMPLER_3D_OES\0"
- "GL_SAMPLER_BUFFER\0"
- "GL_SAMPLER_BUFFER_EXT\0"
- "GL_SAMPLER_CUBE\0"
- "GL_SAMPLER_CUBE_SHADOW\0"
- "GL_SAMPLER_CUBE_SHADOW_EXT\0"
- "GL_SAMPLES\0"
- "GL_SAMPLES_3DFX\0"
- "GL_SAMPLES_ARB\0"
- "GL_SAMPLES_PASSED\0"
- "GL_SAMPLES_PASSED_ARB\0"
- "GL_SAMPLE_ALPHA_TO_COVERAGE\0"
- "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB\0"
- "GL_SAMPLE_ALPHA_TO_ONE\0"
- "GL_SAMPLE_ALPHA_TO_ONE_ARB\0"
- "GL_SAMPLE_BUFFERS\0"
- "GL_SAMPLE_BUFFERS_3DFX\0"
- "GL_SAMPLE_BUFFERS_ARB\0"
- "GL_SAMPLE_COVERAGE\0"
- "GL_SAMPLE_COVERAGE_ARB\0"
- "GL_SAMPLE_COVERAGE_INVERT\0"
- "GL_SAMPLE_COVERAGE_INVERT_ARB\0"
- "GL_SAMPLE_COVERAGE_VALUE\0"
- "GL_SAMPLE_COVERAGE_VALUE_ARB\0"
- "GL_SCISSOR_BIT\0"
- "GL_SCISSOR_BOX\0"
- "GL_SCISSOR_TEST\0"
- "GL_SECONDARY_COLOR_ARRAY\0"
- "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING\0"
- "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_SECONDARY_COLOR_ARRAY_POINTER\0"
- "GL_SECONDARY_COLOR_ARRAY_SIZE\0"
- "GL_SECONDARY_COLOR_ARRAY_STRIDE\0"
- "GL_SECONDARY_COLOR_ARRAY_TYPE\0"
- "GL_SELECT\0"
- "GL_SELECTION_BUFFER_POINTER\0"
- "GL_SELECTION_BUFFER_SIZE\0"
- "GL_SEPARABLE_2D\0"
- "GL_SEPARATE_ATTRIBS\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"
- "GL_SHADE_MODEL\0"
- "GL_SHADING_LANGUAGE_VERSION\0"
- "GL_SHADOW_AMBIENT_SGIX\0"
- "GL_SHARED_TEXTURE_PALETTE_EXT\0"
- "GL_SHININESS\0"
- "GL_SHORT\0"
- "GL_SIGNALED\0"
- "GL_SIGNED_NORMALIZED\0"
- "GL_SINGLE_COLOR\0"
- "GL_SINGLE_COLOR_EXT\0"
- "GL_SLICE_ACCUM_SUN\0"
- "GL_SLUMINANCE\0"
- "GL_SLUMINANCE8\0"
- "GL_SLUMINANCE8_ALPHA8\0"
- "GL_SLUMINANCE_ALPHA\0"
- "GL_SMOOTH\0"
- "GL_SMOOTH_LINE_WIDTH_GRANULARITY\0"
- "GL_SMOOTH_LINE_WIDTH_RANGE\0"
- "GL_SMOOTH_POINT_SIZE_GRANULARITY\0"
- "GL_SMOOTH_POINT_SIZE_RANGE\0"
- "GL_SOURCE0_ALPHA\0"
- "GL_SOURCE0_ALPHA_ARB\0"
- "GL_SOURCE0_ALPHA_EXT\0"
- "GL_SOURCE0_RGB\0"
- "GL_SOURCE0_RGB_ARB\0"
- "GL_SOURCE0_RGB_EXT\0"
- "GL_SOURCE1_ALPHA\0"
- "GL_SOURCE1_ALPHA_ARB\0"
- "GL_SOURCE1_ALPHA_EXT\0"
- "GL_SOURCE1_RGB\0"
- "GL_SOURCE1_RGB_ARB\0"
- "GL_SOURCE1_RGB_EXT\0"
- "GL_SOURCE2_ALPHA\0"
- "GL_SOURCE2_ALPHA_ARB\0"
- "GL_SOURCE2_ALPHA_EXT\0"
- "GL_SOURCE2_RGB\0"
- "GL_SOURCE2_RGB_ARB\0"
- "GL_SOURCE2_RGB_EXT\0"
- "GL_SOURCE3_ALPHA_NV\0"
- "GL_SOURCE3_RGB_NV\0"
- "GL_SPECULAR\0"
- "GL_SPHERE_MAP\0"
- "GL_SPOT_CUTOFF\0"
- "GL_SPOT_DIRECTION\0"
- "GL_SPOT_EXPONENT\0"
- "GL_SRC0_ALPHA\0"
- "GL_SRC0_RGB\0"
- "GL_SRC1_ALPHA\0"
- "GL_SRC1_RGB\0"
- "GL_SRC2_ALPHA\0"
- "GL_SRC2_RGB\0"
- "GL_SRC_ALPHA\0"
- "GL_SRC_ALPHA_SATURATE\0"
- "GL_SRC_COLOR\0"
- "GL_SRGB\0"
- "GL_SRGB8\0"
- "GL_SRGB8_ALPHA8\0"
- "GL_SRGB_ALPHA\0"
- "GL_STACK_OVERFLOW\0"
- "GL_STACK_UNDERFLOW\0"
- "GL_STATIC_COPY\0"
- "GL_STATIC_COPY_ARB\0"
- "GL_STATIC_DRAW\0"
- "GL_STATIC_DRAW_ARB\0"
- "GL_STATIC_READ\0"
- "GL_STATIC_READ_ARB\0"
- "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"
- "GL_STENCIL_BACK_FUNC_ATI\0"
- "GL_STENCIL_BACK_PASS_DEPTH_FAIL\0"
- "GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI\0"
- "GL_STENCIL_BACK_PASS_DEPTH_PASS\0"
- "GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI\0"
- "GL_STENCIL_BACK_REF\0"
- "GL_STENCIL_BACK_VALUE_MASK\0"
- "GL_STENCIL_BACK_WRITEMASK\0"
- "GL_STENCIL_BITS\0"
- "GL_STENCIL_BUFFER\0"
- "GL_STENCIL_BUFFER_BIT\0"
- "GL_STENCIL_CLEAR_VALUE\0"
- "GL_STENCIL_FAIL\0"
- "GL_STENCIL_FUNC\0"
- "GL_STENCIL_INDEX\0"
- "GL_STENCIL_INDEX1\0"
- "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"
- "GL_STENCIL_REF\0"
- "GL_STENCIL_TEST\0"
- "GL_STENCIL_TEST_TWO_SIDE_EXT\0"
- "GL_STENCIL_VALUE_MASK\0"
- "GL_STENCIL_WRITEMASK\0"
- "GL_STEREO\0"
- "GL_STORAGE_CACHED_APPLE\0"
- "GL_STORAGE_PRIVATE_APPLE\0"
- "GL_STORAGE_SHARED_APPLE\0"
- "GL_STREAM_COPY\0"
- "GL_STREAM_COPY_ARB\0"
- "GL_STREAM_DRAW\0"
- "GL_STREAM_DRAW_ARB\0"
- "GL_STREAM_READ\0"
- "GL_STREAM_READ_ARB\0"
- "GL_SUBPIXEL_BITS\0"
- "GL_SUBTRACT\0"
- "GL_SUBTRACT_ARB\0"
- "GL_SYNC_CONDITION\0"
- "GL_SYNC_FENCE\0"
- "GL_SYNC_FLAGS\0"
- "GL_SYNC_FLUSH_COMMANDS_BIT\0"
- "GL_SYNC_GPU_COMMANDS_COMPLETE\0"
- "GL_SYNC_STATUS\0"
- "GL_T\0"
- "GL_T2F_C3F_V3F\0"
- "GL_T2F_C4F_N3F_V3F\0"
- "GL_T2F_C4UB_V3F\0"
- "GL_T2F_N3F_V3F\0"
- "GL_T2F_V3F\0"
- "GL_T4F_C4F_N3F_V4F\0"
- "GL_T4F_V4F\0"
- "GL_TABLE_TOO_LARGE_EXT\0"
- "GL_TEXTURE\0"
- "GL_TEXTURE0\0"
- "GL_TEXTURE0_ARB\0"
- "GL_TEXTURE1\0"
- "GL_TEXTURE10\0"
- "GL_TEXTURE10_ARB\0"
- "GL_TEXTURE11\0"
- "GL_TEXTURE11_ARB\0"
- "GL_TEXTURE12\0"
- "GL_TEXTURE12_ARB\0"
- "GL_TEXTURE13\0"
- "GL_TEXTURE13_ARB\0"
- "GL_TEXTURE14\0"
- "GL_TEXTURE14_ARB\0"
- "GL_TEXTURE15\0"
- "GL_TEXTURE15_ARB\0"
- "GL_TEXTURE16\0"
- "GL_TEXTURE16_ARB\0"
- "GL_TEXTURE17\0"
- "GL_TEXTURE17_ARB\0"
- "GL_TEXTURE18\0"
- "GL_TEXTURE18_ARB\0"
- "GL_TEXTURE19\0"
- "GL_TEXTURE19_ARB\0"
- "GL_TEXTURE1_ARB\0"
- "GL_TEXTURE2\0"
- "GL_TEXTURE20\0"
- "GL_TEXTURE20_ARB\0"
- "GL_TEXTURE21\0"
- "GL_TEXTURE21_ARB\0"
- "GL_TEXTURE22\0"
- "GL_TEXTURE22_ARB\0"
- "GL_TEXTURE23\0"
- "GL_TEXTURE23_ARB\0"
- "GL_TEXTURE24\0"
- "GL_TEXTURE24_ARB\0"
- "GL_TEXTURE25\0"
- "GL_TEXTURE25_ARB\0"
- "GL_TEXTURE26\0"
- "GL_TEXTURE26_ARB\0"
- "GL_TEXTURE27\0"
- "GL_TEXTURE27_ARB\0"
- "GL_TEXTURE28\0"
- "GL_TEXTURE28_ARB\0"
- "GL_TEXTURE29\0"
- "GL_TEXTURE29_ARB\0"
- "GL_TEXTURE2_ARB\0"
- "GL_TEXTURE3\0"
- "GL_TEXTURE30\0"
- "GL_TEXTURE30_ARB\0"
- "GL_TEXTURE31\0"
- "GL_TEXTURE31_ARB\0"
- "GL_TEXTURE3_ARB\0"
- "GL_TEXTURE4\0"
- "GL_TEXTURE4_ARB\0"
- "GL_TEXTURE5\0"
- "GL_TEXTURE5_ARB\0"
- "GL_TEXTURE6\0"
- "GL_TEXTURE6_ARB\0"
- "GL_TEXTURE7\0"
- "GL_TEXTURE7_ARB\0"
- "GL_TEXTURE8\0"
- "GL_TEXTURE8_ARB\0"
- "GL_TEXTURE9\0"
- "GL_TEXTURE9_ARB\0"
- "GL_TEXTURE_1D\0"
- "GL_TEXTURE_1D_ARRAY\0"
- "GL_TEXTURE_1D_ARRAY_EXT\0"
- "GL_TEXTURE_2D\0"
- "GL_TEXTURE_2D_ARRAY\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"
- "GL_TEXTURE_BINDING_1D\0"
- "GL_TEXTURE_BINDING_1D_ARRAY\0"
- "GL_TEXTURE_BINDING_1D_ARRAY_EXT\0"
- "GL_TEXTURE_BINDING_2D\0"
- "GL_TEXTURE_BINDING_2D_ARRAY\0"
- "GL_TEXTURE_BINDING_2D_ARRAY_EXT\0"
- "GL_TEXTURE_BINDING_3D\0"
- "GL_TEXTURE_BINDING_3D_OES\0"
- "GL_TEXTURE_BINDING_BUFFER\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\0"
- "GL_TEXTURE_BINDING_RECTANGLE_ARB\0"
- "GL_TEXTURE_BINDING_RECTANGLE_NV\0"
- "GL_TEXTURE_BIT\0"
- "GL_TEXTURE_BLUE_SIZE\0"
- "GL_TEXTURE_BLUE_SIZE_EXT\0"
- "GL_TEXTURE_BORDER\0"
- "GL_TEXTURE_BORDER_COLOR\0"
- "GL_TEXTURE_BUFFER\0"
- "GL_TEXTURE_BUFFER_DATA_STORE_BINDING\0"
- "GL_TEXTURE_BUFFER_FORMAT\0"
- "GL_TEXTURE_CLIPMAP_CENTER_SGIX\0"
- "GL_TEXTURE_CLIPMAP_DEPTH_SGIX\0"
- "GL_TEXTURE_CLIPMAP_FRAME_SGIX\0"
- "GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX\0"
- "GL_TEXTURE_CLIPMAP_OFFSET_SGIX\0"
- "GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX\0"
- "GL_TEXTURE_COLOR_TABLE_SGI\0"
- "GL_TEXTURE_COLOR_WRITEMASK_SGIS\0"
- "GL_TEXTURE_COMPARE_FAIL_VALUE_ARB\0"
- "GL_TEXTURE_COMPARE_FUNC\0"
- "GL_TEXTURE_COMPARE_FUNC_ARB\0"
- "GL_TEXTURE_COMPARE_MODE\0"
- "GL_TEXTURE_COMPARE_MODE_ARB\0"
- "GL_TEXTURE_COMPARE_OPERATOR_SGIX\0"
- "GL_TEXTURE_COMPARE_SGIX\0"
- "GL_TEXTURE_COMPONENTS\0"
- "GL_TEXTURE_COMPRESSED\0"
- "GL_TEXTURE_COMPRESSED_ARB\0"
- "GL_TEXTURE_COMPRESSED_FORMATS_ARB\0"
- "GL_TEXTURE_COMPRESSED_IMAGE_SIZE\0"
- "GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB\0"
- "GL_TEXTURE_COMPRESSION_HINT\0"
- "GL_TEXTURE_COMPRESSION_HINT_ARB\0"
- "GL_TEXTURE_COORD_ARRAY\0"
- "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING\0"
- "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_TEXTURE_COORD_ARRAY_POINTER\0"
- "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"
- "GL_TEXTURE_DEPTH_SIZE_ARB\0"
- "GL_TEXTURE_ENV\0"
- "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"
- "GL_TEXTURE_GREEN_SIZE_EXT\0"
- "GL_TEXTURE_HEIGHT\0"
- "GL_TEXTURE_INDEX_SIZE_EXT\0"
- "GL_TEXTURE_INTENSITY_SIZE\0"
- "GL_TEXTURE_INTENSITY_SIZE_EXT\0"
- "GL_TEXTURE_INTERNAL_FORMAT\0"
- "GL_TEXTURE_LEQUAL_R_SGIX\0"
- "GL_TEXTURE_LOD_BIAS\0"
- "GL_TEXTURE_LOD_BIAS_EXT\0"
- "GL_TEXTURE_LOD_BIAS_R_SGIX\0"
- "GL_TEXTURE_LOD_BIAS_S_SGIX\0"
- "GL_TEXTURE_LOD_BIAS_T_SGIX\0"
- "GL_TEXTURE_LUMINANCE_SIZE\0"
- "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"
- "GL_TEXTURE_MAX_CLAMP_T_SGIX\0"
- "GL_TEXTURE_MAX_LEVEL\0"
- "GL_TEXTURE_MAX_LOD\0"
- "GL_TEXTURE_MIN_FILTER\0"
- "GL_TEXTURE_MIN_LOD\0"
- "GL_TEXTURE_PRIORITY\0"
- "GL_TEXTURE_RANGE_LENGTH_APPLE\0"
- "GL_TEXTURE_RANGE_POINTER_APPLE\0"
- "GL_TEXTURE_RECTANGLE\0"
- "GL_TEXTURE_RECTANGLE_ARB\0"
- "GL_TEXTURE_RECTANGLE_NV\0"
- "GL_TEXTURE_RED_SIZE\0"
- "GL_TEXTURE_RED_SIZE_EXT\0"
- "GL_TEXTURE_RESIDENT\0"
- "GL_TEXTURE_SHARED_SIZE\0"
- "GL_TEXTURE_STACK_DEPTH\0"
- "GL_TEXTURE_STENCIL_SIZE\0"
- "GL_TEXTURE_STENCIL_SIZE_EXT\0"
- "GL_TEXTURE_STORAGE_HINT_APPLE\0"
- "GL_TEXTURE_TOO_LARGE_EXT\0"
- "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"
- "GL_TIME_ELAPSED_EXT\0"
- "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\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_EXT\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_MODE\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_SIZE\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_START\0"
- "GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT\0"
- "GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN\0"
- "GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT\0"
- "GL_TRANSFORM_FEEDBACK_VARYINGS\0"
- "GL_TRANSFORM_FEEDBACK_VARYINGS_EXT\0"
- "GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH\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"
- "GL_TRANSPOSE_MODELVIEW_MATRIX\0"
- "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB\0"
- "GL_TRANSPOSE_NV\0"
- "GL_TRANSPOSE_PROJECTION_MATRIX\0"
- "GL_TRANSPOSE_PROJECTION_MATRIX_ARB\0"
- "GL_TRANSPOSE_TEXTURE_MATRIX\0"
- "GL_TRANSPOSE_TEXTURE_MATRIX_ARB\0"
- "GL_TRIANGLES\0"
- "GL_TRIANGLES_ADJACENCY\0"
- "GL_TRIANGLES_ADJACENCY_ARB\0"
- "GL_TRIANGLE_FAN\0"
- "GL_TRIANGLE_MESH_SUN\0"
- "GL_TRIANGLE_STRIP\0"
- "GL_TRIANGLE_STRIP_ADJACENCY\0"
- "GL_TRIANGLE_STRIP_ADJACENCY_ARB\0"
- "GL_TRUE\0"
- "GL_UNDEFINED_APPLE\0"
- "GL_UNPACK_ALIGNMENT\0"
- "GL_UNPACK_IMAGE_HEIGHT\0"
- "GL_UNPACK_LSB_FIRST\0"
- "GL_UNPACK_ROW_LENGTH\0"
- "GL_UNPACK_SKIP_IMAGES\0"
- "GL_UNPACK_SKIP_PIXELS\0"
- "GL_UNPACK_SKIP_ROWS\0"
- "GL_UNPACK_SWAP_BYTES\0"
- "GL_UNSIGNALED\0"
- "GL_UNSIGNED_BYTE\0"
- "GL_UNSIGNED_BYTE_2_3_3_REV\0"
- "GL_UNSIGNED_BYTE_3_3_2\0"
- "GL_UNSIGNED_INT\0"
- "GL_UNSIGNED_INT_10F_11F_11F_REV\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_5_9_9_9_REV\0"
- "GL_UNSIGNED_INT_8_8_8_8\0"
- "GL_UNSIGNED_INT_8_8_8_8_REV\0"
- "GL_UNSIGNED_INT_SAMPLER_1D\0"
- "GL_UNSIGNED_INT_SAMPLER_1D_ARRAY\0"
- "GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT\0"
- "GL_UNSIGNED_INT_SAMPLER_1D_EXT\0"
- "GL_UNSIGNED_INT_SAMPLER_2D\0"
- "GL_UNSIGNED_INT_SAMPLER_2D_ARRAY\0"
- "GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT\0"
- "GL_UNSIGNED_INT_SAMPLER_2D_EXT\0"
- "GL_UNSIGNED_INT_SAMPLER_2D_RECT\0"
- "GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT\0"
- "GL_UNSIGNED_INT_SAMPLER_3D\0"
- "GL_UNSIGNED_INT_SAMPLER_3D_EXT\0"
- "GL_UNSIGNED_INT_SAMPLER_BUFFER\0"
- "GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT\0"
- "GL_UNSIGNED_INT_SAMPLER_CUBE\0"
- "GL_UNSIGNED_INT_SAMPLER_CUBE_EXT\0"
- "GL_UNSIGNED_INT_VEC2\0"
- "GL_UNSIGNED_INT_VEC2_EXT\0"
- "GL_UNSIGNED_INT_VEC3\0"
- "GL_UNSIGNED_INT_VEC3_EXT\0"
- "GL_UNSIGNED_INT_VEC4\0"
- "GL_UNSIGNED_INT_VEC4_EXT\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"
- "GL_UNSIGNED_SHORT_8_8_APPLE\0"
- "GL_UNSIGNED_SHORT_8_8_MESA\0"
- "GL_UNSIGNED_SHORT_8_8_REV_APPLE\0"
- "GL_UNSIGNED_SHORT_8_8_REV_MESA\0"
- "GL_UPPER_LEFT\0"
- "GL_V2F\0"
- "GL_V3F\0"
- "GL_VALIDATE_STATUS\0"
- "GL_VENDOR\0"
- "GL_VERSION\0"
- "GL_VERTEX_ARRAY\0"
- "GL_VERTEX_ARRAY_BINDING\0"
- "GL_VERTEX_ARRAY_BINDING_APPLE\0"
- "GL_VERTEX_ARRAY_BUFFER_BINDING\0"
- "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_VERTEX_ARRAY_POINTER\0"
- "GL_VERTEX_ARRAY_SIZE\0"
- "GL_VERTEX_ARRAY_STRIDE\0"
- "GL_VERTEX_ARRAY_TYPE\0"
- "GL_VERTEX_ATTRIB_ARRAY0_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY10_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY11_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY12_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY13_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY14_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY15_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY1_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY2_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY3_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY4_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY5_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY6_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY7_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY8_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY9_NV\0"
- "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING\0"
- "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB\0"
- "GL_VERTEX_ATTRIB_ARRAY_ENABLED\0"
- "GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB\0"
- "GL_VERTEX_ATTRIB_ARRAY_INTEGER\0"
- "GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT\0"
- "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED\0"
- "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB\0"
- "GL_VERTEX_ATTRIB_ARRAY_POINTER\0"
- "GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB\0"
- "GL_VERTEX_ATTRIB_ARRAY_SIZE\0"
- "GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB\0"
- "GL_VERTEX_ATTRIB_ARRAY_STRIDE\0"
- "GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB\0"
- "GL_VERTEX_ATTRIB_ARRAY_TYPE\0"
- "GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB\0"
- "GL_VERTEX_BLEND_ARB\0"
- "GL_VERTEX_PROGRAM_ARB\0"
- "GL_VERTEX_PROGRAM_BINDING_NV\0"
- "GL_VERTEX_PROGRAM_NV\0"
- "GL_VERTEX_PROGRAM_POINT_SIZE\0"
- "GL_VERTEX_PROGRAM_POINT_SIZE_ARB\0"
- "GL_VERTEX_PROGRAM_POINT_SIZE_NV\0"
- "GL_VERTEX_PROGRAM_TWO_SIDE\0"
- "GL_VERTEX_PROGRAM_TWO_SIDE_ARB\0"
- "GL_VERTEX_PROGRAM_TWO_SIDE_NV\0"
- "GL_VERTEX_SHADER\0"
- "GL_VERTEX_SHADER_ARB\0"
- "GL_VERTEX_STATE_PROGRAM_NV\0"
- "GL_VIEWPORT\0"
- "GL_VIEWPORT_BIT\0"
- "GL_VOLATILE_APPLE\0"
- "GL_WAIT_FAILED\0"
- "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"
- "GL_ZERO\0"
- "GL_ZOOM_X\0"
- "GL_ZOOM_Y\0"
- ;
-
-static const enum_elt all_enums[2294] =
-{
- { 0, 0x00000600 }, /* GL_2D */
- { 6, 0x00001407 }, /* GL_2_BYTES */
- { 17, 0x00000601 }, /* GL_3D */
- { 23, 0x00000602 }, /* GL_3D_COLOR */
- { 35, 0x00000603 }, /* GL_3D_COLOR_TEXTURE */
- { 55, 0x00001408 }, /* GL_3_BYTES */
- { 66, 0x00000604 }, /* GL_4D_COLOR_TEXTURE */
- { 86, 0x00001409 }, /* GL_4_BYTES */
- { 97, 0x00000100 }, /* GL_ACCUM */
- { 106, 0x00000D5B }, /* GL_ACCUM_ALPHA_BITS */
- { 126, 0x00000D5A }, /* GL_ACCUM_BLUE_BITS */
- { 145, 0x00000200 }, /* GL_ACCUM_BUFFER_BIT */
- { 165, 0x00000B80 }, /* GL_ACCUM_CLEAR_VALUE */
- { 186, 0x00000D59 }, /* GL_ACCUM_GREEN_BITS */
- { 206, 0x00000D58 }, /* GL_ACCUM_RED_BITS */
- { 224, 0x00008B89 }, /* GL_ACTIVE_ATTRIBUTES */
- { 245, 0x00008B8A }, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */
- { 276, 0x00008B8D }, /* GL_ACTIVE_PROGRAM_EXT */
- { 298, 0x00008911 }, /* GL_ACTIVE_STENCIL_FACE_EXT */
- { 325, 0x000084E0 }, /* GL_ACTIVE_TEXTURE */
- { 343, 0x000084E0 }, /* GL_ACTIVE_TEXTURE_ARB */
- { 365, 0x00008B86 }, /* GL_ACTIVE_UNIFORMS */
- { 384, 0x00008B87 }, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */
- { 413, 0x000086A5 }, /* GL_ACTIVE_VERTEX_UNITS_ARB */
- { 440, 0x00000104 }, /* GL_ADD */
- { 447, 0x00008574 }, /* GL_ADD_SIGNED */
- { 461, 0x00008574 }, /* GL_ADD_SIGNED_ARB */
- { 479, 0x00008574 }, /* GL_ADD_SIGNED_EXT */
- { 497, 0x0000846E }, /* GL_ALIASED_LINE_WIDTH_RANGE */
- { 525, 0x0000846D }, /* GL_ALIASED_POINT_SIZE_RANGE */
- { 553, 0x000FFFFF }, /* GL_ALL_ATTRIB_BITS */
- { 572, 0xFFFFFFFF }, /* GL_ALL_CLIENT_ATTRIB_BITS */
- { 598, 0x00001906 }, /* GL_ALPHA */
- { 607, 0x0000803D }, /* GL_ALPHA12 */
- { 618, 0x0000803D }, /* GL_ALPHA12_EXT */
- { 633, 0x0000803E }, /* GL_ALPHA16 */
- { 644, 0x00008D8A }, /* GL_ALPHA16I_EXT */
- { 660, 0x00008D78 }, /* GL_ALPHA16UI_EXT */
- { 677, 0x0000803E }, /* GL_ALPHA16_EXT */
- { 692, 0x00008D84 }, /* GL_ALPHA32I_EXT */
- { 708, 0x00008D72 }, /* GL_ALPHA32UI_EXT */
- { 725, 0x0000803B }, /* GL_ALPHA4 */
- { 735, 0x0000803B }, /* GL_ALPHA4_EXT */
- { 749, 0x0000803C }, /* GL_ALPHA8 */
- { 759, 0x00008D90 }, /* GL_ALPHA8I_EXT */
- { 774, 0x00008D7E }, /* GL_ALPHA8UI_EXT */
- { 790, 0x0000803C }, /* GL_ALPHA8_EXT */
- { 804, 0x00000D1D }, /* GL_ALPHA_BIAS */
- { 818, 0x00000D55 }, /* GL_ALPHA_BITS */
- { 832, 0x00008D97 }, /* GL_ALPHA_INTEGER_EXT */
- { 853, 0x00000D1C }, /* GL_ALPHA_SCALE */
- { 868, 0x00000BC0 }, /* GL_ALPHA_TEST */
- { 882, 0x00000BC1 }, /* GL_ALPHA_TEST_FUNC */
- { 901, 0x00000BC2 }, /* GL_ALPHA_TEST_REF */
- { 919, 0x0000911A }, /* GL_ALREADY_SIGNALED */
- { 939, 0x00000207 }, /* GL_ALWAYS */
- { 949, 0x00001200 }, /* GL_AMBIENT */
- { 960, 0x00001602 }, /* GL_AMBIENT_AND_DIFFUSE */
- { 983, 0x00001501 }, /* GL_AND */
- { 990, 0x00001504 }, /* GL_AND_INVERTED */
- { 1006, 0x00001502 }, /* GL_AND_REVERSE */
- { 1021, 0x00008892 }, /* GL_ARRAY_BUFFER */
- { 1037, 0x00008894 }, /* GL_ARRAY_BUFFER_BINDING */
- { 1061, 0x00008894 }, /* GL_ARRAY_BUFFER_BINDING_ARB */
- { 1089, 0x00008B85 }, /* GL_ATTACHED_SHADERS */
- { 1109, 0x00008645 }, /* GL_ATTRIB_ARRAY_POINTER_NV */
- { 1136, 0x00008623 }, /* GL_ATTRIB_ARRAY_SIZE_NV */
- { 1160, 0x00008624 }, /* GL_ATTRIB_ARRAY_STRIDE_NV */
- { 1186, 0x00008625 }, /* GL_ATTRIB_ARRAY_TYPE_NV */
- { 1210, 0x00000BB0 }, /* GL_ATTRIB_STACK_DEPTH */
- { 1232, 0x00000D80 }, /* GL_AUTO_NORMAL */
- { 1247, 0x00000409 }, /* GL_AUX0 */
- { 1255, 0x0000040A }, /* GL_AUX1 */
- { 1263, 0x0000040B }, /* GL_AUX2 */
- { 1271, 0x0000040C }, /* GL_AUX3 */
- { 1279, 0x00000C00 }, /* GL_AUX_BUFFERS */
- { 1294, 0x00000405 }, /* GL_BACK */
- { 1302, 0x00000402 }, /* GL_BACK_LEFT */
- { 1315, 0x00000403 }, /* GL_BACK_RIGHT */
- { 1329, 0x000080E0 }, /* GL_BGR */
- { 1336, 0x000080E1 }, /* GL_BGRA */
- { 1344, 0x000080E1 }, /* GL_BGRA_EXT */
- { 1356, 0x00008D9B }, /* GL_BGRA_INTEGER */
- { 1372, 0x00008D9B }, /* GL_BGRA_INTEGER_EXT */
- { 1392, 0x00008D9A }, /* GL_BGR_INTEGER */
- { 1407, 0x00008D9A }, /* GL_BGR_INTEGER_EXT */
- { 1426, 0x00001A00 }, /* GL_BITMAP */
- { 1436, 0x00000704 }, /* GL_BITMAP_TOKEN */
- { 1452, 0x00000BE2 }, /* GL_BLEND */
- { 1461, 0x00008005 }, /* GL_BLEND_COLOR */
- { 1476, 0x00008005 }, /* GL_BLEND_COLOR_EXT */
- { 1495, 0x00000BE0 }, /* GL_BLEND_DST */
- { 1508, 0x000080CA }, /* GL_BLEND_DST_ALPHA */
- { 1527, 0x000080CA }, /* GL_BLEND_DST_ALPHA_OES */
- { 1550, 0x000080C8 }, /* GL_BLEND_DST_RGB */
- { 1567, 0x000080C8 }, /* GL_BLEND_DST_RGB_OES */
- { 1588, 0x00008009 }, /* GL_BLEND_EQUATION */
- { 1606, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA */
- { 1630, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_EXT */
- { 1658, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_OES */
- { 1686, 0x00008009 }, /* GL_BLEND_EQUATION_EXT */
- { 1708, 0x00008009 }, /* GL_BLEND_EQUATION_OES */
- { 1730, 0x00008009 }, /* GL_BLEND_EQUATION_RGB */
- { 1752, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */
- { 1778, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_OES */
- { 1804, 0x00000BE1 }, /* GL_BLEND_SRC */
- { 1817, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */
- { 1836, 0x000080CB }, /* GL_BLEND_SRC_ALPHA_OES */
- { 1859, 0x000080C9 }, /* GL_BLEND_SRC_RGB */
- { 1876, 0x000080C9 }, /* GL_BLEND_SRC_RGB_OES */
- { 1897, 0x00001905 }, /* GL_BLUE */
- { 1905, 0x00000D1B }, /* GL_BLUE_BIAS */
- { 1918, 0x00000D54 }, /* GL_BLUE_BITS */
- { 1931, 0x00008D96 }, /* GL_BLUE_INTEGER */
- { 1947, 0x00008D96 }, /* GL_BLUE_INTEGER_EXT */
- { 1967, 0x00000D1A }, /* GL_BLUE_SCALE */
- { 1981, 0x00008B56 }, /* GL_BOOL */
- { 1989, 0x00008B56 }, /* GL_BOOL_ARB */
- { 2001, 0x00008B57 }, /* GL_BOOL_VEC2 */
- { 2014, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */
- { 2031, 0x00008B58 }, /* GL_BOOL_VEC3 */
- { 2044, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */
- { 2061, 0x00008B59 }, /* GL_BOOL_VEC4 */
- { 2074, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */
- { 2091, 0x000088BB }, /* GL_BUFFER_ACCESS */
- { 2108, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */
- { 2129, 0x0000911F }, /* GL_BUFFER_ACCESS_FLAGS */
- { 2152, 0x000088BB }, /* GL_BUFFER_ACCESS_OES */
- { 2173, 0x00008A13 }, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */
- { 2204, 0x000088BC }, /* GL_BUFFER_MAPPED */
- { 2221, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */
- { 2242, 0x000088BC }, /* GL_BUFFER_MAPPED_OES */
- { 2263, 0x00009120 }, /* GL_BUFFER_MAP_LENGTH */
- { 2284, 0x00009121 }, /* GL_BUFFER_MAP_OFFSET */
- { 2305, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */
- { 2327, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */
- { 2353, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_OES */
- { 2379, 0x000085B3 }, /* GL_BUFFER_OBJECT_APPLE */
- { 2402, 0x00008A12 }, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */
- { 2436, 0x00008764 }, /* GL_BUFFER_SIZE */
- { 2451, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */
- { 2470, 0x00008765 }, /* GL_BUFFER_USAGE */
- { 2486, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */
- { 2506, 0x0000877B }, /* GL_BUMP_ENVMAP_ATI */
- { 2525, 0x00008777 }, /* GL_BUMP_NUM_TEX_UNITS_ATI */
- { 2551, 0x00008775 }, /* GL_BUMP_ROT_MATRIX_ATI */
- { 2574, 0x00008776 }, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
- { 2602, 0x0000877C }, /* GL_BUMP_TARGET_ATI */
- { 2621, 0x00008778 }, /* GL_BUMP_TEX_UNITS_ATI */
- { 2643, 0x00001400 }, /* GL_BYTE */
- { 2651, 0x00002A24 }, /* GL_C3F_V3F */
- { 2662, 0x00002A26 }, /* GL_C4F_N3F_V3F */
- { 2677, 0x00002A22 }, /* GL_C4UB_V2F */
- { 2689, 0x00002A23 }, /* GL_C4UB_V3F */
- { 2701, 0x00000901 }, /* GL_CCW */
- { 2708, 0x00002900 }, /* GL_CLAMP */
- { 2717, 0x0000891C }, /* GL_CLAMP_READ_COLOR */
- { 2737, 0x0000812D }, /* GL_CLAMP_TO_BORDER */
- { 2756, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */
- { 2779, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */
- { 2803, 0x0000812F }, /* GL_CLAMP_TO_EDGE */
- { 2820, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */
- { 2842, 0x00001500 }, /* GL_CLEAR */
- { 2851, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */
- { 2876, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */
- { 2905, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */
- { 2931, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
- { 2960, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */
- { 2986, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */
- { 3013, 0x00003000 }, /* GL_CLIP_DISTANCE0 */
- { 3031, 0x00003001 }, /* GL_CLIP_DISTANCE1 */
- { 3049, 0x00003002 }, /* GL_CLIP_DISTANCE2 */
- { 3067, 0x00003003 }, /* GL_CLIP_DISTANCE3 */
- { 3085, 0x00003004 }, /* GL_CLIP_DISTANCE4 */
- { 3103, 0x00003005 }, /* GL_CLIP_DISTANCE5 */
- { 3121, 0x00003006 }, /* GL_CLIP_DISTANCE6 */
- { 3139, 0x00003007 }, /* GL_CLIP_DISTANCE7 */
- { 3157, 0x00003000 }, /* GL_CLIP_PLANE0 */
- { 3172, 0x00003001 }, /* GL_CLIP_PLANE1 */
- { 3187, 0x00003002 }, /* GL_CLIP_PLANE2 */
- { 3202, 0x00003003 }, /* GL_CLIP_PLANE3 */
- { 3217, 0x00003004 }, /* GL_CLIP_PLANE4 */
- { 3232, 0x00003005 }, /* GL_CLIP_PLANE5 */
- { 3247, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
- { 3280, 0x00000A00 }, /* GL_COEFF */
- { 3289, 0x00001800 }, /* GL_COLOR */
- { 3298, 0x00008076 }, /* GL_COLOR_ARRAY */
- { 3313, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */
- { 3343, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */
- { 3377, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */
- { 3400, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */
- { 3420, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */
- { 3442, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */
- { 3462, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */
- { 3483, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */
- { 3508, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_OES */
- { 3533, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */
- { 3554, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */
- { 3576, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */
- { 3602, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */
- { 3624, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */
- { 3650, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */
- { 3672, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */
- { 3698, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */
- { 3720, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */
- { 3746, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */
- { 3768, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */
- { 3794, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */
- { 3816, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */
- { 3842, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */
- { 3867, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */
- { 3888, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */
- { 3913, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */
- { 3934, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */
- { 3959, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */
- { 3980, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */
- { 4005, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */
- { 4026, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */
- { 4051, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */
- { 4072, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */
- { 4097, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */
- { 4118, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */
- { 4143, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */
- { 4164, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */
- { 4189, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */
- { 4210, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */
- { 4235, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */
- { 4255, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */
- { 4276, 0x00001900 }, /* GL_COLOR_INDEX */
- { 4291, 0x00001603 }, /* GL_COLOR_INDEXES */
- { 4308, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */
- { 4326, 0x00000B57 }, /* GL_COLOR_MATERIAL */
- { 4344, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */
- { 4367, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */
- { 4395, 0x000080B1 }, /* GL_COLOR_MATRIX */
- { 4411, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */
- { 4431, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */
- { 4459, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */
- { 4491, 0x00008458 }, /* GL_COLOR_SUM */
- { 4504, 0x00008458 }, /* GL_COLOR_SUM_ARB */
- { 4521, 0x000080D0 }, /* GL_COLOR_TABLE */
- { 4536, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */
- { 4562, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */
- { 4592, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */
- { 4622, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */
- { 4642, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */
- { 4666, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */
- { 4691, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */
- { 4720, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */
- { 4749, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */
- { 4771, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */
- { 4797, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */
- { 4823, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */
- { 4849, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */
- { 4879, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */
- { 4909, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */
- { 4939, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */
- { 4973, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */
- { 5007, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */
- { 5037, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */
- { 5071, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */
- { 5105, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */
- { 5129, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */
- { 5157, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */
- { 5185, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */
- { 5206, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */
- { 5231, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */
- { 5252, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */
- { 5277, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */
- { 5302, 0x00000C23 }, /* GL_COLOR_WRITEMASK */
- { 5321, 0x00008570 }, /* GL_COMBINE */
- { 5332, 0x00008503 }, /* GL_COMBINE4 */
- { 5344, 0x00008572 }, /* GL_COMBINE_ALPHA */
- { 5361, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */
- { 5382, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */
- { 5403, 0x00008570 }, /* GL_COMBINE_ARB */
- { 5418, 0x00008570 }, /* GL_COMBINE_EXT */
- { 5433, 0x00008571 }, /* GL_COMBINE_RGB */
- { 5448, 0x00008571 }, /* GL_COMBINE_RGB_ARB */
- { 5467, 0x00008571 }, /* GL_COMBINE_RGB_EXT */
- { 5486, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */
- { 5522, 0x0000884E }, /* GL_COMPARE_REF_TO_TEXTURE */
- { 5548, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */
- { 5572, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */
- { 5600, 0x00001300 }, /* GL_COMPILE */
- { 5611, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */
- { 5634, 0x00008B81 }, /* GL_COMPILE_STATUS */
- { 5652, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */
- { 5672, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */
- { 5696, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */
- { 5720, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */
- { 5748, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */
- { 5772, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */
- { 5802, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */
- { 5836, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */
- { 5864, 0x00008225 }, /* GL_COMPRESSED_RED */
- { 5882, 0x00008226 }, /* GL_COMPRESSED_RG */
- { 5899, 0x000084ED }, /* GL_COMPRESSED_RGB */
- { 5917, 0x000084EE }, /* GL_COMPRESSED_RGBA */
- { 5936, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */
- { 5959, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
- { 5988, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
- { 6021, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
- { 6054, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
- { 6087, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */
- { 6109, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */
- { 6137, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
- { 6169, 0x00008C4A }, /* GL_COMPRESSED_SLUMINANCE */
- { 6194, 0x00008C4B }, /* GL_COMPRESSED_SLUMINANCE_ALPHA */
- { 6225, 0x00008C48 }, /* GL_COMPRESSED_SRGB */
- { 6244, 0x00008C49 }, /* GL_COMPRESSED_SRGB_ALPHA */
- { 6269, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */
- { 6299, 0x0000911C }, /* GL_CONDITION_SATISFIED */
- { 6322, 0x00008576 }, /* GL_CONSTANT */
- { 6334, 0x00008003 }, /* GL_CONSTANT_ALPHA */
- { 6352, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */
- { 6374, 0x00008576 }, /* GL_CONSTANT_ARB */
- { 6390, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */
- { 6414, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */
- { 6436, 0x00008001 }, /* GL_CONSTANT_COLOR */
- { 6454, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */
- { 6476, 0x00008576 }, /* GL_CONSTANT_EXT */
- { 6492, 0x00000002 }, /* GL_CONTEXT_COMPATIBILITY_PROFILE_BIT */
- { 6529, 0x00000001 }, /* GL_CONTEXT_CORE_PROFILE_BIT */
- { 6557, 0x0000821E }, /* GL_CONTEXT_FLAGS */
- { 6574, 0x00000001 }, /* GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */
- { 6613, 0x00009126 }, /* GL_CONTEXT_PROFILE_MASK */
- { 6637, 0x00008010 }, /* GL_CONVOLUTION_1D */
- { 6655, 0x00008011 }, /* GL_CONVOLUTION_2D */
- { 6673, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */
- { 6701, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */
- { 6732, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */
- { 6759, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */
- { 6790, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */
- { 6817, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */
- { 6848, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */
- { 6876, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */
- { 6908, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */
- { 6930, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */
- { 6956, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */
- { 6978, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */
- { 7004, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */
- { 7025, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */
- { 7050, 0x00008862 }, /* GL_COORD_REPLACE */
- { 7067, 0x00008862 }, /* GL_COORD_REPLACE_ARB */
- { 7088, 0x00008862 }, /* GL_COORD_REPLACE_NV */
- { 7108, 0x00008862 }, /* GL_COORD_REPLACE_OES */
- { 7129, 0x00001503 }, /* GL_COPY */
- { 7137, 0x0000150C }, /* GL_COPY_INVERTED */
- { 7154, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */
- { 7174, 0x00008F36 }, /* GL_COPY_READ_BUFFER */
- { 7194, 0x00008F37 }, /* GL_COPY_WRITE_BUFFER */
- { 7215, 0x00000B44 }, /* GL_CULL_FACE */
- { 7228, 0x00000B45 }, /* GL_CULL_FACE_MODE */
- { 7246, 0x000081AA }, /* GL_CULL_VERTEX_EXT */
- { 7265, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
- { 7297, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
- { 7332, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */
- { 7353, 0x00000001 }, /* GL_CURRENT_BIT */
- { 7368, 0x00000B00 }, /* GL_CURRENT_COLOR */
- { 7385, 0x00008453 }, /* GL_CURRENT_FOG_COORD */
- { 7406, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */
- { 7432, 0x00000B01 }, /* GL_CURRENT_INDEX */
- { 7449, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */
- { 7471, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */
- { 7499, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */
- { 7520, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
- { 7554, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */
- { 7587, 0x00000B02 }, /* GL_CURRENT_NORMAL */
- { 7605, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */
- { 7635, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_OES */
- { 7665, 0x00008B8D }, /* GL_CURRENT_PROGRAM */
- { 7684, 0x00008865 }, /* GL_CURRENT_QUERY */
- { 7701, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */
- { 7722, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */
- { 7746, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */
- { 7773, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */
- { 7797, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */
- { 7824, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */
- { 7857, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
- { 7891, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
- { 7924, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */
- { 7951, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */
- { 7977, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */
- { 8002, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */
- { 8031, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */
- { 8053, 0x00000900 }, /* GL_CW */
- { 8059, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */
- { 8080, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */
- { 8101, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */
- { 8121, 0x00002101 }, /* GL_DECAL */
- { 8130, 0x00001E03 }, /* GL_DECR */
- { 8138, 0x00008508 }, /* GL_DECR_WRAP */
- { 8151, 0x00008508 }, /* GL_DECR_WRAP_EXT */
- { 8168, 0x00008B80 }, /* GL_DELETE_STATUS */
- { 8185, 0x00001801 }, /* GL_DEPTH */
- { 8194, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */
- { 8214, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_EXT */
- { 8238, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_OES */
- { 8262, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
- { 8282, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
- { 8306, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_OES */
- { 8330, 0x00000D1F }, /* GL_DEPTH_BIAS */
- { 8344, 0x00000D56 }, /* GL_DEPTH_BITS */
- { 8358, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
- { 8378, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
- { 8403, 0x00008223 }, /* GL_DEPTH_BUFFER */
- { 8419, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
- { 8439, 0x0000864F }, /* GL_DEPTH_CLAMP */
- { 8454, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
- { 8472, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
- { 8493, 0x00001902 }, /* GL_DEPTH_COMPONENT */
- { 8512, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
- { 8533, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
- { 8558, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_OES */
- { 8583, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
- { 8609, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
- { 8630, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
- { 8655, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_OES */
- { 8680, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
- { 8706, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
- { 8727, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
- { 8752, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_OES */
- { 8777, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
- { 8803, 0x00000B74 }, /* GL_DEPTH_FUNC */
- { 8817, 0x00000B70 }, /* GL_DEPTH_RANGE */
- { 8832, 0x00000D1E }, /* GL_DEPTH_SCALE */
- { 8847, 0x000084F9 }, /* GL_DEPTH_STENCIL */
- { 8864, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
- { 8892, 0x000084F9 }, /* GL_DEPTH_STENCIL_EXT */
- { 8913, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
- { 8933, 0x000084F9 }, /* GL_DEPTH_STENCIL_OES */
- { 8954, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
- { 8982, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
- { 9010, 0x00000B71 }, /* GL_DEPTH_TEST */
- { 9024, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
- { 9046, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
- { 9072, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
- { 9091, 0x00001201 }, /* GL_DIFFUSE */
- { 9102, 0x00000BD0 }, /* GL_DITHER */
- { 9112, 0x00000A02 }, /* GL_DOMAIN */
- { 9122, 0x00001100 }, /* GL_DONT_CARE */
- { 9135, 0x000086AE }, /* GL_DOT3_RGB */
- { 9147, 0x000086AF }, /* GL_DOT3_RGBA */
- { 9160, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
- { 9177, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
- { 9194, 0x000086AE }, /* GL_DOT3_RGB_ARB */
- { 9210, 0x00008740 }, /* GL_DOT3_RGB_EXT */
- { 9226, 0x0000140A }, /* GL_DOUBLE */
- { 9236, 0x00000C32 }, /* GL_DOUBLEBUFFER */
- { 9252, 0x00000C01 }, /* GL_DRAW_BUFFER */
- { 9267, 0x00008825 }, /* GL_DRAW_BUFFER0 */
- { 9283, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
- { 9303, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
- { 9323, 0x00008826 }, /* GL_DRAW_BUFFER1 */
- { 9339, 0x0000882F }, /* GL_DRAW_BUFFER10 */
- { 9356, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
- { 9377, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
- { 9398, 0x00008830 }, /* GL_DRAW_BUFFER11 */
- { 9415, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
- { 9436, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
- { 9457, 0x00008831 }, /* GL_DRAW_BUFFER12 */
- { 9474, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
- { 9495, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
- { 9516, 0x00008832 }, /* GL_DRAW_BUFFER13 */
- { 9533, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
- { 9554, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
- { 9575, 0x00008833 }, /* GL_DRAW_BUFFER14 */
- { 9592, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
- { 9613, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
- { 9634, 0x00008834 }, /* GL_DRAW_BUFFER15 */
- { 9651, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
- { 9672, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
- { 9693, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
- { 9713, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
- { 9733, 0x00008827 }, /* GL_DRAW_BUFFER2 */
- { 9749, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
- { 9769, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
- { 9789, 0x00008828 }, /* GL_DRAW_BUFFER3 */
- { 9805, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
- { 9825, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
- { 9845, 0x00008829 }, /* GL_DRAW_BUFFER4 */
- { 9861, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
- { 9881, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
- { 9901, 0x0000882A }, /* GL_DRAW_BUFFER5 */
- { 9917, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
- { 9937, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
- { 9957, 0x0000882B }, /* GL_DRAW_BUFFER6 */
- { 9973, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
- { 9993, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
- { 10013, 0x0000882C }, /* GL_DRAW_BUFFER7 */
- { 10029, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
- { 10049, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
- { 10069, 0x0000882D }, /* GL_DRAW_BUFFER8 */
- { 10085, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
- { 10105, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
- { 10125, 0x0000882E }, /* GL_DRAW_BUFFER9 */
- { 10141, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
- { 10161, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
- { 10181, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
- { 10201, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING */
- { 10229, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
- { 10261, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
- { 10285, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
- { 10305, 0x00000304 }, /* GL_DST_ALPHA */
- { 10318, 0x00000306 }, /* GL_DST_COLOR */
- { 10331, 0x0000877A }, /* GL_DU8DV8_ATI */
- { 10345, 0x00008779 }, /* GL_DUDV_ATI */
- { 10357, 0x000088EA }, /* GL_DYNAMIC_COPY */
- { 10373, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
- { 10393, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
- { 10409, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
- { 10429, 0x000088E9 }, /* GL_DYNAMIC_READ */
- { 10445, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
- { 10465, 0x00000B43 }, /* GL_EDGE_FLAG */
- { 10478, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
- { 10497, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
- { 10531, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
- { 10569, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
- { 10596, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
- { 10622, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
- { 10646, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
- { 10678, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
- { 10714, 0x00001600 }, /* GL_EMISSION */
- { 10726, 0x00002000 }, /* GL_ENABLE_BIT */
- { 10740, 0x00000202 }, /* GL_EQUAL */
- { 10749, 0x00001509 }, /* GL_EQUIV */
- { 10758, 0x00010000 }, /* GL_EVAL_BIT */
- { 10770, 0x00000800 }, /* GL_EXP */
- { 10777, 0x00000801 }, /* GL_EXP2 */
- { 10785, 0x00001F03 }, /* GL_EXTENSIONS */
- { 10799, 0x00002400 }, /* GL_EYE_LINEAR */
- { 10813, 0x00002502 }, /* GL_EYE_PLANE */
- { 10826, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
- { 10851, 0x0000855B }, /* GL_EYE_RADIAL_NV */
- { 10868, 0x00000000 }, /* GL_FALSE */
- { 10877, 0x00001101 }, /* GL_FASTEST */
- { 10888, 0x00001C01 }, /* GL_FEEDBACK */
- { 10900, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
- { 10927, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
- { 10951, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
- { 10975, 0x00001B02 }, /* GL_FILL */
- { 10983, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */
- { 11010, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */
- { 11041, 0x0000140C }, /* GL_FIXED */
- { 11050, 0x0000140C }, /* GL_FIXED_OES */
- { 11063, 0x0000891D }, /* GL_FIXED_ONLY */
- { 11077, 0x00001D00 }, /* GL_FLAT */
- { 11085, 0x00001406 }, /* GL_FLOAT */
- { 11094, 0x00008B5A }, /* GL_FLOAT_MAT2 */
- { 11108, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
- { 11126, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */
- { 11142, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */
- { 11158, 0x00008B5B }, /* GL_FLOAT_MAT3 */
- { 11172, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
- { 11190, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */
- { 11206, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */
- { 11222, 0x00008B5C }, /* GL_FLOAT_MAT4 */
- { 11236, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
- { 11254, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */
- { 11270, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */
- { 11286, 0x00008B50 }, /* GL_FLOAT_VEC2 */
- { 11300, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
- { 11318, 0x00008B51 }, /* GL_FLOAT_VEC3 */
- { 11332, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
- { 11350, 0x00008B52 }, /* GL_FLOAT_VEC4 */
- { 11364, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
- { 11382, 0x00000B60 }, /* GL_FOG */
- { 11389, 0x00000080 }, /* GL_FOG_BIT */
- { 11400, 0x00000B66 }, /* GL_FOG_COLOR */
- { 11413, 0x00008451 }, /* GL_FOG_COORD */
- { 11426, 0x00008451 }, /* GL_FOG_COORDINATE */
- { 11444, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
- { 11468, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
- { 11507, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
- { 11550, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
- { 11582, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
- { 11613, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
- { 11642, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
- { 11667, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
- { 11686, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
- { 11720, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
- { 11747, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
- { 11773, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
- { 11797, 0x00008450 }, /* GL_FOG_COORD_SRC */
- { 11814, 0x00000B62 }, /* GL_FOG_DENSITY */
- { 11829, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
- { 11853, 0x00000B64 }, /* GL_FOG_END */
- { 11864, 0x00000C54 }, /* GL_FOG_HINT */
- { 11876, 0x00000B61 }, /* GL_FOG_INDEX */
- { 11889, 0x00000B65 }, /* GL_FOG_MODE */
- { 11901, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
- { 11920, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
- { 11945, 0x00000B63 }, /* GL_FOG_START */
- { 11958, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
- { 11976, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
- { 12000, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
- { 12019, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
- { 12042, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
- { 12077, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES */
- { 12116, 0x00008D40 }, /* GL_FRAMEBUFFER */
- { 12131, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
- { 12168, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
- { 12204, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
- { 12245, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
- { 12286, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
- { 12323, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
- { 12360, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED */
- { 12394, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB */
- { 12432, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
- { 12470, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
- { 12512, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES */
- { 12554, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
- { 12592, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
- { 12634, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES */
- { 12676, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
- { 12711, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
- { 12750, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
- { 12799, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES */
- { 12848, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
- { 12896, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
- { 12948, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES */
- { 13000, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
- { 13040, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
- { 13084, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
- { 13124, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
- { 13168, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES */
- { 13212, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING */
- { 13235, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
- { 13262, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_OES */
- { 13289, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
- { 13313, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
- { 13341, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_OES */
- { 13369, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
- { 13392, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
- { 13411, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
- { 13448, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
- { 13489, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES */
- { 13530, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS */
- { 13567, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
- { 13608, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES */
- { 13649, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
- { 13687, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
- { 13729, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES */
- { 13771, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
- { 13822, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
- { 13860, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES */
- { 13898, 0x00008DA9 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */
- { 13940, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS */
- { 13980, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB */
- { 14024, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
- { 14069, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
- { 14118, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES */
- { 14167, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
- { 14205, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT */
- { 14247, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
- { 14285, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
- { 14327, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES */
- { 14369, 0x00008D40 }, /* GL_FRAMEBUFFER_OES */
- { 14388, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
- { 14420, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
- { 14445, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
- { 14472, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
- { 14503, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_OES */
- { 14534, 0x00000404 }, /* GL_FRONT */
- { 14543, 0x00000408 }, /* GL_FRONT_AND_BACK */
- { 14561, 0x00000B46 }, /* GL_FRONT_FACE */
- { 14575, 0x00000400 }, /* GL_FRONT_LEFT */
- { 14589, 0x00000401 }, /* GL_FRONT_RIGHT */
- { 14604, 0x00008006 }, /* GL_FUNC_ADD */
- { 14616, 0x00008006 }, /* GL_FUNC_ADD_EXT */
- { 14632, 0x00008006 }, /* GL_FUNC_ADD_OES */
- { 14648, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
- { 14673, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
- { 14702, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_OES */
- { 14731, 0x0000800A }, /* GL_FUNC_SUBTRACT */
- { 14748, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
- { 14769, 0x0000800A }, /* GL_FUNC_SUBTRACT_OES */
- { 14790, 0x00008191 }, /* GL_GENERATE_MIPMAP */
- { 14809, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
- { 14833, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
- { 14862, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
- { 14886, 0x00008917 }, /* GL_GEOMETRY_INPUT_TYPE */
- { 14909, 0x00008DDB }, /* GL_GEOMETRY_INPUT_TYPE_ARB */
- { 14936, 0x00008918 }, /* GL_GEOMETRY_OUTPUT_TYPE */
- { 14960, 0x00008DDC }, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */
- { 14988, 0x00008DD9 }, /* GL_GEOMETRY_SHADER */
- { 15007, 0x00008DD9 }, /* GL_GEOMETRY_SHADER_ARB */
- { 15030, 0x00008916 }, /* GL_GEOMETRY_VERTICES_OUT */
- { 15055, 0x00008DDA }, /* GL_GEOMETRY_VERTICES_OUT_ARB */
- { 15084, 0x00000206 }, /* GL_GEQUAL */
- { 15094, 0x00000204 }, /* GL_GREATER */
- { 15105, 0x00001904 }, /* GL_GREEN */
- { 15114, 0x00000D19 }, /* GL_GREEN_BIAS */
- { 15128, 0x00000D53 }, /* GL_GREEN_BITS */
- { 15142, 0x00008D95 }, /* GL_GREEN_INTEGER */
- { 15159, 0x00008D95 }, /* GL_GREEN_INTEGER_EXT */
- { 15180, 0x00000D18 }, /* GL_GREEN_SCALE */
- { 15195, 0x0000140B }, /* GL_HALF_FLOAT */
- { 15209, 0x00008D61 }, /* GL_HALF_FLOAT_OES */
- { 15227, 0x00008DF2 }, /* GL_HIGH_FLOAT */
- { 15241, 0x00008DF5 }, /* GL_HIGH_INT */
- { 15253, 0x00008000 }, /* GL_HINT_BIT */
- { 15265, 0x00008024 }, /* GL_HISTOGRAM */
- { 15278, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
- { 15302, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
- { 15330, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
- { 15353, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
- { 15380, 0x00008024 }, /* GL_HISTOGRAM_EXT */
- { 15397, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
- { 15417, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
- { 15441, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
- { 15465, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
- { 15493, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
- { 15521, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
- { 15553, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
- { 15575, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
- { 15601, 0x0000802D }, /* GL_HISTOGRAM_SINK */
- { 15619, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
- { 15641, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
- { 15660, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
- { 15683, 0x0000862A }, /* GL_IDENTITY_NV */
- { 15698, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
- { 15718, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */
- { 15754, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
- { 15794, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */
- { 15828, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
- { 15866, 0x00001E02 }, /* GL_INCR */
- { 15874, 0x00008507 }, /* GL_INCR_WRAP */
- { 15887, 0x00008507 }, /* GL_INCR_WRAP_EXT */
- { 15904, 0x00008222 }, /* GL_INDEX */
- { 15913, 0x00008077 }, /* GL_INDEX_ARRAY */
- { 15928, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
- { 15958, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
- { 15992, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
- { 16015, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
- { 16037, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
- { 16057, 0x00000D51 }, /* GL_INDEX_BITS */
- { 16071, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
- { 16092, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
- { 16110, 0x00000C30 }, /* GL_INDEX_MODE */
- { 16124, 0x00000D13 }, /* GL_INDEX_OFFSET */
- { 16140, 0x00000D12 }, /* GL_INDEX_SHIFT */
- { 16155, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
- { 16174, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
- { 16193, 0x00001404 }, /* GL_INT */
- { 16200, 0x00008049 }, /* GL_INTENSITY */
- { 16213, 0x0000804C }, /* GL_INTENSITY12 */
- { 16228, 0x0000804C }, /* GL_INTENSITY12_EXT */
- { 16247, 0x0000804D }, /* GL_INTENSITY16 */
- { 16262, 0x00008D8B }, /* GL_INTENSITY16I_EXT */
- { 16282, 0x00008D79 }, /* GL_INTENSITY16UI_EXT */
- { 16303, 0x0000804D }, /* GL_INTENSITY16_EXT */
- { 16322, 0x00008D85 }, /* GL_INTENSITY32I_EXT */
- { 16342, 0x00008D73 }, /* GL_INTENSITY32UI_EXT */
- { 16363, 0x0000804A }, /* GL_INTENSITY4 */
- { 16377, 0x0000804A }, /* GL_INTENSITY4_EXT */
- { 16395, 0x0000804B }, /* GL_INTENSITY8 */
- { 16409, 0x00008D91 }, /* GL_INTENSITY8I_EXT */
- { 16428, 0x00008D7F }, /* GL_INTENSITY8UI_EXT */
- { 16448, 0x0000804B }, /* GL_INTENSITY8_EXT */
- { 16466, 0x00008049 }, /* GL_INTENSITY_EXT */
- { 16483, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS */
- { 16506, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS_EXT */
- { 16533, 0x00008575 }, /* GL_INTERPOLATE */
- { 16548, 0x00008575 }, /* GL_INTERPOLATE_ARB */
- { 16567, 0x00008575 }, /* GL_INTERPOLATE_EXT */
- { 16586, 0x00008DF7 }, /* GL_INT_10_10_10_2_OES */
- { 16608, 0x00008DC9 }, /* GL_INT_SAMPLER_1D */
- { 16626, 0x00008DCE }, /* GL_INT_SAMPLER_1D_ARRAY */
- { 16650, 0x00008DCE }, /* GL_INT_SAMPLER_1D_ARRAY_EXT */
- { 16678, 0x00008DC9 }, /* GL_INT_SAMPLER_1D_EXT */
- { 16700, 0x00008DCA }, /* GL_INT_SAMPLER_2D */
- { 16718, 0x00008DCF }, /* GL_INT_SAMPLER_2D_ARRAY */
- { 16742, 0x00008DCF }, /* GL_INT_SAMPLER_2D_ARRAY_EXT */
- { 16770, 0x00008DCA }, /* GL_INT_SAMPLER_2D_EXT */
- { 16792, 0x00008DCD }, /* GL_INT_SAMPLER_2D_RECT */
- { 16815, 0x00008DCD }, /* GL_INT_SAMPLER_2D_RECT_EXT */
- { 16842, 0x00008DCB }, /* GL_INT_SAMPLER_3D */
- { 16860, 0x00008DCB }, /* GL_INT_SAMPLER_3D_EXT */
- { 16882, 0x00008DD0 }, /* GL_INT_SAMPLER_BUFFER */
- { 16904, 0x00008DD0 }, /* GL_INT_SAMPLER_BUFFER_EXT */
- { 16930, 0x00008DCC }, /* GL_INT_SAMPLER_CUBE */
- { 16950, 0x00008DCC }, /* GL_INT_SAMPLER_CUBE_EXT */
- { 16974, 0x00008B53 }, /* GL_INT_VEC2 */
- { 16986, 0x00008B53 }, /* GL_INT_VEC2_ARB */
- { 17002, 0x00008B54 }, /* GL_INT_VEC3 */
- { 17014, 0x00008B54 }, /* GL_INT_VEC3_ARB */
- { 17030, 0x00008B55 }, /* GL_INT_VEC4 */
- { 17042, 0x00008B55 }, /* GL_INT_VEC4_ARB */
- { 17058, 0x00000500 }, /* GL_INVALID_ENUM */
- { 17074, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
- { 17107, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
- { 17144, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_OES */
- { 17181, 0x00000502 }, /* GL_INVALID_OPERATION */
- { 17202, 0x00000501 }, /* GL_INVALID_VALUE */
- { 17219, 0x0000862B }, /* GL_INVERSE_NV */
- { 17233, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
- { 17257, 0x0000150A }, /* GL_INVERT */
- { 17267, 0x00001E00 }, /* GL_KEEP */
- { 17275, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */
- { 17301, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
- { 17331, 0x00000406 }, /* GL_LEFT */
- { 17339, 0x00000203 }, /* GL_LEQUAL */
- { 17349, 0x00000201 }, /* GL_LESS */
- { 17357, 0x00004000 }, /* GL_LIGHT0 */
- { 17367, 0x00004001 }, /* GL_LIGHT1 */
- { 17377, 0x00004002 }, /* GL_LIGHT2 */
- { 17387, 0x00004003 }, /* GL_LIGHT3 */
- { 17397, 0x00004004 }, /* GL_LIGHT4 */
- { 17407, 0x00004005 }, /* GL_LIGHT5 */
- { 17417, 0x00004006 }, /* GL_LIGHT6 */
- { 17427, 0x00004007 }, /* GL_LIGHT7 */
- { 17437, 0x00000B50 }, /* GL_LIGHTING */
- { 17449, 0x00000040 }, /* GL_LIGHTING_BIT */
- { 17465, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
- { 17488, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
- { 17517, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
- { 17550, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
- { 17578, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
- { 17602, 0x00001B01 }, /* GL_LINE */
- { 17610, 0x00002601 }, /* GL_LINEAR */
- { 17620, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
- { 17642, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
- { 17672, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
- { 17703, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
- { 17727, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
- { 17752, 0x00000001 }, /* GL_LINES */
- { 17761, 0x0000000A }, /* GL_LINES_ADJACENCY */
- { 17780, 0x0000000A }, /* GL_LINES_ADJACENCY_ARB */
- { 17803, 0x00000004 }, /* GL_LINE_BIT */
- { 17815, 0x00000002 }, /* GL_LINE_LOOP */
- { 17828, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
- { 17848, 0x00000B20 }, /* GL_LINE_SMOOTH */
- { 17863, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
- { 17883, 0x00000B24 }, /* GL_LINE_STIPPLE */
- { 17899, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
- { 17923, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
- { 17946, 0x00000003 }, /* GL_LINE_STRIP */
- { 17960, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY */
- { 17984, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY_ARB */
- { 18012, 0x00000702 }, /* GL_LINE_TOKEN */
- { 18026, 0x00000B21 }, /* GL_LINE_WIDTH */
- { 18040, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
- { 18066, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
- { 18086, 0x00008B82 }, /* GL_LINK_STATUS */
- { 18101, 0x00000B32 }, /* GL_LIST_BASE */
- { 18114, 0x00020000 }, /* GL_LIST_BIT */
- { 18126, 0x00000B33 }, /* GL_LIST_INDEX */
- { 18140, 0x00000B30 }, /* GL_LIST_MODE */
- { 18153, 0x00000101 }, /* GL_LOAD */
- { 18161, 0x00000BF1 }, /* GL_LOGIC_OP */
- { 18173, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
- { 18190, 0x00008CA1 }, /* GL_LOWER_LEFT */
- { 18204, 0x00008DF0 }, /* GL_LOW_FLOAT */
- { 18217, 0x00008DF3 }, /* GL_LOW_INT */
- { 18228, 0x00001909 }, /* GL_LUMINANCE */
- { 18241, 0x00008041 }, /* GL_LUMINANCE12 */
- { 18256, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
- { 18279, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
- { 18306, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
- { 18328, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
- { 18354, 0x00008041 }, /* GL_LUMINANCE12_EXT */
- { 18373, 0x00008042 }, /* GL_LUMINANCE16 */
- { 18388, 0x00008D8C }, /* GL_LUMINANCE16I_EXT */
- { 18408, 0x00008D7A }, /* GL_LUMINANCE16UI_EXT */
- { 18429, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
- { 18452, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
- { 18479, 0x00008042 }, /* GL_LUMINANCE16_EXT */
- { 18498, 0x00008D86 }, /* GL_LUMINANCE32I_EXT */
- { 18518, 0x00008D74 }, /* GL_LUMINANCE32UI_EXT */
- { 18539, 0x0000803F }, /* GL_LUMINANCE4 */
- { 18553, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
- { 18574, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
- { 18599, 0x0000803F }, /* GL_LUMINANCE4_EXT */
- { 18617, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
- { 18638, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
- { 18663, 0x00008040 }, /* GL_LUMINANCE8 */
- { 18677, 0x00008D92 }, /* GL_LUMINANCE8I_EXT */
- { 18696, 0x00008D80 }, /* GL_LUMINANCE8UI_EXT */
- { 18716, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
- { 18737, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
- { 18762, 0x00008040 }, /* GL_LUMINANCE8_EXT */
- { 18780, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
- { 18799, 0x00008D8D }, /* GL_LUMINANCE_ALPHA16I_EXT */
- { 18825, 0x00008D7B }, /* GL_LUMINANCE_ALPHA16UI_EXT */
- { 18852, 0x00008D87 }, /* GL_LUMINANCE_ALPHA32I_EXT */
- { 18878, 0x00008D75 }, /* GL_LUMINANCE_ALPHA32UI_EXT */
- { 18905, 0x00008D93 }, /* GL_LUMINANCE_ALPHA8I_EXT */
- { 18930, 0x00008D81 }, /* GL_LUMINANCE_ALPHA8UI_EXT */
- { 18956, 0x00008D9D }, /* GL_LUMINANCE_ALPHA_INTEGER_EXT */
- { 18987, 0x00008D9C }, /* GL_LUMINANCE_INTEGER_EXT */
- { 19012, 0x0000821B }, /* GL_MAJOR_VERSION */
- { 19029, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
- { 19045, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
- { 19065, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
- { 19087, 0x00000D91 }, /* GL_MAP1_INDEX */
- { 19101, 0x00000D92 }, /* GL_MAP1_NORMAL */
- { 19116, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
- { 19140, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
- { 19164, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
- { 19188, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
- { 19212, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
- { 19229, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
- { 19246, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
- { 19274, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
- { 19303, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
- { 19332, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
- { 19361, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
- { 19390, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
- { 19419, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
- { 19448, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
- { 19476, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
- { 19504, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
- { 19532, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
- { 19560, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
- { 19588, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
- { 19616, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
- { 19644, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
- { 19672, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
- { 19700, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
- { 19716, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
- { 19736, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
- { 19758, 0x00000DB1 }, /* GL_MAP2_INDEX */
- { 19772, 0x00000DB2 }, /* GL_MAP2_NORMAL */
- { 19787, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
- { 19811, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
- { 19835, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
- { 19859, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
- { 19883, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
- { 19900, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
- { 19917, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
- { 19945, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
- { 19974, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
- { 20003, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
- { 20032, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
- { 20061, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
- { 20090, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
- { 20119, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
- { 20147, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
- { 20175, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
- { 20203, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
- { 20231, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
- { 20259, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
- { 20287, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
- { 20315, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
- { 20343, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
- { 20371, 0x00000D10 }, /* GL_MAP_COLOR */
- { 20384, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
- { 20410, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
- { 20439, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
- { 20467, 0x00000001 }, /* GL_MAP_READ_BIT */
- { 20483, 0x00000D11 }, /* GL_MAP_STENCIL */
- { 20498, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
- { 20524, 0x00000002 }, /* GL_MAP_WRITE_BIT */
- { 20541, 0x000088C0 }, /* GL_MATRIX0_ARB */
- { 20556, 0x00008630 }, /* GL_MATRIX0_NV */
- { 20570, 0x000088CA }, /* GL_MATRIX10_ARB */
- { 20586, 0x000088CB }, /* GL_MATRIX11_ARB */
- { 20602, 0x000088CC }, /* GL_MATRIX12_ARB */
- { 20618, 0x000088CD }, /* GL_MATRIX13_ARB */
- { 20634, 0x000088CE }, /* GL_MATRIX14_ARB */
- { 20650, 0x000088CF }, /* GL_MATRIX15_ARB */
- { 20666, 0x000088D0 }, /* GL_MATRIX16_ARB */
- { 20682, 0x000088D1 }, /* GL_MATRIX17_ARB */
- { 20698, 0x000088D2 }, /* GL_MATRIX18_ARB */
- { 20714, 0x000088D3 }, /* GL_MATRIX19_ARB */
- { 20730, 0x000088C1 }, /* GL_MATRIX1_ARB */
- { 20745, 0x00008631 }, /* GL_MATRIX1_NV */
- { 20759, 0x000088D4 }, /* GL_MATRIX20_ARB */
- { 20775, 0x000088D5 }, /* GL_MATRIX21_ARB */
- { 20791, 0x000088D6 }, /* GL_MATRIX22_ARB */
- { 20807, 0x000088D7 }, /* GL_MATRIX23_ARB */
- { 20823, 0x000088D8 }, /* GL_MATRIX24_ARB */
- { 20839, 0x000088D9 }, /* GL_MATRIX25_ARB */
- { 20855, 0x000088DA }, /* GL_MATRIX26_ARB */
- { 20871, 0x000088DB }, /* GL_MATRIX27_ARB */
- { 20887, 0x000088DC }, /* GL_MATRIX28_ARB */
- { 20903, 0x000088DD }, /* GL_MATRIX29_ARB */
- { 20919, 0x000088C2 }, /* GL_MATRIX2_ARB */
- { 20934, 0x00008632 }, /* GL_MATRIX2_NV */
- { 20948, 0x000088DE }, /* GL_MATRIX30_ARB */
- { 20964, 0x000088DF }, /* GL_MATRIX31_ARB */
- { 20980, 0x000088C3 }, /* GL_MATRIX3_ARB */
- { 20995, 0x00008633 }, /* GL_MATRIX3_NV */
- { 21009, 0x000088C4 }, /* GL_MATRIX4_ARB */
- { 21024, 0x00008634 }, /* GL_MATRIX4_NV */
- { 21038, 0x000088C5 }, /* GL_MATRIX5_ARB */
- { 21053, 0x00008635 }, /* GL_MATRIX5_NV */
- { 21067, 0x000088C6 }, /* GL_MATRIX6_ARB */
- { 21082, 0x00008636 }, /* GL_MATRIX6_NV */
- { 21096, 0x000088C7 }, /* GL_MATRIX7_ARB */
- { 21111, 0x00008637 }, /* GL_MATRIX7_NV */
- { 21125, 0x000088C8 }, /* GL_MATRIX8_ARB */
- { 21140, 0x000088C9 }, /* GL_MATRIX9_ARB */
- { 21155, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
- { 21181, 0x00008B9E }, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */
- { 21222, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_OES */
- { 21248, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
- { 21282, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_OES */
- { 21316, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
- { 21347, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_OES */
- { 21378, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
- { 21411, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_OES */
- { 21444, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
- { 21475, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_OES */
- { 21506, 0x00000BA0 }, /* GL_MATRIX_MODE */
- { 21521, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
- { 21543, 0x00008840 }, /* GL_MATRIX_PALETTE_OES */
- { 21565, 0x00008008 }, /* GL_MAX */
- { 21572, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
- { 21595, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE_OES */
- { 21622, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS */
- { 21650, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
- { 21682, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
- { 21708, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
- { 21741, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
- { 21767, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- { 21801, 0x00000D32 }, /* GL_MAX_CLIP_DISTANCES */
- { 21823, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
- { 21842, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */
- { 21867, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
- { 21896, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
- { 21928, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
- { 21964, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
- { 22000, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
- { 22040, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
- { 22066, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
- { 22096, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
- { 22121, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
- { 22150, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
- { 22179, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
- { 22212, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES */
- { 22245, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
- { 22265, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
- { 22289, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
- { 22313, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
- { 22337, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
- { 22362, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
- { 22380, 0x00008008 }, /* GL_MAX_EXT */
- { 22391, 0x00009125 }, /* GL_MAX_FRAGMENT_INPUT_COMPONENTS */
- { 22424, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
- { 22459, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
- { 22498, 0x00008DFD }, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */
- { 22530, 0x00009123 }, /* GL_MAX_GEOMETRY_INPUT_COMPONENTS */
- { 22563, 0x00009124 }, /* GL_MAX_GEOMETRY_OUTPUT_COMPONENTS */
- { 22597, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES */
- { 22629, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB */
- { 22665, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS */
- { 22701, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB */
- { 22741, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS */
- { 22781, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB */
- { 22825, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS */
- { 22860, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB */
- { 22899, 0x00008DDD }, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */
- { 22938, 0x00000D31 }, /* GL_MAX_LIGHTS */
- { 22952, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
- { 22972, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
- { 23010, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
- { 23039, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
- { 23063, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
- { 23091, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_OES */
- { 23119, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
- { 23142, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
- { 23179, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
- { 23215, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
- { 23242, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
- { 23271, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
- { 23305, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
- { 23341, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
- { 23368, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
- { 23400, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
- { 23436, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
- { 23465, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
- { 23494, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
- { 23522, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
- { 23560, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- { 23604, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- { 23647, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
- { 23681, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- { 23720, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
- { 23757, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
- { 23795, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- { 23838, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- { 23881, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
- { 23911, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
- { 23942, 0x00008905 }, /* GL_MAX_PROGRAM_TEXEL_OFFSET */
- { 23970, 0x00008905 }, /* GL_MAX_PROGRAM_TEXEL_OFFSET_EXT */
- { 24002, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
- { 24038, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
- { 24074, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
- { 24104, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE */
- { 24134, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
- { 24168, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
- { 24201, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */
- { 24226, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
- { 24255, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_OES */
- { 24284, 0x00008D57 }, /* GL_MAX_SAMPLES */
- { 24299, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */
- { 24318, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
- { 24345, 0x00008504 }, /* GL_MAX_SHININESS_NV */
- { 24365, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
- { 24389, 0x00008C2B }, /* GL_MAX_TEXTURE_BUFFER_SIZE */
- { 24416, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
- { 24438, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
- { 24464, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
- { 24491, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
- { 24522, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
- { 24546, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS_EXT */
- { 24574, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
- { 24608, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
- { 24628, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
- { 24655, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
- { 24676, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
- { 24701, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
- { 24726, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
- { 24761, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS */
- { 24810, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT */
- { 24863, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS */
- { 24906, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT */
- { 24953, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS */
- { 24999, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT */
- { 25049, 0x00008B4B }, /* GL_MAX_VARYING_COMPONENTS */
- { 25075, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
- { 25097, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
- { 25123, 0x00008DFC }, /* GL_MAX_VARYING_VECTORS */
- { 25146, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
- { 25168, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
- { 25194, 0x00009122 }, /* GL_MAX_VERTEX_OUTPUT_COMPONENTS */
- { 25226, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
- { 25260, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
- { 25298, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
- { 25331, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
- { 25368, 0x00008DFB }, /* GL_MAX_VERTEX_UNIFORM_VECTORS */
- { 25398, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
- { 25422, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_OES */
- { 25446, 0x00008DDE }, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */
- { 25483, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
- { 25504, 0x00008DF1 }, /* GL_MEDIUM_FLOAT */
- { 25520, 0x00008DF4 }, /* GL_MEDIUM_INT */
- { 25534, 0x00008007 }, /* GL_MIN */
- { 25541, 0x0000802E }, /* GL_MINMAX */
- { 25551, 0x0000802E }, /* GL_MINMAX_EXT */
- { 25565, 0x0000802F }, /* GL_MINMAX_FORMAT */
- { 25582, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
- { 25603, 0x00008030 }, /* GL_MINMAX_SINK */
- { 25618, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
- { 25637, 0x0000821C }, /* GL_MINOR_VERSION */
- { 25654, 0x00008007 }, /* GL_MIN_EXT */
- { 25665, 0x00008904 }, /* GL_MIN_PROGRAM_TEXEL_OFFSET */
- { 25693, 0x00008904 }, /* GL_MIN_PROGRAM_TEXEL_OFFSET_EXT */
- { 25725, 0x00008370 }, /* GL_MIRRORED_REPEAT */
- { 25744, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
- { 25767, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
- { 25790, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
- { 25810, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
- { 25830, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
- { 25860, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
- { 25888, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
- { 25916, 0x00001700 }, /* GL_MODELVIEW */
- { 25929, 0x00001700 }, /* GL_MODELVIEW0_ARB */
- { 25947, 0x0000872A }, /* GL_MODELVIEW10_ARB */
- { 25966, 0x0000872B }, /* GL_MODELVIEW11_ARB */
- { 25985, 0x0000872C }, /* GL_MODELVIEW12_ARB */
- { 26004, 0x0000872D }, /* GL_MODELVIEW13_ARB */
- { 26023, 0x0000872E }, /* GL_MODELVIEW14_ARB */
- { 26042, 0x0000872F }, /* GL_MODELVIEW15_ARB */
- { 26061, 0x00008730 }, /* GL_MODELVIEW16_ARB */
- { 26080, 0x00008731 }, /* GL_MODELVIEW17_ARB */
- { 26099, 0x00008732 }, /* GL_MODELVIEW18_ARB */
- { 26118, 0x00008733 }, /* GL_MODELVIEW19_ARB */
- { 26137, 0x0000850A }, /* GL_MODELVIEW1_ARB */
- { 26155, 0x00008734 }, /* GL_MODELVIEW20_ARB */
- { 26174, 0x00008735 }, /* GL_MODELVIEW21_ARB */
- { 26193, 0x00008736 }, /* GL_MODELVIEW22_ARB */
- { 26212, 0x00008737 }, /* GL_MODELVIEW23_ARB */
- { 26231, 0x00008738 }, /* GL_MODELVIEW24_ARB */
- { 26250, 0x00008739 }, /* GL_MODELVIEW25_ARB */
- { 26269, 0x0000873A }, /* GL_MODELVIEW26_ARB */
- { 26288, 0x0000873B }, /* GL_MODELVIEW27_ARB */
- { 26307, 0x0000873C }, /* GL_MODELVIEW28_ARB */
- { 26326, 0x0000873D }, /* GL_MODELVIEW29_ARB */
- { 26345, 0x00008722 }, /* GL_MODELVIEW2_ARB */
- { 26363, 0x0000873E }, /* GL_MODELVIEW30_ARB */
- { 26382, 0x0000873F }, /* GL_MODELVIEW31_ARB */
- { 26401, 0x00008723 }, /* GL_MODELVIEW3_ARB */
- { 26419, 0x00008724 }, /* GL_MODELVIEW4_ARB */
- { 26437, 0x00008725 }, /* GL_MODELVIEW5_ARB */
- { 26455, 0x00008726 }, /* GL_MODELVIEW6_ARB */
- { 26473, 0x00008727 }, /* GL_MODELVIEW7_ARB */
- { 26491, 0x00008728 }, /* GL_MODELVIEW8_ARB */
- { 26509, 0x00008729 }, /* GL_MODELVIEW9_ARB */
- { 26527, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
- { 26547, 0x0000898D }, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */
- { 26589, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
- { 26616, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
- { 26641, 0x00002100 }, /* GL_MODULATE */
- { 26653, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
- { 26673, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
- { 26700, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
- { 26725, 0x00000103 }, /* GL_MULT */
- { 26733, 0x0000809D }, /* GL_MULTISAMPLE */
- { 26748, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
- { 26768, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
- { 26787, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
- { 26806, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
- { 26830, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
- { 26853, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
- { 26883, 0x00002A25 }, /* GL_N3F_V3F */
- { 26894, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
- { 26914, 0x0000150E }, /* GL_NAND */
- { 26922, 0x00002600 }, /* GL_NEAREST */
- { 26933, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
- { 26964, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
- { 26996, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
- { 27021, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
- { 27047, 0x00000200 }, /* GL_NEVER */
- { 27056, 0x00001102 }, /* GL_NICEST */
- { 27066, 0x00000000 }, /* GL_NONE */
- { 27074, 0x00000000 }, /* GL_NONE_OES */
- { 27086, 0x00001505 }, /* GL_NOOP */
- { 27094, 0x00001508 }, /* GL_NOR */
- { 27101, 0x00000BA1 }, /* GL_NORMALIZE */
- { 27114, 0x00008075 }, /* GL_NORMAL_ARRAY */
- { 27130, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
- { 27161, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
- { 27196, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
- { 27220, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
- { 27243, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
- { 27264, 0x00008511 }, /* GL_NORMAL_MAP */
- { 27278, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
- { 27296, 0x00008511 }, /* GL_NORMAL_MAP_NV */
- { 27313, 0x00008511 }, /* GL_NORMAL_MAP_OES */
- { 27331, 0x00000205 }, /* GL_NOTEQUAL */
- { 27343, 0x00000000 }, /* GL_NO_ERROR */
- { 27355, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
- { 27389, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
- { 27427, 0x0000821D }, /* GL_NUM_EXTENSIONS */
- { 27445, 0x000087FE }, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */
- { 27479, 0x00008DF9 }, /* GL_NUM_SHADER_BINARY_FORMATS */
- { 27508, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
- { 27540, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
- { 27582, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
- { 27612, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
- { 27652, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
- { 27683, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
- { 27712, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
- { 27740, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
- { 27770, 0x00002401 }, /* GL_OBJECT_LINEAR */
- { 27787, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
- { 27813, 0x00002501 }, /* GL_OBJECT_PLANE */
- { 27829, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
- { 27864, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
- { 27886, 0x00009112 }, /* GL_OBJECT_TYPE */
- { 27901, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
- { 27920, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
- { 27950, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
- { 27971, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
- { 27999, 0x00000001 }, /* GL_ONE */
- { 28006, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
- { 28034, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
- { 28066, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
- { 28094, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
- { 28126, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
- { 28149, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
- { 28172, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
- { 28195, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
- { 28218, 0x00008598 }, /* GL_OPERAND0_ALPHA */
- { 28236, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
- { 28258, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
- { 28280, 0x00008590 }, /* GL_OPERAND0_RGB */
- { 28296, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
- { 28316, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
- { 28336, 0x00008599 }, /* GL_OPERAND1_ALPHA */
- { 28354, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
- { 28376, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
- { 28398, 0x00008591 }, /* GL_OPERAND1_RGB */
- { 28414, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
- { 28434, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
- { 28454, 0x0000859A }, /* GL_OPERAND2_ALPHA */
- { 28472, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
- { 28494, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
- { 28516, 0x00008592 }, /* GL_OPERAND2_RGB */
- { 28532, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
- { 28552, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
- { 28572, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
- { 28593, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
- { 28612, 0x00001507 }, /* GL_OR */
- { 28618, 0x00000A01 }, /* GL_ORDER */
- { 28627, 0x0000150D }, /* GL_OR_INVERTED */
- { 28642, 0x0000150B }, /* GL_OR_REVERSE */
- { 28656, 0x00000505 }, /* GL_OUT_OF_MEMORY */
- { 28673, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
- { 28691, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
- { 28712, 0x00008758 }, /* GL_PACK_INVERT_MESA */
- { 28732, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
- { 28750, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
- { 28769, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
- { 28789, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
- { 28809, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
- { 28827, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
- { 28846, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
- { 28871, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
- { 28895, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
- { 28916, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
- { 28938, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
- { 28960, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
- { 28985, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
- { 29009, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
- { 29030, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
- { 29052, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
- { 29074, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
- { 29096, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
- { 29127, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
- { 29147, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
- { 29172, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
- { 29192, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
- { 29217, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
- { 29237, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
- { 29262, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
- { 29282, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
- { 29307, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
- { 29327, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
- { 29352, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
- { 29372, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
- { 29397, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
- { 29417, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
- { 29442, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
- { 29462, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
- { 29487, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
- { 29507, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
- { 29532, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
- { 29552, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
- { 29577, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
- { 29595, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
- { 29616, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
- { 29645, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
- { 29678, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
- { 29703, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
- { 29726, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
- { 29757, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
- { 29792, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
- { 29819, 0x00001B00 }, /* GL_POINT */
- { 29828, 0x00000000 }, /* GL_POINTS */
- { 29838, 0x00000002 }, /* GL_POINT_BIT */
- { 29851, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
- { 29881, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
- { 29915, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
- { 29949, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
- { 29984, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
- { 30013, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
- { 30046, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
- { 30079, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
- { 30113, 0x00000B11 }, /* GL_POINT_SIZE */
- { 30127, 0x00008B9F }, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */
- { 30166, 0x00008B9C }, /* GL_POINT_SIZE_ARRAY_OES */
- { 30190, 0x0000898C }, /* GL_POINT_SIZE_ARRAY_POINTER_OES */
- { 30222, 0x0000898B }, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */
- { 30253, 0x0000898A }, /* GL_POINT_SIZE_ARRAY_TYPE_OES */
- { 30282, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
- { 30308, 0x00008127 }, /* GL_POINT_SIZE_MAX */
- { 30326, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
- { 30348, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
- { 30370, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
- { 30393, 0x00008126 }, /* GL_POINT_SIZE_MIN */
- { 30411, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
- { 30433, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
- { 30455, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
- { 30478, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
- { 30498, 0x00000B10 }, /* GL_POINT_SMOOTH */
- { 30514, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
- { 30535, 0x00008861 }, /* GL_POINT_SPRITE */
- { 30551, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
- { 30571, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
- { 30600, 0x00008861 }, /* GL_POINT_SPRITE_NV */
- { 30619, 0x00008861 }, /* GL_POINT_SPRITE_OES */
- { 30639, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
- { 30665, 0x00000701 }, /* GL_POINT_TOKEN */
- { 30680, 0x00000009 }, /* GL_POLYGON */
- { 30691, 0x00000008 }, /* GL_POLYGON_BIT */
- { 30706, 0x00000B40 }, /* GL_POLYGON_MODE */
- { 30722, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
- { 30745, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
- { 30770, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
- { 30793, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
- { 30816, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
- { 30840, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
- { 30864, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
- { 30882, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
- { 30905, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
- { 30924, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
- { 30947, 0x00000703 }, /* GL_POLYGON_TOKEN */
- { 30964, 0x00001203 }, /* GL_POSITION */
- { 30976, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
- { 31008, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
- { 31044, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
- { 31077, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
- { 31114, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
- { 31145, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
- { 31180, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
- { 31212, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
- { 31248, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
- { 31281, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
- { 31313, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
- { 31349, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
- { 31382, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
- { 31419, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
- { 31449, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
- { 31483, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
- { 31514, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
- { 31549, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
- { 31580, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
- { 31615, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
- { 31647, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
- { 31683, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
- { 31713, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
- { 31747, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
- { 31778, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
- { 31813, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
- { 31845, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
- { 31876, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
- { 31911, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
- { 31943, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
- { 31979, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
- { 32008, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
- { 32041, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
- { 32071, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
- { 32105, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
- { 32144, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
- { 32177, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
- { 32217, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
- { 32251, 0x00008578 }, /* GL_PREVIOUS */
- { 32263, 0x00008578 }, /* GL_PREVIOUS_ARB */
- { 32279, 0x00008578 }, /* GL_PREVIOUS_EXT */
- { 32295, 0x00008577 }, /* GL_PRIMARY_COLOR */
- { 32312, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
- { 32333, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
- { 32354, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED */
- { 32378, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED_EXT */
- { 32406, 0x00008F9D }, /* GL_PRIMITIVE_RESTART */
- { 32427, 0x00008F9E }, /* GL_PRIMITIVE_RESTART_INDEX */
- { 32454, 0x00008559 }, /* GL_PRIMITIVE_RESTART_INDEX_NV */
- { 32484, 0x00008558 }, /* GL_PRIMITIVE_RESTART_NV */
- { 32508, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
- { 32541, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
- { 32573, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
- { 32596, 0x000087FF }, /* GL_PROGRAM_BINARY_FORMATS_OES */
- { 32626, 0x00008741 }, /* GL_PROGRAM_BINARY_LENGTH_OES */
- { 32655, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
- { 32678, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
- { 32708, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
- { 32737, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
- { 32765, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
- { 32787, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
- { 32815, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
- { 32843, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
- { 32865, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
- { 32886, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- { 32926, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- { 32965, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
- { 32995, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- { 33030, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
- { 33063, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
- { 33097, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- { 33136, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- { 33175, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
- { 33197, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
- { 33223, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
- { 33247, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE */
- { 33269, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE_ARB */
- { 33295, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
- { 33318, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
- { 33340, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
- { 33361, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
- { 33382, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
- { 33409, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
- { 33441, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
- { 33473, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
- { 33508, 0x00001701 }, /* GL_PROJECTION */
- { 33522, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
- { 33543, 0x0000898E }, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */
- { 33586, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
- { 33612, 0x00008E4F }, /* GL_PROVOKING_VERTEX */
- { 33632, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
- { 33656, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
- { 33677, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
- { 33696, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
- { 33719, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
- { 33758, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
- { 33796, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
- { 33816, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY */
- { 33842, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
- { 33872, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
- { 33896, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
- { 33916, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY */
- { 33942, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
- { 33972, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
- { 33996, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
- { 34016, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
- { 34049, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
- { 34075, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
- { 34105, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE */
- { 34132, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
- { 34163, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
- { 34193, 0x00008A1D }, /* GL_PURGEABLE_APPLE */
- { 34212, 0x00002003 }, /* GL_Q */
- { 34217, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
- { 34242, 0x00000007 }, /* GL_QUADS */
- { 34251, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
- { 34295, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
- { 34343, 0x00008614 }, /* GL_QUAD_MESH_SUN */
- { 34360, 0x00000008 }, /* GL_QUAD_STRIP */
- { 34374, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT */
- { 34401, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
- { 34431, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT */
- { 34455, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */
- { 34482, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
- { 34504, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
- { 34530, 0x00008E14 }, /* GL_QUERY_NO_WAIT */
- { 34547, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */
- { 34567, 0x00008866 }, /* GL_QUERY_RESULT */
- { 34583, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
- { 34603, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
- { 34629, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
- { 34659, 0x00008E13 }, /* GL_QUERY_WAIT */
- { 34673, 0x00008E13 }, /* GL_QUERY_WAIT_NV */
- { 34690, 0x00002002 }, /* GL_R */
- { 34695, 0x00008C3A }, /* GL_R11F_G11F_B10F */
- { 34713, 0x00008F98 }, /* GL_R16_SNORM */
- { 34726, 0x00002A10 }, /* GL_R3_G3_B2 */
- { 34738, 0x00008F94 }, /* GL_R8_SNORM */
- { 34750, 0x00008C89 }, /* GL_RASTERIZER_DISCARD */
- { 34772, 0x00008C89 }, /* GL_RASTERIZER_DISCARD_EXT */
- { 34798, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
- { 34831, 0x00000C02 }, /* GL_READ_BUFFER */
- { 34846, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
- { 34866, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */
- { 34894, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
- { 34926, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
- { 34950, 0x000088B8 }, /* GL_READ_ONLY */
- { 34963, 0x000088B8 }, /* GL_READ_ONLY_ARB */
- { 34980, 0x000088BA }, /* GL_READ_WRITE */
- { 34994, 0x000088BA }, /* GL_READ_WRITE_ARB */
- { 35012, 0x00001903 }, /* GL_RED */
- { 35019, 0x00008016 }, /* GL_REDUCE */
- { 35029, 0x00008016 }, /* GL_REDUCE_EXT */
- { 35043, 0x00000D15 }, /* GL_RED_BIAS */
- { 35055, 0x00000D52 }, /* GL_RED_BITS */
- { 35067, 0x00008D94 }, /* GL_RED_INTEGER */
- { 35082, 0x00008D94 }, /* GL_RED_INTEGER_EXT */
- { 35101, 0x00000D14 }, /* GL_RED_SCALE */
- { 35114, 0x00008F90 }, /* GL_RED_SNORM */
- { 35127, 0x00008512 }, /* GL_REFLECTION_MAP */
- { 35145, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
- { 35167, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
- { 35188, 0x00008512 }, /* GL_REFLECTION_MAP_OES */
- { 35210, 0x00008A19 }, /* GL_RELEASED_APPLE */
- { 35228, 0x00001C00 }, /* GL_RENDER */
- { 35238, 0x00008D41 }, /* GL_RENDERBUFFER */
- { 35254, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
- { 35281, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE_OES */
- { 35312, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */
- { 35336, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
- { 35364, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_OES */
- { 35392, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
- { 35418, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE_OES */
- { 35448, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
- { 35475, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE_OES */
- { 35506, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
- { 35526, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
- { 35553, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE_OES */
- { 35584, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
- { 35607, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
- { 35634, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_OES */
- { 35661, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
- { 35693, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
- { 35729, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_OES */
- { 35765, 0x00008D41 }, /* GL_RENDERBUFFER_OES */
- { 35785, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
- { 35810, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE_OES */
- { 35839, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
- { 35863, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */
- { 35891, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
- { 35920, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE_OES */
- { 35953, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
- { 35975, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
- { 36001, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_OES */
- { 36027, 0x00001F01 }, /* GL_RENDERER */
- { 36039, 0x00000C40 }, /* GL_RENDER_MODE */
- { 36054, 0x00002901 }, /* GL_REPEAT */
- { 36064, 0x00001E01 }, /* GL_REPLACE */
- { 36075, 0x00008062 }, /* GL_REPLACE_EXT */
- { 36090, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
- { 36113, 0x0000803A }, /* GL_RESCALE_NORMAL */
- { 36131, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
- { 36153, 0x00008A1B }, /* GL_RETAINED_APPLE */
- { 36171, 0x00000102 }, /* GL_RETURN */
- { 36181, 0x00008F99 }, /* GL_RG16_SNORM */
- { 36195, 0x00008F95 }, /* GL_RG8_SNORM */
- { 36208, 0x00001907 }, /* GL_RGB */
- { 36215, 0x00008052 }, /* GL_RGB10 */
- { 36224, 0x00008059 }, /* GL_RGB10_A2 */
- { 36236, 0x00008059 }, /* GL_RGB10_A2_EXT */
- { 36252, 0x00008052 }, /* GL_RGB10_EXT */
- { 36265, 0x00008053 }, /* GL_RGB12 */
- { 36274, 0x00008053 }, /* GL_RGB12_EXT */
- { 36287, 0x00008054 }, /* GL_RGB16 */
- { 36296, 0x0000881B }, /* GL_RGB16F */
- { 36306, 0x00008D89 }, /* GL_RGB16I */
- { 36316, 0x00008D89 }, /* GL_RGB16I_EXT */
- { 36330, 0x00008D77 }, /* GL_RGB16UI */
- { 36341, 0x00008D77 }, /* GL_RGB16UI_EXT */
- { 36356, 0x00008054 }, /* GL_RGB16_EXT */
- { 36369, 0x00008F9A }, /* GL_RGB16_SNORM */
- { 36384, 0x0000804E }, /* GL_RGB2_EXT */
- { 36396, 0x00008815 }, /* GL_RGB32F */
- { 36406, 0x00008D83 }, /* GL_RGB32I */
- { 36416, 0x00008D83 }, /* GL_RGB32I_EXT */
- { 36430, 0x00008D71 }, /* GL_RGB32UI */
- { 36441, 0x00008D71 }, /* GL_RGB32UI_EXT */
- { 36456, 0x0000804F }, /* GL_RGB4 */
- { 36464, 0x0000804F }, /* GL_RGB4_EXT */
- { 36476, 0x000083A1 }, /* GL_RGB4_S3TC */
- { 36489, 0x00008050 }, /* GL_RGB5 */
- { 36497, 0x00008D62 }, /* GL_RGB565 */
- { 36507, 0x00008D62 }, /* GL_RGB565_OES */
- { 36521, 0x00008057 }, /* GL_RGB5_A1 */
- { 36532, 0x00008057 }, /* GL_RGB5_A1_EXT */
- { 36547, 0x00008057 }, /* GL_RGB5_A1_OES */
- { 36562, 0x00008050 }, /* GL_RGB5_EXT */
- { 36574, 0x00008051 }, /* GL_RGB8 */
- { 36582, 0x00008D8F }, /* GL_RGB8I */
- { 36591, 0x00008D8F }, /* GL_RGB8I_EXT */
- { 36604, 0x00008D7D }, /* GL_RGB8UI */
- { 36614, 0x00008D7D }, /* GL_RGB8UI_EXT */
- { 36628, 0x00008051 }, /* GL_RGB8_EXT */
- { 36640, 0x00008051 }, /* GL_RGB8_OES */
- { 36652, 0x00008F96 }, /* GL_RGB8_SNORM */
- { 36666, 0x00008C3D }, /* GL_RGB9_E5 */
- { 36677, 0x00001908 }, /* GL_RGBA */
- { 36685, 0x0000805A }, /* GL_RGBA12 */
- { 36695, 0x0000805A }, /* GL_RGBA12_EXT */
- { 36709, 0x0000805B }, /* GL_RGBA16 */
- { 36719, 0x0000881A }, /* GL_RGBA16F */
- { 36730, 0x00008D88 }, /* GL_RGBA16I */
- { 36741, 0x00008D88 }, /* GL_RGBA16I_EXT */
- { 36756, 0x00008D76 }, /* GL_RGBA16UI */
- { 36768, 0x00008D76 }, /* GL_RGBA16UI_EXT */
- { 36784, 0x0000805B }, /* GL_RGBA16_EXT */
- { 36798, 0x00008F9B }, /* GL_RGBA16_SNORM */
- { 36814, 0x00008055 }, /* GL_RGBA2 */
- { 36823, 0x00008055 }, /* GL_RGBA2_EXT */
- { 36836, 0x00008814 }, /* GL_RGBA32F */
- { 36847, 0x00008D82 }, /* GL_RGBA32I */
- { 36858, 0x00008D82 }, /* GL_RGBA32I_EXT */
- { 36873, 0x00008D70 }, /* GL_RGBA32UI */
- { 36885, 0x00008D70 }, /* GL_RGBA32UI_EXT */
- { 36901, 0x00008056 }, /* GL_RGBA4 */
- { 36910, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
- { 36929, 0x00008056 }, /* GL_RGBA4_EXT */
- { 36942, 0x00008056 }, /* GL_RGBA4_OES */
- { 36955, 0x000083A3 }, /* GL_RGBA4_S3TC */
- { 36969, 0x00008058 }, /* GL_RGBA8 */
- { 36978, 0x00008D8E }, /* GL_RGBA8I */
- { 36988, 0x00008D8E }, /* GL_RGBA8I_EXT */
- { 37002, 0x00008D7C }, /* GL_RGBA8UI */
- { 37013, 0x00008D7C }, /* GL_RGBA8UI_EXT */
- { 37028, 0x00008058 }, /* GL_RGBA8_EXT */
- { 37041, 0x00008058 }, /* GL_RGBA8_OES */
- { 37054, 0x00008F97 }, /* GL_RGBA8_SNORM */
- { 37069, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
- { 37087, 0x00008D99 }, /* GL_RGBA_INTEGER */
- { 37103, 0x00008D99 }, /* GL_RGBA_INTEGER_EXT */
- { 37123, 0x00008D9E }, /* GL_RGBA_INTEGER_MODE_EXT */
- { 37148, 0x00000C31 }, /* GL_RGBA_MODE */
- { 37161, 0x000083A2 }, /* GL_RGBA_S3TC */
- { 37174, 0x00008F93 }, /* GL_RGBA_SNORM */
- { 37188, 0x00008D98 }, /* GL_RGB_INTEGER */
- { 37203, 0x00008D98 }, /* GL_RGB_INTEGER_EXT */
- { 37222, 0x000083A0 }, /* GL_RGB_S3TC */
- { 37234, 0x00008573 }, /* GL_RGB_SCALE */
- { 37247, 0x00008573 }, /* GL_RGB_SCALE_ARB */
- { 37264, 0x00008573 }, /* GL_RGB_SCALE_EXT */
- { 37281, 0x00008F92 }, /* GL_RGB_SNORM */
- { 37294, 0x00008F91 }, /* GL_RG_SNORM */
- { 37306, 0x00000407 }, /* GL_RIGHT */
- { 37315, 0x00002000 }, /* GL_S */
- { 37320, 0x00008B5D }, /* GL_SAMPLER_1D */
- { 37334, 0x00008DC0 }, /* GL_SAMPLER_1D_ARRAY */
- { 37354, 0x00008DC0 }, /* GL_SAMPLER_1D_ARRAY_EXT */
- { 37378, 0x00008DC3 }, /* GL_SAMPLER_1D_ARRAY_SHADOW */
- { 37405, 0x00008DC3 }, /* GL_SAMPLER_1D_ARRAY_SHADOW_EXT */
- { 37436, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
- { 37457, 0x00008B5E }, /* GL_SAMPLER_2D */
- { 37471, 0x00008DC1 }, /* GL_SAMPLER_2D_ARRAY */
- { 37491, 0x00008DC1 }, /* GL_SAMPLER_2D_ARRAY_EXT */
- { 37515, 0x00008DC4 }, /* GL_SAMPLER_2D_ARRAY_SHADOW */
- { 37542, 0x00008DC4 }, /* GL_SAMPLER_2D_ARRAY_SHADOW_EXT */
- { 37573, 0x00008B63 }, /* GL_SAMPLER_2D_RECT */
- { 37592, 0x00008B64 }, /* GL_SAMPLER_2D_RECT_SHADOW */
- { 37618, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
- { 37639, 0x00008B5F }, /* GL_SAMPLER_3D */
- { 37653, 0x00008B5F }, /* GL_SAMPLER_3D_OES */
- { 37671, 0x00008DC2 }, /* GL_SAMPLER_BUFFER */
- { 37689, 0x00008DC2 }, /* GL_SAMPLER_BUFFER_EXT */
- { 37711, 0x00008B60 }, /* GL_SAMPLER_CUBE */
- { 37727, 0x00008DC5 }, /* GL_SAMPLER_CUBE_SHADOW */
- { 37750, 0x00008DC5 }, /* GL_SAMPLER_CUBE_SHADOW_EXT */
- { 37777, 0x000080A9 }, /* GL_SAMPLES */
- { 37788, 0x000086B4 }, /* GL_SAMPLES_3DFX */
- { 37804, 0x000080A9 }, /* GL_SAMPLES_ARB */
- { 37819, 0x00008914 }, /* GL_SAMPLES_PASSED */
- { 37837, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
- { 37859, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
- { 37887, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
- { 37919, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
- { 37942, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
- { 37969, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
- { 37987, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
- { 38010, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
- { 38032, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
- { 38051, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
- { 38074, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
- { 38100, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
- { 38130, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
- { 38155, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
- { 38184, 0x00080000 }, /* GL_SCISSOR_BIT */
- { 38199, 0x00000C10 }, /* GL_SCISSOR_BOX */
- { 38214, 0x00000C11 }, /* GL_SCISSOR_TEST */
- { 38230, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
- { 38255, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
- { 38295, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
- { 38339, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
- { 38372, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
- { 38402, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
- { 38434, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
- { 38464, 0x00001C02 }, /* GL_SELECT */
- { 38474, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
- { 38502, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
- { 38527, 0x00008012 }, /* GL_SEPARABLE_2D */
- { 38543, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS */
- { 38563, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS_EXT */
- { 38587, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
- { 38614, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
- { 38645, 0x0000150F }, /* GL_SET */
- { 38652, 0x00008DF8 }, /* GL_SHADER_BINARY_FORMATS */
- { 38677, 0x00008DFA }, /* GL_SHADER_COMPILER */
- { 38696, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
- { 38717, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
- { 38741, 0x00008B4F }, /* GL_SHADER_TYPE */
- { 38756, 0x00000B54 }, /* GL_SHADE_MODEL */
- { 38771, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
- { 38799, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
- { 38822, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
- { 38852, 0x00001601 }, /* GL_SHININESS */
- { 38865, 0x00001402 }, /* GL_SHORT */
- { 38874, 0x00009119 }, /* GL_SIGNALED */
- { 38886, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
- { 38907, 0x000081F9 }, /* GL_SINGLE_COLOR */
- { 38923, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
- { 38943, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
- { 38962, 0x00008C46 }, /* GL_SLUMINANCE */
- { 38976, 0x00008C47 }, /* GL_SLUMINANCE8 */
- { 38991, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
- { 39013, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
- { 39033, 0x00001D01 }, /* GL_SMOOTH */
- { 39043, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
- { 39076, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
- { 39103, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
- { 39136, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
- { 39163, 0x00008588 }, /* GL_SOURCE0_ALPHA */
- { 39180, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
- { 39201, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
- { 39222, 0x00008580 }, /* GL_SOURCE0_RGB */
- { 39237, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
- { 39256, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
- { 39275, 0x00008589 }, /* GL_SOURCE1_ALPHA */
- { 39292, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
- { 39313, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
- { 39334, 0x00008581 }, /* GL_SOURCE1_RGB */
- { 39349, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
- { 39368, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
- { 39387, 0x0000858A }, /* GL_SOURCE2_ALPHA */
- { 39404, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
- { 39425, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
- { 39446, 0x00008582 }, /* GL_SOURCE2_RGB */
- { 39461, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
- { 39480, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
- { 39499, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
- { 39519, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
- { 39537, 0x00001202 }, /* GL_SPECULAR */
- { 39549, 0x00002402 }, /* GL_SPHERE_MAP */
- { 39563, 0x00001206 }, /* GL_SPOT_CUTOFF */
- { 39578, 0x00001204 }, /* GL_SPOT_DIRECTION */
- { 39596, 0x00001205 }, /* GL_SPOT_EXPONENT */
- { 39613, 0x00008588 }, /* GL_SRC0_ALPHA */
- { 39627, 0x00008580 }, /* GL_SRC0_RGB */
- { 39639, 0x00008589 }, /* GL_SRC1_ALPHA */
- { 39653, 0x00008581 }, /* GL_SRC1_RGB */
- { 39665, 0x0000858A }, /* GL_SRC2_ALPHA */
- { 39679, 0x00008582 }, /* GL_SRC2_RGB */
- { 39691, 0x00000302 }, /* GL_SRC_ALPHA */
- { 39704, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
- { 39726, 0x00000300 }, /* GL_SRC_COLOR */
- { 39739, 0x00008C40 }, /* GL_SRGB */
- { 39747, 0x00008C41 }, /* GL_SRGB8 */
- { 39756, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
- { 39772, 0x00008C42 }, /* GL_SRGB_ALPHA */
- { 39786, 0x00000503 }, /* GL_STACK_OVERFLOW */
- { 39804, 0x00000504 }, /* GL_STACK_UNDERFLOW */
- { 39823, 0x000088E6 }, /* GL_STATIC_COPY */
- { 39838, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
- { 39857, 0x000088E4 }, /* GL_STATIC_DRAW */
- { 39872, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
- { 39891, 0x000088E5 }, /* GL_STATIC_READ */
- { 39906, 0x000088E5 }, /* GL_STATIC_READ_ARB */
- { 39925, 0x00001802 }, /* GL_STENCIL */
- { 39936, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
- { 39958, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
- { 39984, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_OES */
- { 40010, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
- { 40031, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
- { 40056, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
- { 40077, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
- { 40102, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
- { 40134, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
- { 40170, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
- { 40202, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
- { 40238, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
- { 40258, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
- { 40285, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
- { 40311, 0x00000D57 }, /* GL_STENCIL_BITS */
- { 40327, 0x00008224 }, /* GL_STENCIL_BUFFER */
- { 40345, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
- { 40367, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
- { 40390, 0x00000B94 }, /* GL_STENCIL_FAIL */
- { 40406, 0x00000B92 }, /* GL_STENCIL_FUNC */
- { 40422, 0x00001901 }, /* GL_STENCIL_INDEX */
- { 40439, 0x00008D46 }, /* GL_STENCIL_INDEX1 */
- { 40457, 0x00008D49 }, /* GL_STENCIL_INDEX16 */
- { 40476, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
- { 40499, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
- { 40521, 0x00008D46 }, /* GL_STENCIL_INDEX1_OES */
- { 40543, 0x00008D47 }, /* GL_STENCIL_INDEX4 */
- { 40561, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
- { 40583, 0x00008D47 }, /* GL_STENCIL_INDEX4_OES */
- { 40605, 0x00008D48 }, /* GL_STENCIL_INDEX8 */
- { 40623, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
- { 40645, 0x00008D48 }, /* GL_STENCIL_INDEX8_OES */
- { 40667, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
- { 40688, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
- { 40715, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
- { 40742, 0x00000B97 }, /* GL_STENCIL_REF */
- { 40757, 0x00000B90 }, /* GL_STENCIL_TEST */
- { 40773, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
- { 40802, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
- { 40824, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
- { 40845, 0x00000C33 }, /* GL_STEREO */
- { 40855, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
- { 40879, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
- { 40904, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
- { 40928, 0x000088E2 }, /* GL_STREAM_COPY */
- { 40943, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
- { 40962, 0x000088E0 }, /* GL_STREAM_DRAW */
- { 40977, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
- { 40996, 0x000088E1 }, /* GL_STREAM_READ */
- { 41011, 0x000088E1 }, /* GL_STREAM_READ_ARB */
- { 41030, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
- { 41047, 0x000084E7 }, /* GL_SUBTRACT */
- { 41059, 0x000084E7 }, /* GL_SUBTRACT_ARB */
- { 41075, 0x00009113 }, /* GL_SYNC_CONDITION */
- { 41093, 0x00009116 }, /* GL_SYNC_FENCE */
- { 41107, 0x00009115 }, /* GL_SYNC_FLAGS */
- { 41121, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
- { 41148, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
- { 41178, 0x00009114 }, /* GL_SYNC_STATUS */
- { 41193, 0x00002001 }, /* GL_T */
- { 41198, 0x00002A2A }, /* GL_T2F_C3F_V3F */
- { 41213, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
- { 41232, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
- { 41248, 0x00002A2B }, /* GL_T2F_N3F_V3F */
- { 41263, 0x00002A27 }, /* GL_T2F_V3F */
- { 41274, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
- { 41293, 0x00002A28 }, /* GL_T4F_V4F */
- { 41304, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
- { 41327, 0x00001702 }, /* GL_TEXTURE */
- { 41338, 0x000084C0 }, /* GL_TEXTURE0 */
- { 41350, 0x000084C0 }, /* GL_TEXTURE0_ARB */
- { 41366, 0x000084C1 }, /* GL_TEXTURE1 */
- { 41378, 0x000084CA }, /* GL_TEXTURE10 */
- { 41391, 0x000084CA }, /* GL_TEXTURE10_ARB */
- { 41408, 0x000084CB }, /* GL_TEXTURE11 */
- { 41421, 0x000084CB }, /* GL_TEXTURE11_ARB */
- { 41438, 0x000084CC }, /* GL_TEXTURE12 */
- { 41451, 0x000084CC }, /* GL_TEXTURE12_ARB */
- { 41468, 0x000084CD }, /* GL_TEXTURE13 */
- { 41481, 0x000084CD }, /* GL_TEXTURE13_ARB */
- { 41498, 0x000084CE }, /* GL_TEXTURE14 */
- { 41511, 0x000084CE }, /* GL_TEXTURE14_ARB */
- { 41528, 0x000084CF }, /* GL_TEXTURE15 */
- { 41541, 0x000084CF }, /* GL_TEXTURE15_ARB */
- { 41558, 0x000084D0 }, /* GL_TEXTURE16 */
- { 41571, 0x000084D0 }, /* GL_TEXTURE16_ARB */
- { 41588, 0x000084D1 }, /* GL_TEXTURE17 */
- { 41601, 0x000084D1 }, /* GL_TEXTURE17_ARB */
- { 41618, 0x000084D2 }, /* GL_TEXTURE18 */
- { 41631, 0x000084D2 }, /* GL_TEXTURE18_ARB */
- { 41648, 0x000084D3 }, /* GL_TEXTURE19 */
- { 41661, 0x000084D3 }, /* GL_TEXTURE19_ARB */
- { 41678, 0x000084C1 }, /* GL_TEXTURE1_ARB */
- { 41694, 0x000084C2 }, /* GL_TEXTURE2 */
- { 41706, 0x000084D4 }, /* GL_TEXTURE20 */
- { 41719, 0x000084D4 }, /* GL_TEXTURE20_ARB */
- { 41736, 0x000084D5 }, /* GL_TEXTURE21 */
- { 41749, 0x000084D5 }, /* GL_TEXTURE21_ARB */
- { 41766, 0x000084D6 }, /* GL_TEXTURE22 */
- { 41779, 0x000084D6 }, /* GL_TEXTURE22_ARB */
- { 41796, 0x000084D7 }, /* GL_TEXTURE23 */
- { 41809, 0x000084D7 }, /* GL_TEXTURE23_ARB */
- { 41826, 0x000084D8 }, /* GL_TEXTURE24 */
- { 41839, 0x000084D8 }, /* GL_TEXTURE24_ARB */
- { 41856, 0x000084D9 }, /* GL_TEXTURE25 */
- { 41869, 0x000084D9 }, /* GL_TEXTURE25_ARB */
- { 41886, 0x000084DA }, /* GL_TEXTURE26 */
- { 41899, 0x000084DA }, /* GL_TEXTURE26_ARB */
- { 41916, 0x000084DB }, /* GL_TEXTURE27 */
- { 41929, 0x000084DB }, /* GL_TEXTURE27_ARB */
- { 41946, 0x000084DC }, /* GL_TEXTURE28 */
- { 41959, 0x000084DC }, /* GL_TEXTURE28_ARB */
- { 41976, 0x000084DD }, /* GL_TEXTURE29 */
- { 41989, 0x000084DD }, /* GL_TEXTURE29_ARB */
- { 42006, 0x000084C2 }, /* GL_TEXTURE2_ARB */
- { 42022, 0x000084C3 }, /* GL_TEXTURE3 */
- { 42034, 0x000084DE }, /* GL_TEXTURE30 */
- { 42047, 0x000084DE }, /* GL_TEXTURE30_ARB */
- { 42064, 0x000084DF }, /* GL_TEXTURE31 */
- { 42077, 0x000084DF }, /* GL_TEXTURE31_ARB */
- { 42094, 0x000084C3 }, /* GL_TEXTURE3_ARB */
- { 42110, 0x000084C4 }, /* GL_TEXTURE4 */
- { 42122, 0x000084C4 }, /* GL_TEXTURE4_ARB */
- { 42138, 0x000084C5 }, /* GL_TEXTURE5 */
- { 42150, 0x000084C5 }, /* GL_TEXTURE5_ARB */
- { 42166, 0x000084C6 }, /* GL_TEXTURE6 */
- { 42178, 0x000084C6 }, /* GL_TEXTURE6_ARB */
- { 42194, 0x000084C7 }, /* GL_TEXTURE7 */
- { 42206, 0x000084C7 }, /* GL_TEXTURE7_ARB */
- { 42222, 0x000084C8 }, /* GL_TEXTURE8 */
- { 42234, 0x000084C8 }, /* GL_TEXTURE8_ARB */
- { 42250, 0x000084C9 }, /* GL_TEXTURE9 */
- { 42262, 0x000084C9 }, /* GL_TEXTURE9_ARB */
- { 42278, 0x00000DE0 }, /* GL_TEXTURE_1D */
- { 42292, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY */
- { 42312, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
- { 42336, 0x00000DE1 }, /* GL_TEXTURE_2D */
- { 42350, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY */
- { 42370, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
- { 42394, 0x0000806F }, /* GL_TEXTURE_3D */
- { 42408, 0x0000806F }, /* GL_TEXTURE_3D_OES */
- { 42426, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
- { 42448, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
- { 42474, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
- { 42496, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
- { 42518, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY */
- { 42546, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
- { 42578, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
- { 42600, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY */
- { 42628, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
- { 42660, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
- { 42682, 0x0000806A }, /* GL_TEXTURE_BINDING_3D_OES */
- { 42708, 0x00008C2C }, /* GL_TEXTURE_BINDING_BUFFER */
- { 42734, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
- { 42762, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
- { 42794, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_OES */
- { 42826, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE */
- { 42855, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
- { 42888, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
- { 42920, 0x00040000 }, /* GL_TEXTURE_BIT */
- { 42935, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
- { 42956, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
- { 42981, 0x00001005 }, /* GL_TEXTURE_BORDER */
- { 42999, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
- { 43023, 0x00008C2A }, /* GL_TEXTURE_BUFFER */
- { 43041, 0x00008C2D }, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING */
- { 43078, 0x00008C2E }, /* GL_TEXTURE_BUFFER_FORMAT */
- { 43103, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
- { 43134, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
- { 43164, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
- { 43194, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
- { 43229, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
- { 43260, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- { 43298, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
- { 43325, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
- { 43357, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
- { 43391, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
- { 43415, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
- { 43443, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
- { 43467, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
- { 43495, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
- { 43528, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
- { 43552, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
- { 43574, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
- { 43596, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
- { 43622, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
- { 43656, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
- { 43689, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
- { 43726, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
- { 43754, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
- { 43786, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
- { 43809, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
- { 43847, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
- { 43889, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
- { 43920, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
- { 43948, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
- { 43978, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
- { 44006, 0x00008B9D }, /* GL_TEXTURE_CROP_RECT_OES */
- { 44031, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
- { 44051, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
- { 44075, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
- { 44106, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
- { 44141, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES */
- { 44176, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
- { 44207, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
- { 44242, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES */
- { 44277, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
- { 44308, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
- { 44343, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES */
- { 44378, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_OES */
- { 44402, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
- { 44433, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
- { 44468, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES */
- { 44503, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
- { 44534, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
- { 44569, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES */
- { 44604, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
- { 44635, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
- { 44670, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES */
- { 44705, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
- { 44734, 0x00008071 }, /* GL_TEXTURE_DEPTH */
- { 44751, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
- { 44773, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
- { 44799, 0x00002300 }, /* GL_TEXTURE_ENV */
- { 44814, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
- { 44835, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
- { 44855, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
- { 44881, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL_EXT */
- { 44911, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
- { 44931, 0x00002500 }, /* GL_TEXTURE_GEN_MODE_OES */
- { 44955, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
- { 44972, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
- { 44989, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
- { 45006, 0x00008D60 }, /* GL_TEXTURE_GEN_STR_OES */
- { 45029, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
- { 45046, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
- { 45071, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
- { 45093, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
- { 45119, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
- { 45137, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
- { 45163, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
- { 45189, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
- { 45219, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
- { 45246, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
- { 45271, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
- { 45291, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
- { 45315, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
- { 45342, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
- { 45369, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
- { 45396, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
- { 45422, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
- { 45452, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
- { 45474, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
- { 45492, 0x0000898F }, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */
- { 45532, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
- { 45562, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
- { 45590, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
- { 45618, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
- { 45646, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
- { 45667, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
- { 45686, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
- { 45708, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
- { 45727, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
- { 45747, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
- { 45777, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
- { 45808, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE */
- { 45829, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
- { 45854, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
- { 45878, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
- { 45898, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
- { 45922, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
- { 45942, 0x00008C3F }, /* GL_TEXTURE_SHARED_SIZE */
- { 45965, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
- { 45988, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
- { 46012, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */
- { 46040, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
- { 46070, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
- { 46095, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
- { 46129, 0x00001000 }, /* GL_TEXTURE_WIDTH */
- { 46146, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
- { 46164, 0x00008072 }, /* GL_TEXTURE_WRAP_R_OES */
- { 46186, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
- { 46204, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
- { 46222, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
- { 46241, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
- { 46261, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
- { 46280, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
- { 46309, 0x00001000 }, /* GL_TRANSFORM_BIT */
- { 46326, 0x00008E22 }, /* GL_TRANSFORM_FEEDBACK */
- { 46348, 0x00008E25 }, /* GL_TRANSFORM_FEEDBACK_BINDING */
- { 46378, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER */
- { 46407, 0x00008E24 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */
- { 46443, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING */
- { 46480, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT */
- { 46521, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER_EXT */
- { 46554, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE */
- { 46588, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT */
- { 46626, 0x00008E23 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */
- { 46662, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE */
- { 46696, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT */
- { 46734, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START */
- { 46769, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT */
- { 46808, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN */
- { 46849, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT */
- { 46894, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS */
- { 46925, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS_EXT */
- { 46960, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH */
- { 47001, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT */
- { 47046, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
- { 47072, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
- { 47102, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
- { 47134, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
- { 47164, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
- { 47198, 0x0000862C }, /* GL_TRANSPOSE_NV */
- { 47214, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
- { 47245, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
- { 47280, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
- { 47308, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
- { 47340, 0x00000004 }, /* GL_TRIANGLES */
- { 47353, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY */
- { 47376, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY_ARB */
- { 47403, 0x00000006 }, /* GL_TRIANGLE_FAN */
- { 47419, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
- { 47440, 0x00000005 }, /* GL_TRIANGLE_STRIP */
- { 47458, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY */
- { 47486, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY_ARB */
- { 47518, 0x00000001 }, /* GL_TRUE */
- { 47526, 0x00008A1C }, /* GL_UNDEFINED_APPLE */
- { 47545, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
- { 47565, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
- { 47588, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
- { 47608, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
- { 47629, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
- { 47651, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
- { 47673, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
- { 47693, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
- { 47714, 0x00009118 }, /* GL_UNSIGNALED */
- { 47728, 0x00001401 }, /* GL_UNSIGNED_BYTE */
- { 47745, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
- { 47772, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
- { 47795, 0x00001405 }, /* GL_UNSIGNED_INT */
- { 47811, 0x00008C3B }, /* GL_UNSIGNED_INT_10F_11F_11F_REV */
- { 47843, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
- { 47870, 0x00008DF6 }, /* GL_UNSIGNED_INT_10_10_10_2_OES */
- { 47901, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
- { 47922, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */
- { 47947, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
- { 47971, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_OES */
- { 47996, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
- { 48027, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV_EXT */
- { 48062, 0x00008C3E }, /* GL_UNSIGNED_INT_5_9_9_9_REV */
- { 48090, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
- { 48114, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
- { 48142, 0x00008DD1 }, /* GL_UNSIGNED_INT_SAMPLER_1D */
- { 48169, 0x00008DD6 }, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY */
- { 48202, 0x00008DD6 }, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT */
- { 48239, 0x00008DD1 }, /* GL_UNSIGNED_INT_SAMPLER_1D_EXT */
- { 48270, 0x00008DD2 }, /* GL_UNSIGNED_INT_SAMPLER_2D */
- { 48297, 0x00008DD7 }, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY */
- { 48330, 0x00008DD7 }, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT */
- { 48367, 0x00008DD2 }, /* GL_UNSIGNED_INT_SAMPLER_2D_EXT */
- { 48398, 0x00008DD5 }, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT */
- { 48430, 0x00008DD5 }, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT */
- { 48466, 0x00008DD3 }, /* GL_UNSIGNED_INT_SAMPLER_3D */
- { 48493, 0x00008DD3 }, /* GL_UNSIGNED_INT_SAMPLER_3D_EXT */
- { 48524, 0x00008DD8 }, /* GL_UNSIGNED_INT_SAMPLER_BUFFER */
- { 48555, 0x00008DD8 }, /* GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT */
- { 48590, 0x00008DD4 }, /* GL_UNSIGNED_INT_SAMPLER_CUBE */
- { 48619, 0x00008DD4 }, /* GL_UNSIGNED_INT_SAMPLER_CUBE_EXT */
- { 48652, 0x00008DC6 }, /* GL_UNSIGNED_INT_VEC2 */
- { 48673, 0x00008DC6 }, /* GL_UNSIGNED_INT_VEC2_EXT */
- { 48698, 0x00008DC7 }, /* GL_UNSIGNED_INT_VEC3 */
- { 48719, 0x00008DC7 }, /* GL_UNSIGNED_INT_VEC3_EXT */
- { 48744, 0x00008DC8 }, /* GL_UNSIGNED_INT_VEC4 */
- { 48765, 0x00008DC8 }, /* GL_UNSIGNED_INT_VEC4_EXT */
- { 48790, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
- { 48813, 0x00001403 }, /* GL_UNSIGNED_SHORT */
- { 48831, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
- { 48861, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT */
- { 48895, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
- { 48921, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
- { 48951, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT */
- { 48985, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
- { 49011, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
- { 49035, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
- { 49063, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
- { 49091, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
- { 49118, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
- { 49150, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
- { 49181, 0x00008CA2 }, /* GL_UPPER_LEFT */
- { 49195, 0x00002A20 }, /* GL_V2F */
- { 49202, 0x00002A21 }, /* GL_V3F */
- { 49209, 0x00008B83 }, /* GL_VALIDATE_STATUS */
- { 49228, 0x00001F00 }, /* GL_VENDOR */
- { 49238, 0x00001F02 }, /* GL_VERSION */
- { 49249, 0x00008074 }, /* GL_VERTEX_ARRAY */
- { 49265, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
- { 49289, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
- { 49319, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
- { 49350, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
- { 49385, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
- { 49409, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
- { 49430, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
- { 49453, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
- { 49474, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
- { 49501, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
- { 49529, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
- { 49557, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
- { 49585, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
- { 49613, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
- { 49641, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
- { 49669, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
- { 49696, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
- { 49723, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
- { 49750, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
- { 49777, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
- { 49804, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
- { 49831, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
- { 49858, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
- { 49885, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
- { 49912, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
- { 49950, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
- { 49992, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
- { 50023, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
- { 50058, 0x000088FD }, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER */
- { 50089, 0x000088FD }, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT */
- { 50124, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
- { 50158, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
- { 50196, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
- { 50227, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
- { 50262, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
- { 50290, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
- { 50322, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
- { 50352, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
- { 50386, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
- { 50414, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
- { 50446, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
- { 50466, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
- { 50488, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
- { 50517, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
- { 50538, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
- { 50567, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
- { 50600, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
- { 50632, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
- { 50659, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
- { 50690, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
- { 50720, 0x00008B31 }, /* GL_VERTEX_SHADER */
- { 50737, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
- { 50758, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
- { 50785, 0x00000BA2 }, /* GL_VIEWPORT */
- { 50797, 0x00000800 }, /* GL_VIEWPORT_BIT */
- { 50813, 0x00008A1A }, /* GL_VOLATILE_APPLE */
- { 50831, 0x0000911D }, /* GL_WAIT_FAILED */
- { 50846, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
- { 50866, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
- { 50897, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
- { 50932, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_OES */
- { 50967, 0x000086AD }, /* GL_WEIGHT_ARRAY_OES */
- { 50987, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
- { 51015, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_OES */
- { 51043, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
- { 51068, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_OES */
- { 51093, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
- { 51120, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_OES */
- { 51147, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
- { 51172, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_OES */
- { 51197, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
- { 51221, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
- { 51240, 0x000088B9 }, /* GL_WRITE_ONLY */
- { 51254, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
- { 51272, 0x000088B9 }, /* GL_WRITE_ONLY_OES */
- { 51290, 0x00001506 }, /* GL_XOR */
- { 51297, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
- { 51316, 0x00008757 }, /* GL_YCBCR_MESA */
- { 51330, 0x00000000 }, /* GL_ZERO */
- { 51338, 0x00000D16 }, /* GL_ZOOM_X */
- { 51348, 0x00000D17 }, /* GL_ZOOM_Y */
-};
-
-static const unsigned reduced_enums[1551] =
-{
- 535, /* GL_FALSE */
- 827, /* GL_LINES */
- 831, /* GL_LINE_LOOP */
- 838, /* GL_LINE_STRIP */
- 2135, /* GL_TRIANGLES */
- 2140, /* GL_TRIANGLE_STRIP */
- 2138, /* GL_TRIANGLE_FAN */
- 1507, /* GL_QUADS */
- 1511, /* GL_QUAD_STRIP */
- 1378, /* GL_POLYGON */
- 828, /* GL_LINES_ADJACENCY */
- 839, /* GL_LINE_STRIP_ADJACENCY */
- 2136, /* GL_TRIANGLES_ADJACENCY */
- 2141, /* GL_TRIANGLE_STRIP_ADJACENCY */
- 1390, /* GL_POLYGON_STIPPLE_BIT */
- 1333, /* GL_PIXEL_MODE_BIT */
- 814, /* GL_LIGHTING_BIT */
- 568, /* GL_FOG_BIT */
- 8, /* GL_ACCUM */
- 850, /* GL_LOAD */
- 1596, /* GL_RETURN */
- 1200, /* GL_MULT */
- 24, /* GL_ADD */
- 1216, /* GL_NEVER */
- 804, /* GL_LESS */
- 525, /* GL_EQUAL */
- 803, /* GL_LEQUAL */
- 691, /* GL_GREATER */
- 1233, /* GL_NOTEQUAL */
- 690, /* GL_GEQUAL */
- 55, /* GL_ALWAYS */
- 1803, /* GL_SRC_COLOR */
- 1266, /* GL_ONE_MINUS_SRC_COLOR */
- 1801, /* GL_SRC_ALPHA */
- 1265, /* GL_ONE_MINUS_SRC_ALPHA */
- 504, /* GL_DST_ALPHA */
- 1263, /* GL_ONE_MINUS_DST_ALPHA */
- 505, /* GL_DST_COLOR */
- 1264, /* GL_ONE_MINUS_DST_COLOR */
- 1802, /* GL_SRC_ALPHA_SATURATE */
- 667, /* GL_FRONT_LEFT */
- 668, /* GL_FRONT_RIGHT */
- 77, /* GL_BACK_LEFT */
- 78, /* GL_BACK_RIGHT */
- 664, /* GL_FRONT */
- 76, /* GL_BACK */
- 802, /* GL_LEFT */
- 1685, /* GL_RIGHT */
- 665, /* GL_FRONT_AND_BACK */
- 71, /* GL_AUX0 */
- 72, /* GL_AUX1 */
- 73, /* GL_AUX2 */
- 74, /* GL_AUX3 */
- 790, /* GL_INVALID_ENUM */
- 795, /* GL_INVALID_VALUE */
- 794, /* GL_INVALID_OPERATION */
- 1808, /* GL_STACK_OVERFLOW */
- 1809, /* GL_STACK_UNDERFLOW */
- 1291, /* GL_OUT_OF_MEMORY */
- 791, /* GL_INVALID_FRAMEBUFFER_OPERATION */
- 0, /* GL_2D */
- 2, /* GL_3D */
- 3, /* GL_3D_COLOR */
- 4, /* GL_3D_COLOR_TEXTURE */
- 6, /* GL_4D_COLOR_TEXTURE */
- 1311, /* GL_PASS_THROUGH_TOKEN */
- 1377, /* GL_POINT_TOKEN */
- 841, /* GL_LINE_TOKEN */
- 1391, /* GL_POLYGON_TOKEN */
- 87, /* GL_BITMAP_TOKEN */
- 503, /* GL_DRAW_PIXEL_TOKEN */
- 349, /* GL_COPY_PIXEL_TOKEN */
- 832, /* GL_LINE_RESET_TOKEN */
- 528, /* GL_EXP */
- 529, /* GL_EXP2 */
- 386, /* GL_CW */
- 154, /* GL_CCW */
- 184, /* GL_COEFF */
- 1288, /* GL_ORDER */
- 440, /* GL_DOMAIN */
- 359, /* GL_CURRENT_COLOR */
- 362, /* GL_CURRENT_INDEX */
- 368, /* GL_CURRENT_NORMAL */
- 382, /* GL_CURRENT_TEXTURE_COORDS */
- 374, /* GL_CURRENT_RASTER_COLOR */
- 376, /* GL_CURRENT_RASTER_INDEX */
- 380, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
- 377, /* GL_CURRENT_RASTER_POSITION */
- 378, /* GL_CURRENT_RASTER_POSITION_VALID */
- 375, /* GL_CURRENT_RASTER_DISTANCE */
- 1369, /* GL_POINT_SMOOTH */
- 1353, /* GL_POINT_SIZE */
- 1368, /* GL_POINT_SIZE_RANGE */
- 1359, /* GL_POINT_SIZE_GRANULARITY */
- 833, /* GL_LINE_SMOOTH */
- 842, /* GL_LINE_WIDTH */
- 844, /* GL_LINE_WIDTH_RANGE */
- 843, /* GL_LINE_WIDTH_GRANULARITY */
- 835, /* GL_LINE_STIPPLE */
- 836, /* GL_LINE_STIPPLE_PATTERN */
- 837, /* GL_LINE_STIPPLE_REPEAT */
- 849, /* GL_LIST_MODE */
- 1056, /* GL_MAX_LIST_NESTING */
- 846, /* GL_LIST_BASE */
- 848, /* GL_LIST_INDEX */
- 1380, /* GL_POLYGON_MODE */
- 1387, /* GL_POLYGON_SMOOTH */
- 1389, /* GL_POLYGON_STIPPLE */
- 514, /* GL_EDGE_FLAG */
- 352, /* GL_CULL_FACE */
- 353, /* GL_CULL_FACE_MODE */
- 666, /* GL_FRONT_FACE */
- 813, /* GL_LIGHTING */
- 818, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
- 819, /* GL_LIGHT_MODEL_TWO_SIDE */
- 815, /* GL_LIGHT_MODEL_AMBIENT */
- 1750, /* GL_SHADE_MODEL */
- 232, /* GL_COLOR_MATERIAL_FACE */
- 233, /* GL_COLOR_MATERIAL_PARAMETER */
- 231, /* GL_COLOR_MATERIAL */
- 567, /* GL_FOG */
- 589, /* GL_FOG_INDEX */
- 585, /* GL_FOG_DENSITY */
- 593, /* GL_FOG_START */
- 587, /* GL_FOG_END */
- 590, /* GL_FOG_MODE */
- 569, /* GL_FOG_COLOR */
- 425, /* GL_DEPTH_RANGE */
- 434, /* GL_DEPTH_TEST */
- 437, /* GL_DEPTH_WRITEMASK */
- 410, /* GL_DEPTH_CLEAR_VALUE */
- 424, /* GL_DEPTH_FUNC */
- 12, /* GL_ACCUM_CLEAR_VALUE */
- 1853, /* GL_STENCIL_TEST */
- 1834, /* GL_STENCIL_CLEAR_VALUE */
- 1836, /* GL_STENCIL_FUNC */
- 1855, /* GL_STENCIL_VALUE_MASK */
- 1835, /* GL_STENCIL_FAIL */
- 1850, /* GL_STENCIL_PASS_DEPTH_FAIL */
- 1851, /* GL_STENCIL_PASS_DEPTH_PASS */
- 1852, /* GL_STENCIL_REF */
- 1856, /* GL_STENCIL_WRITEMASK */
- 1006, /* GL_MATRIX_MODE */
- 1222, /* GL_NORMALIZE */
- 2266, /* GL_VIEWPORT */
- 1195, /* GL_MODELVIEW_STACK_DEPTH */
- 1481, /* GL_PROJECTION_STACK_DEPTH */
- 2089, /* GL_TEXTURE_STACK_DEPTH */
- 1192, /* GL_MODELVIEW_MATRIX */
- 1479, /* GL_PROJECTION_MATRIX */
- 2069, /* GL_TEXTURE_MATRIX */
- 69, /* GL_ATTRIB_STACK_DEPTH */
- 166, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
- 51, /* GL_ALPHA_TEST */
- 52, /* GL_ALPHA_TEST_FUNC */
- 53, /* GL_ALPHA_TEST_REF */
- 439, /* GL_DITHER */
- 91, /* GL_BLEND_DST */
- 105, /* GL_BLEND_SRC */
- 88, /* GL_BLEND */
- 852, /* GL_LOGIC_OP_MODE */
- 739, /* GL_INDEX_LOGIC_OP */
- 230, /* GL_COLOR_LOGIC_OP */
- 75, /* GL_AUX_BUFFERS */
- 450, /* GL_DRAW_BUFFER */
- 1534, /* GL_READ_BUFFER */
- 1727, /* GL_SCISSOR_BOX */
- 1728, /* GL_SCISSOR_TEST */
- 738, /* GL_INDEX_CLEAR_VALUE */
- 743, /* GL_INDEX_WRITEMASK */
- 227, /* GL_COLOR_CLEAR_VALUE */
- 269, /* GL_COLOR_WRITEMASK */
- 740, /* GL_INDEX_MODE */
- 1674, /* GL_RGBA_MODE */
- 449, /* GL_DOUBLEBUFFER */
- 1857, /* GL_STEREO */
- 1588, /* GL_RENDER_MODE */
- 1312, /* GL_PERSPECTIVE_CORRECTION_HINT */
- 1370, /* GL_POINT_SMOOTH_HINT */
- 834, /* GL_LINE_SMOOTH_HINT */
- 1388, /* GL_POLYGON_SMOOTH_HINT */
- 588, /* GL_FOG_HINT */
- 2049, /* GL_TEXTURE_GEN_S */
- 2051, /* GL_TEXTURE_GEN_T */
- 2048, /* GL_TEXTURE_GEN_R */
- 2047, /* GL_TEXTURE_GEN_Q */
- 1325, /* GL_PIXEL_MAP_I_TO_I */
- 1331, /* GL_PIXEL_MAP_S_TO_S */
- 1327, /* GL_PIXEL_MAP_I_TO_R */
- 1323, /* GL_PIXEL_MAP_I_TO_G */
- 1321, /* GL_PIXEL_MAP_I_TO_B */
- 1319, /* GL_PIXEL_MAP_I_TO_A */
- 1329, /* GL_PIXEL_MAP_R_TO_R */
- 1317, /* GL_PIXEL_MAP_G_TO_G */
- 1315, /* GL_PIXEL_MAP_B_TO_B */
- 1313, /* GL_PIXEL_MAP_A_TO_A */
- 1326, /* GL_PIXEL_MAP_I_TO_I_SIZE */
- 1332, /* GL_PIXEL_MAP_S_TO_S_SIZE */
- 1328, /* GL_PIXEL_MAP_I_TO_R_SIZE */
- 1324, /* GL_PIXEL_MAP_I_TO_G_SIZE */
- 1322, /* GL_PIXEL_MAP_I_TO_B_SIZE */
- 1320, /* GL_PIXEL_MAP_I_TO_A_SIZE */
- 1330, /* GL_PIXEL_MAP_R_TO_R_SIZE */
- 1318, /* GL_PIXEL_MAP_G_TO_G_SIZE */
- 1316, /* GL_PIXEL_MAP_B_TO_B_SIZE */
- 1314, /* GL_PIXEL_MAP_A_TO_A_SIZE */
- 2152, /* GL_UNPACK_SWAP_BYTES */
- 2147, /* GL_UNPACK_LSB_FIRST */
- 2148, /* GL_UNPACK_ROW_LENGTH */
- 2151, /* GL_UNPACK_SKIP_ROWS */
- 2150, /* GL_UNPACK_SKIP_PIXELS */
- 2145, /* GL_UNPACK_ALIGNMENT */
- 1300, /* GL_PACK_SWAP_BYTES */
- 1295, /* GL_PACK_LSB_FIRST */
- 1296, /* GL_PACK_ROW_LENGTH */
- 1299, /* GL_PACK_SKIP_ROWS */
- 1298, /* GL_PACK_SKIP_PIXELS */
- 1292, /* GL_PACK_ALIGNMENT */
- 947, /* GL_MAP_COLOR */
- 952, /* GL_MAP_STENCIL */
- 742, /* GL_INDEX_SHIFT */
- 741, /* GL_INDEX_OFFSET */
- 1550, /* GL_RED_SCALE */
- 1546, /* GL_RED_BIAS */
- 2292, /* GL_ZOOM_X */
- 2293, /* GL_ZOOM_Y */
- 697, /* GL_GREEN_SCALE */
- 693, /* GL_GREEN_BIAS */
- 115, /* GL_BLUE_SCALE */
- 111, /* GL_BLUE_BIAS */
- 50, /* GL_ALPHA_SCALE */
- 47, /* GL_ALPHA_BIAS */
- 426, /* GL_DEPTH_SCALE */
- 402, /* GL_DEPTH_BIAS */
- 1038, /* GL_MAX_EVAL_ORDER */
- 1055, /* GL_MAX_LIGHTS */
- 1018, /* GL_MAX_CLIP_DISTANCES */
- 1110, /* GL_MAX_TEXTURE_SIZE */
- 1062, /* GL_MAX_PIXEL_MAP_TABLE */
- 1014, /* GL_MAX_ATTRIB_STACK_DEPTH */
- 1058, /* GL_MAX_MODELVIEW_STACK_DEPTH */
- 1059, /* GL_MAX_NAME_STACK_DEPTH */
- 1090, /* GL_MAX_PROJECTION_STACK_DEPTH */
- 1111, /* GL_MAX_TEXTURE_STACK_DEPTH */
- 1137, /* GL_MAX_VIEWPORT_DIMS */
- 1015, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
- 1867, /* GL_SUBPIXEL_BITS */
- 737, /* GL_INDEX_BITS */
- 1547, /* GL_RED_BITS */
- 694, /* GL_GREEN_BITS */
- 112, /* GL_BLUE_BITS */
- 48, /* GL_ALPHA_BITS */
- 403, /* GL_DEPTH_BITS */
- 1831, /* GL_STENCIL_BITS */
- 14, /* GL_ACCUM_RED_BITS */
- 13, /* GL_ACCUM_GREEN_BITS */
- 10, /* GL_ACCUM_BLUE_BITS */
- 9, /* GL_ACCUM_ALPHA_BITS */
- 1209, /* GL_NAME_STACK_DEPTH */
- 70, /* GL_AUTO_NORMAL */
- 893, /* GL_MAP1_COLOR_4 */
- 896, /* GL_MAP1_INDEX */
- 897, /* GL_MAP1_NORMAL */
- 898, /* GL_MAP1_TEXTURE_COORD_1 */
- 899, /* GL_MAP1_TEXTURE_COORD_2 */
- 900, /* GL_MAP1_TEXTURE_COORD_3 */
- 901, /* GL_MAP1_TEXTURE_COORD_4 */
- 902, /* GL_MAP1_VERTEX_3 */
- 903, /* GL_MAP1_VERTEX_4 */
- 920, /* GL_MAP2_COLOR_4 */
- 923, /* GL_MAP2_INDEX */
- 924, /* GL_MAP2_NORMAL */
- 925, /* GL_MAP2_TEXTURE_COORD_1 */
- 926, /* GL_MAP2_TEXTURE_COORD_2 */
- 927, /* GL_MAP2_TEXTURE_COORD_3 */
- 928, /* GL_MAP2_TEXTURE_COORD_4 */
- 929, /* GL_MAP2_VERTEX_3 */
- 930, /* GL_MAP2_VERTEX_4 */
- 894, /* GL_MAP1_GRID_DOMAIN */
- 895, /* GL_MAP1_GRID_SEGMENTS */
- 921, /* GL_MAP2_GRID_DOMAIN */
- 922, /* GL_MAP2_GRID_SEGMENTS */
- 1950, /* GL_TEXTURE_1D */
- 1953, /* GL_TEXTURE_2D */
- 538, /* GL_FEEDBACK_BUFFER_POINTER */
- 539, /* GL_FEEDBACK_BUFFER_SIZE */
- 540, /* GL_FEEDBACK_BUFFER_TYPE */
- 1737, /* GL_SELECTION_BUFFER_POINTER */
- 1738, /* GL_SELECTION_BUFFER_SIZE */
- 2095, /* GL_TEXTURE_WIDTH */
- 2055, /* GL_TEXTURE_HEIGHT */
- 1999, /* GL_TEXTURE_COMPONENTS */
- 1980, /* GL_TEXTURE_BORDER_COLOR */
- 1979, /* GL_TEXTURE_BORDER */
- 441, /* GL_DONT_CARE */
- 536, /* GL_FASTEST */
- 1217, /* GL_NICEST */
- 56, /* GL_AMBIENT */
- 438, /* GL_DIFFUSE */
- 1790, /* GL_SPECULAR */
- 1392, /* GL_POSITION */
- 1793, /* GL_SPOT_DIRECTION */
- 1794, /* GL_SPOT_EXPONENT */
- 1792, /* GL_SPOT_CUTOFF */
- 317, /* GL_CONSTANT_ATTENUATION */
- 822, /* GL_LINEAR_ATTENUATION */
- 1506, /* GL_QUADRATIC_ATTENUATION */
- 284, /* GL_COMPILE */
- 285, /* GL_COMPILE_AND_EXECUTE */
- 149, /* GL_BYTE */
- 2154, /* GL_UNSIGNED_BYTE */
- 1755, /* GL_SHORT */
- 2193, /* GL_UNSIGNED_SHORT */
- 745, /* GL_INT */
- 2157, /* GL_UNSIGNED_INT */
- 548, /* GL_FLOAT */
- 1, /* GL_2_BYTES */
- 5, /* GL_3_BYTES */
- 7, /* GL_4_BYTES */
- 448, /* GL_DOUBLE */
- 698, /* GL_HALF_FLOAT */
- 544, /* GL_FIXED */
- 162, /* GL_CLEAR */
- 58, /* GL_AND */
- 60, /* GL_AND_REVERSE */
- 347, /* GL_COPY */
- 59, /* GL_AND_INVERTED */
- 1220, /* GL_NOOP */
- 2288, /* GL_XOR */
- 1287, /* GL_OR */
- 1221, /* GL_NOR */
- 526, /* GL_EQUIV */
- 798, /* GL_INVERT */
- 1290, /* GL_OR_REVERSE */
- 348, /* GL_COPY_INVERTED */
- 1289, /* GL_OR_INVERTED */
- 1210, /* GL_NAND */
- 1744, /* GL_SET */
- 523, /* GL_EMISSION */
- 1754, /* GL_SHININESS */
- 57, /* GL_AMBIENT_AND_DIFFUSE */
- 229, /* GL_COLOR_INDEXES */
- 1159, /* GL_MODELVIEW */
- 1478, /* GL_PROJECTION */
- 1885, /* GL_TEXTURE */
- 185, /* GL_COLOR */
- 395, /* GL_DEPTH */
- 1816, /* GL_STENCIL */
- 228, /* GL_COLOR_INDEX */
- 1837, /* GL_STENCIL_INDEX */
- 411, /* GL_DEPTH_COMPONENT */
- 1543, /* GL_RED */
- 692, /* GL_GREEN */
- 110, /* GL_BLUE */
- 32, /* GL_ALPHA */
- 1599, /* GL_RGB */
- 1639, /* GL_RGBA */
- 856, /* GL_LUMINANCE */
- 883, /* GL_LUMINANCE_ALPHA */
- 86, /* GL_BITMAP */
- 1342, /* GL_POINT */
- 820, /* GL_LINE */
- 541, /* GL_FILL */
- 1557, /* GL_RENDER */
- 537, /* GL_FEEDBACK */
- 1736, /* GL_SELECT */
- 547, /* GL_FLAT */
- 1765, /* GL_SMOOTH */
- 799, /* GL_KEEP */
- 1590, /* GL_REPLACE */
- 727, /* GL_INCR */
- 391, /* GL_DECR */
- 2210, /* GL_VENDOR */
- 1587, /* GL_RENDERER */
- 2211, /* GL_VERSION */
- 530, /* GL_EXTENSIONS */
- 1686, /* GL_S */
- 1876, /* GL_T */
- 1526, /* GL_R */
- 1505, /* GL_Q */
- 1196, /* GL_MODULATE */
- 390, /* GL_DECAL */
- 2042, /* GL_TEXTURE_ENV_MODE */
- 2041, /* GL_TEXTURE_ENV_COLOR */
- 2040, /* GL_TEXTURE_ENV */
- 531, /* GL_EYE_LINEAR */
- 1248, /* GL_OBJECT_LINEAR */
- 1791, /* GL_SPHERE_MAP */
- 2045, /* GL_TEXTURE_GEN_MODE */
- 1250, /* GL_OBJECT_PLANE */
- 532, /* GL_EYE_PLANE */
- 1211, /* GL_NEAREST */
- 821, /* GL_LINEAR */
- 1215, /* GL_NEAREST_MIPMAP_NEAREST */
- 826, /* GL_LINEAR_MIPMAP_NEAREST */
- 1214, /* GL_NEAREST_MIPMAP_LINEAR */
- 825, /* GL_LINEAR_MIPMAP_LINEAR */
- 2068, /* GL_TEXTURE_MAG_FILTER */
- 2077, /* GL_TEXTURE_MIN_FILTER */
- 2098, /* GL_TEXTURE_WRAP_S */
- 2099, /* GL_TEXTURE_WRAP_T */
- 155, /* GL_CLAMP */
- 1589, /* GL_REPEAT */
- 1386, /* GL_POLYGON_OFFSET_UNITS */
- 1385, /* GL_POLYGON_OFFSET_POINT */
- 1384, /* GL_POLYGON_OFFSET_LINE */
- 1529, /* GL_R3_G3_B2 */
- 2207, /* GL_V2F */
- 2208, /* GL_V3F */
- 152, /* GL_C4UB_V2F */
- 153, /* GL_C4UB_V3F */
- 150, /* GL_C3F_V3F */
- 1208, /* GL_N3F_V3F */
- 151, /* GL_C4F_N3F_V3F */
- 1881, /* GL_T2F_V3F */
- 1883, /* GL_T4F_V4F */
- 1879, /* GL_T2F_C4UB_V3F */
- 1877, /* GL_T2F_C3F_V3F */
- 1880, /* GL_T2F_N3F_V3F */
- 1878, /* GL_T2F_C4F_N3F_V3F */
- 1882, /* GL_T4F_C4F_N3F_V4F */
- 169, /* GL_CLIP_DISTANCE0 */
- 170, /* GL_CLIP_DISTANCE1 */
- 171, /* GL_CLIP_DISTANCE2 */
- 172, /* GL_CLIP_DISTANCE3 */
- 173, /* GL_CLIP_DISTANCE4 */
- 174, /* GL_CLIP_DISTANCE5 */
- 175, /* GL_CLIP_DISTANCE6 */
- 176, /* GL_CLIP_DISTANCE7 */
- 805, /* GL_LIGHT0 */
- 806, /* GL_LIGHT1 */
- 807, /* GL_LIGHT2 */
- 808, /* GL_LIGHT3 */
- 809, /* GL_LIGHT4 */
- 810, /* GL_LIGHT5 */
- 811, /* GL_LIGHT6 */
- 812, /* GL_LIGHT7 */
- 702, /* GL_HINT_BIT */
- 319, /* GL_CONSTANT_COLOR */
- 1261, /* GL_ONE_MINUS_CONSTANT_COLOR */
- 314, /* GL_CONSTANT_ALPHA */
- 1259, /* GL_ONE_MINUS_CONSTANT_ALPHA */
- 89, /* GL_BLEND_COLOR */
- 669, /* GL_FUNC_ADD */
- 1140, /* GL_MIN */
- 1009, /* GL_MAX */
- 96, /* GL_BLEND_EQUATION */
- 675, /* GL_FUNC_SUBTRACT */
- 672, /* GL_FUNC_REVERSE_SUBTRACT */
- 327, /* GL_CONVOLUTION_1D */
- 328, /* GL_CONVOLUTION_2D */
- 1739, /* GL_SEPARABLE_2D */
- 331, /* GL_CONVOLUTION_BORDER_MODE */
- 335, /* GL_CONVOLUTION_FILTER_SCALE */
- 333, /* GL_CONVOLUTION_FILTER_BIAS */
- 1544, /* GL_REDUCE */
- 337, /* GL_CONVOLUTION_FORMAT */
- 341, /* GL_CONVOLUTION_WIDTH */
- 339, /* GL_CONVOLUTION_HEIGHT */
- 1028, /* GL_MAX_CONVOLUTION_WIDTH */
- 1026, /* GL_MAX_CONVOLUTION_HEIGHT */
- 1425, /* GL_POST_CONVOLUTION_RED_SCALE */
- 1421, /* GL_POST_CONVOLUTION_GREEN_SCALE */
- 1416, /* GL_POST_CONVOLUTION_BLUE_SCALE */
- 1412, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
- 1423, /* GL_POST_CONVOLUTION_RED_BIAS */
- 1419, /* GL_POST_CONVOLUTION_GREEN_BIAS */
- 1414, /* GL_POST_CONVOLUTION_BLUE_BIAS */
- 1410, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
- 703, /* GL_HISTOGRAM */
- 1485, /* GL_PROXY_HISTOGRAM */
- 719, /* GL_HISTOGRAM_WIDTH */
- 709, /* GL_HISTOGRAM_FORMAT */
- 715, /* GL_HISTOGRAM_RED_SIZE */
- 711, /* GL_HISTOGRAM_GREEN_SIZE */
- 706, /* GL_HISTOGRAM_BLUE_SIZE */
- 704, /* GL_HISTOGRAM_ALPHA_SIZE */
- 713, /* GL_HISTOGRAM_LUMINANCE_SIZE */
- 717, /* GL_HISTOGRAM_SINK */
- 1141, /* GL_MINMAX */
- 1143, /* GL_MINMAX_FORMAT */
- 1145, /* GL_MINMAX_SINK */
- 1884, /* GL_TABLE_TOO_LARGE_EXT */
- 2156, /* GL_UNSIGNED_BYTE_3_3_2 */
- 2196, /* GL_UNSIGNED_SHORT_4_4_4_4 */
- 2199, /* GL_UNSIGNED_SHORT_5_5_5_1 */
- 2168, /* GL_UNSIGNED_INT_8_8_8_8 */
- 2159, /* GL_UNSIGNED_INT_10_10_10_2 */
- 1383, /* GL_POLYGON_OFFSET_FILL */
- 1382, /* GL_POLYGON_OFFSET_FACTOR */
- 1381, /* GL_POLYGON_OFFSET_BIAS */
- 1593, /* GL_RESCALE_NORMAL */
- 41, /* GL_ALPHA4 */
- 43, /* GL_ALPHA8 */
- 33, /* GL_ALPHA12 */
- 35, /* GL_ALPHA16 */
- 871, /* GL_LUMINANCE4 */
- 877, /* GL_LUMINANCE8 */
- 857, /* GL_LUMINANCE12 */
- 863, /* GL_LUMINANCE16 */
- 872, /* GL_LUMINANCE4_ALPHA4 */
- 875, /* GL_LUMINANCE6_ALPHA2 */
- 880, /* GL_LUMINANCE8_ALPHA8 */
- 860, /* GL_LUMINANCE12_ALPHA4 */
- 858, /* GL_LUMINANCE12_ALPHA12 */
- 866, /* GL_LUMINANCE16_ALPHA16 */
- 746, /* GL_INTENSITY */
- 755, /* GL_INTENSITY4 */
- 757, /* GL_INTENSITY8 */
- 747, /* GL_INTENSITY12 */
- 749, /* GL_INTENSITY16 */
- 1614, /* GL_RGB2_EXT */
- 1620, /* GL_RGB4 */
- 1623, /* GL_RGB5 */
- 1630, /* GL_RGB8 */
- 1600, /* GL_RGB10 */
- 1604, /* GL_RGB12 */
- 1606, /* GL_RGB16 */
- 1650, /* GL_RGBA2 */
- 1657, /* GL_RGBA4 */
- 1626, /* GL_RGB5_A1 */
- 1662, /* GL_RGBA8 */
- 1601, /* GL_RGB10_A2 */
- 1640, /* GL_RGBA12 */
- 1642, /* GL_RGBA16 */
- 2085, /* GL_TEXTURE_RED_SIZE */
- 2053, /* GL_TEXTURE_GREEN_SIZE */
- 1977, /* GL_TEXTURE_BLUE_SIZE */
- 1958, /* GL_TEXTURE_ALPHA_SIZE */
- 2066, /* GL_TEXTURE_LUMINANCE_SIZE */
- 2057, /* GL_TEXTURE_INTENSITY_SIZE */
- 1591, /* GL_REPLACE_EXT */
- 1489, /* GL_PROXY_TEXTURE_1D */
- 1493, /* GL_PROXY_TEXTURE_2D */
- 2093, /* GL_TEXTURE_TOO_LARGE_EXT */
- 2079, /* GL_TEXTURE_PRIORITY */
- 2087, /* GL_TEXTURE_RESIDENT */
- 1961, /* GL_TEXTURE_BINDING_1D */
- 1964, /* GL_TEXTURE_BINDING_2D */
- 1967, /* GL_TEXTURE_BINDING_3D */
- 1297, /* GL_PACK_SKIP_IMAGES */
- 1293, /* GL_PACK_IMAGE_HEIGHT */
- 2149, /* GL_UNPACK_SKIP_IMAGES */
- 2146, /* GL_UNPACK_IMAGE_HEIGHT */
- 1956, /* GL_TEXTURE_3D */
- 1497, /* GL_PROXY_TEXTURE_3D */
- 2037, /* GL_TEXTURE_DEPTH */
- 2096, /* GL_TEXTURE_WRAP_R */
- 1010, /* GL_MAX_3D_TEXTURE_SIZE */
- 2212, /* GL_VERTEX_ARRAY */
- 1223, /* GL_NORMAL_ARRAY */
- 186, /* GL_COLOR_ARRAY */
- 731, /* GL_INDEX_ARRAY */
- 2007, /* GL_TEXTURE_COORD_ARRAY */
- 515, /* GL_EDGE_FLAG_ARRAY */
- 2218, /* GL_VERTEX_ARRAY_SIZE */
- 2220, /* GL_VERTEX_ARRAY_TYPE */
- 2219, /* GL_VERTEX_ARRAY_STRIDE */
- 1228, /* GL_NORMAL_ARRAY_TYPE */
- 1227, /* GL_NORMAL_ARRAY_STRIDE */
- 190, /* GL_COLOR_ARRAY_SIZE */
- 192, /* GL_COLOR_ARRAY_TYPE */
- 191, /* GL_COLOR_ARRAY_STRIDE */
- 736, /* GL_INDEX_ARRAY_TYPE */
- 735, /* GL_INDEX_ARRAY_STRIDE */
- 2011, /* GL_TEXTURE_COORD_ARRAY_SIZE */
- 2013, /* GL_TEXTURE_COORD_ARRAY_TYPE */
- 2012, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
- 519, /* GL_EDGE_FLAG_ARRAY_STRIDE */
- 2217, /* GL_VERTEX_ARRAY_POINTER */
- 1226, /* GL_NORMAL_ARRAY_POINTER */
- 189, /* GL_COLOR_ARRAY_POINTER */
- 734, /* GL_INDEX_ARRAY_POINTER */
- 2010, /* GL_TEXTURE_COORD_ARRAY_POINTER */
- 518, /* GL_EDGE_FLAG_ARRAY_POINTER */
- 1201, /* GL_MULTISAMPLE */
- 1713, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
- 1715, /* GL_SAMPLE_ALPHA_TO_ONE */
- 1720, /* GL_SAMPLE_COVERAGE */
- 1717, /* GL_SAMPLE_BUFFERS */
- 1708, /* GL_SAMPLES */
- 1724, /* GL_SAMPLE_COVERAGE_VALUE */
- 1722, /* GL_SAMPLE_COVERAGE_INVERT */
- 234, /* GL_COLOR_MATRIX */
- 236, /* GL_COLOR_MATRIX_STACK_DEPTH */
- 1022, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
- 1408, /* GL_POST_COLOR_MATRIX_RED_SCALE */
- 1404, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
- 1399, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
- 1395, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
- 1406, /* GL_POST_COLOR_MATRIX_RED_BIAS */
- 1402, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
- 1397, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
- 1393, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
- 1990, /* GL_TEXTURE_COLOR_TABLE_SGI */
- 1498, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
- 1992, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
- 94, /* GL_BLEND_DST_RGB */
- 108, /* GL_BLEND_SRC_RGB */
- 92, /* GL_BLEND_DST_ALPHA */
- 106, /* GL_BLEND_SRC_ALPHA */
- 240, /* GL_COLOR_TABLE */
- 1418, /* GL_POST_CONVOLUTION_COLOR_TABLE */
- 1401, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
- 1484, /* GL_PROXY_COLOR_TABLE */
- 1488, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
- 1487, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
- 264, /* GL_COLOR_TABLE_SCALE */
- 244, /* GL_COLOR_TABLE_BIAS */
- 249, /* GL_COLOR_TABLE_FORMAT */
- 266, /* GL_COLOR_TABLE_WIDTH */
- 261, /* GL_COLOR_TABLE_RED_SIZE */
- 252, /* GL_COLOR_TABLE_GREEN_SIZE */
- 246, /* GL_COLOR_TABLE_BLUE_SIZE */
- 241, /* GL_COLOR_TABLE_ALPHA_SIZE */
- 258, /* GL_COLOR_TABLE_LUMINANCE_SIZE */
- 255, /* GL_COLOR_TABLE_INTENSITY_SIZE */
- 79, /* GL_BGR */
- 80, /* GL_BGRA */
- 1037, /* GL_MAX_ELEMENTS_VERTICES */
- 1036, /* GL_MAX_ELEMENTS_INDICES */
- 2056, /* GL_TEXTURE_INDEX_SIZE_EXT */
- 183, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
- 1364, /* GL_POINT_SIZE_MIN */
- 1360, /* GL_POINT_SIZE_MAX */
- 1349, /* GL_POINT_FADE_THRESHOLD_SIZE */
- 1345, /* GL_POINT_DISTANCE_ATTENUATION */
- 157, /* GL_CLAMP_TO_BORDER */
- 160, /* GL_CLAMP_TO_EDGE */
- 2078, /* GL_TEXTURE_MIN_LOD */
- 2076, /* GL_TEXTURE_MAX_LOD */
- 1960, /* GL_TEXTURE_BASE_LEVEL */
- 2075, /* GL_TEXTURE_MAX_LEVEL */
- 722, /* GL_IGNORE_BORDER_HP */
- 318, /* GL_CONSTANT_BORDER_HP */
- 1592, /* GL_REPLICATE_BORDER_HP */
- 329, /* GL_CONVOLUTION_BORDER_COLOR */
- 1256, /* GL_OCCLUSION_TEST_HP */
- 1257, /* GL_OCCLUSION_TEST_RESULT_HP */
- 823, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
- 1984, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
- 1986, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
- 1988, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
- 1989, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- 1987, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
- 1985, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
- 1016, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
- 1017, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- 1428, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
- 1430, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
- 1427, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
- 1429, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
- 2064, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
- 2065, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
- 2063, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
- 678, /* GL_GENERATE_MIPMAP */
- 679, /* GL_GENERATE_MIPMAP_HINT */
- 591, /* GL_FOG_OFFSET_SGIX */
- 592, /* GL_FOG_OFFSET_VALUE_SGIX */
- 1998, /* GL_TEXTURE_COMPARE_SGIX */
- 1997, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
- 2060, /* GL_TEXTURE_LEQUAL_R_SGIX */
- 2052, /* GL_TEXTURE_GEQUAL_R_SGIX */
- 412, /* GL_DEPTH_COMPONENT16 */
- 416, /* GL_DEPTH_COMPONENT24 */
- 420, /* GL_DEPTH_COMPONENT32 */
- 354, /* GL_CULL_VERTEX_EXT */
- 356, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
- 355, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
- 2284, /* GL_WRAP_BORDER_SUN */
- 1991, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
- 816, /* GL_LIGHT_MODEL_COLOR_CONTROL */
- 1758, /* GL_SINGLE_COLOR */
- 1742, /* GL_SEPARATE_SPECULAR_COLOR */
- 1753, /* GL_SHARED_TEXTURE_PALETTE_EXT */
- 603, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
- 604, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
- 615, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
- 606, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
- 602, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
- 601, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
- 605, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
- 616, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
- 633, /* GL_FRAMEBUFFER_DEFAULT */
- 660, /* GL_FRAMEBUFFER_UNDEFINED */
- 428, /* GL_DEPTH_STENCIL_ATTACHMENT */
- 892, /* GL_MAJOR_VERSION */
- 1147, /* GL_MINOR_VERSION */
- 1237, /* GL_NUM_EXTENSIONS */
- 324, /* GL_CONTEXT_FLAGS */
- 730, /* GL_INDEX */
- 406, /* GL_DEPTH_BUFFER */
- 1832, /* GL_STENCIL_BUFFER */
- 295, /* GL_COMPRESSED_RED */
- 296, /* GL_COMPRESSED_RG */
- 2155, /* GL_UNSIGNED_BYTE_2_3_3_REV */
- 2200, /* GL_UNSIGNED_SHORT_5_6_5 */
- 2201, /* GL_UNSIGNED_SHORT_5_6_5_REV */
- 2197, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
- 2194, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
- 2169, /* GL_UNSIGNED_INT_8_8_8_8_REV */
- 2165, /* GL_UNSIGNED_INT_2_10_10_10_REV */
- 2073, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
- 2074, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
- 2072, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
- 1151, /* GL_MIRRORED_REPEAT */
- 1679, /* GL_RGB_S3TC */
- 1622, /* GL_RGB4_S3TC */
- 1675, /* GL_RGBA_S3TC */
- 1661, /* GL_RGBA4_S3TC */
- 1670, /* GL_RGBA_DXT5_S3TC */
- 1658, /* GL_RGBA4_DXT5_S3TC */
- 306, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
- 301, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
- 302, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
- 303, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
- 1213, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
- 1212, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
- 824, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
- 578, /* GL_FOG_COORDINATE_SOURCE */
- 570, /* GL_FOG_COORD */
- 594, /* GL_FRAGMENT_DEPTH */
- 360, /* GL_CURRENT_FOG_COORD */
- 577, /* GL_FOG_COORDINATE_ARRAY_TYPE */
- 576, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
- 575, /* GL_FOG_COORDINATE_ARRAY_POINTER */
- 572, /* GL_FOG_COORDINATE_ARRAY */
- 238, /* GL_COLOR_SUM */
- 381, /* GL_CURRENT_SECONDARY_COLOR */
- 1733, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
- 1735, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
- 1734, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
- 1732, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
- 1729, /* GL_SECONDARY_COLOR_ARRAY */
- 379, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
- 29, /* GL_ALIASED_POINT_SIZE_RANGE */
- 28, /* GL_ALIASED_LINE_WIDTH_RANGE */
- 1886, /* GL_TEXTURE0 */
- 1888, /* GL_TEXTURE1 */
- 1910, /* GL_TEXTURE2 */
- 1932, /* GL_TEXTURE3 */
- 1938, /* GL_TEXTURE4 */
- 1940, /* GL_TEXTURE5 */
- 1942, /* GL_TEXTURE6 */
- 1944, /* GL_TEXTURE7 */
- 1946, /* GL_TEXTURE8 */
- 1948, /* GL_TEXTURE9 */
- 1889, /* GL_TEXTURE10 */
- 1891, /* GL_TEXTURE11 */
- 1893, /* GL_TEXTURE12 */
- 1895, /* GL_TEXTURE13 */
- 1897, /* GL_TEXTURE14 */
- 1899, /* GL_TEXTURE15 */
- 1901, /* GL_TEXTURE16 */
- 1903, /* GL_TEXTURE17 */
- 1905, /* GL_TEXTURE18 */
- 1907, /* GL_TEXTURE19 */
- 1911, /* GL_TEXTURE20 */
- 1913, /* GL_TEXTURE21 */
- 1915, /* GL_TEXTURE22 */
- 1917, /* GL_TEXTURE23 */
- 1919, /* GL_TEXTURE24 */
- 1921, /* GL_TEXTURE25 */
- 1923, /* GL_TEXTURE26 */
- 1925, /* GL_TEXTURE27 */
- 1927, /* GL_TEXTURE28 */
- 1929, /* GL_TEXTURE29 */
- 1933, /* GL_TEXTURE30 */
- 1935, /* GL_TEXTURE31 */
- 19, /* GL_ACTIVE_TEXTURE */
- 163, /* GL_CLIENT_ACTIVE_TEXTURE */
- 1112, /* GL_MAX_TEXTURE_UNITS */
- 2128, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
- 2131, /* GL_TRANSPOSE_PROJECTION_MATRIX */
- 2133, /* GL_TRANSPOSE_TEXTURE_MATRIX */
- 2125, /* GL_TRANSPOSE_COLOR_MATRIX */
- 1868, /* GL_SUBTRACT */
- 1094, /* GL_MAX_RENDERBUFFER_SIZE */
- 287, /* GL_COMPRESSED_ALPHA */
- 291, /* GL_COMPRESSED_LUMINANCE */
- 292, /* GL_COMPRESSED_LUMINANCE_ALPHA */
- 289, /* GL_COMPRESSED_INTENSITY */
- 297, /* GL_COMPRESSED_RGB */
- 298, /* GL_COMPRESSED_RGBA */
- 2005, /* GL_TEXTURE_COMPRESSION_HINT */
- 2082, /* GL_TEXTURE_RECTANGLE */
- 1973, /* GL_TEXTURE_BINDING_RECTANGLE */
- 1501, /* GL_PROXY_TEXTURE_RECTANGLE */
- 1091, /* GL_MAX_RECTANGLE_TEXTURE_SIZE */
- 427, /* GL_DEPTH_STENCIL */
- 2161, /* GL_UNSIGNED_INT_24_8 */
- 1107, /* GL_MAX_TEXTURE_LOD_BIAS */
- 2071, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
- 1109, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
- 2043, /* GL_TEXTURE_FILTER_CONTROL */
- 2061, /* GL_TEXTURE_LOD_BIAS */
- 271, /* GL_COMBINE4 */
- 1100, /* GL_MAX_SHININESS_NV */
- 1101, /* GL_MAX_SPOT_EXPONENT_NV */
- 728, /* GL_INCR_WRAP */
- 392, /* GL_DECR_WRAP */
- 1171, /* GL_MODELVIEW1_ARB */
- 1229, /* GL_NORMAL_MAP */
- 1552, /* GL_REFLECTION_MAP */
- 2015, /* GL_TEXTURE_CUBE_MAP */
- 1970, /* GL_TEXTURE_BINDING_CUBE_MAP */
- 2027, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
- 2017, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
- 2030, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
- 2020, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
- 2033, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
- 2023, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
- 1499, /* GL_PROXY_TEXTURE_CUBE_MAP */
- 1030, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
- 1207, /* GL_MULTISAMPLE_FILTER_HINT_NV */
- 1442, /* GL_PRIMITIVE_RESTART_NV */
- 1441, /* GL_PRIMITIVE_RESTART_INDEX_NV */
- 586, /* GL_FOG_DISTANCE_MODE_NV */
- 534, /* GL_EYE_RADIAL_NV */
- 533, /* GL_EYE_PLANE_ABSOLUTE_NV */
- 270, /* GL_COMBINE */
- 277, /* GL_COMBINE_RGB */
- 272, /* GL_COMBINE_ALPHA */
- 1680, /* GL_RGB_SCALE */
- 25, /* GL_ADD_SIGNED */
- 764, /* GL_INTERPOLATE */
- 313, /* GL_CONSTANT */
- 1434, /* GL_PRIMARY_COLOR */
- 1431, /* GL_PREVIOUS */
- 1773, /* GL_SOURCE0_RGB */
- 1779, /* GL_SOURCE1_RGB */
- 1785, /* GL_SOURCE2_RGB */
- 1789, /* GL_SOURCE3_RGB_NV */
- 1770, /* GL_SOURCE0_ALPHA */
- 1776, /* GL_SOURCE1_ALPHA */
- 1782, /* GL_SOURCE2_ALPHA */
- 1788, /* GL_SOURCE3_ALPHA_NV */
- 1270, /* GL_OPERAND0_RGB */
- 1276, /* GL_OPERAND1_RGB */
- 1282, /* GL_OPERAND2_RGB */
- 1286, /* GL_OPERAND3_RGB_NV */
- 1267, /* GL_OPERAND0_ALPHA */
- 1273, /* GL_OPERAND1_ALPHA */
- 1279, /* GL_OPERAND2_ALPHA */
- 1285, /* GL_OPERAND3_ALPHA_NV */
- 137, /* GL_BUFFER_OBJECT_APPLE */
- 2213, /* GL_VERTEX_ARRAY_BINDING */
- 2080, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
- 2081, /* GL_TEXTURE_RANGE_POINTER_APPLE */
- 2289, /* GL_YCBCR_422_APPLE */
- 2202, /* GL_UNSIGNED_SHORT_8_8_APPLE */
- 2204, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
- 2092, /* GL_TEXTURE_STORAGE_HINT_APPLE */
- 1859, /* GL_STORAGE_PRIVATE_APPLE */
- 1858, /* GL_STORAGE_CACHED_APPLE */
- 1860, /* GL_STORAGE_SHARED_APPLE */
- 1760, /* GL_SLICE_ACCUM_SUN */
- 1510, /* GL_QUAD_MESH_SUN */
- 2139, /* GL_TRIANGLE_MESH_SUN */
- 2254, /* GL_VERTEX_PROGRAM_ARB */
- 2265, /* GL_VERTEX_STATE_PROGRAM_NV */
- 2239, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
- 2247, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
- 2249, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
- 2251, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
- 383, /* GL_CURRENT_VERTEX_ATTRIB */
- 1455, /* GL_PROGRAM_LENGTH_ARB */
- 1471, /* GL_PROGRAM_STRING_ARB */
- 1194, /* GL_MODELVIEW_PROJECTION_NV */
- 721, /* GL_IDENTITY_NV */
- 796, /* GL_INVERSE_NV */
- 2130, /* GL_TRANSPOSE_NV */
- 797, /* GL_INVERSE_TRANSPOSE_NV */
- 1075, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
- 1074, /* GL_MAX_PROGRAM_MATRICES_ARB */
- 956, /* GL_MATRIX0_NV */
- 968, /* GL_MATRIX1_NV */
- 980, /* GL_MATRIX2_NV */
- 984, /* GL_MATRIX3_NV */
- 986, /* GL_MATRIX4_NV */
- 988, /* GL_MATRIX5_NV */
- 990, /* GL_MATRIX6_NV */
- 992, /* GL_MATRIX7_NV */
- 366, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
- 363, /* GL_CURRENT_MATRIX_ARB */
- 1468, /* GL_PROGRAM_POINT_SIZE */
- 2260, /* GL_VERTEX_PROGRAM_TWO_SIDE */
- 1467, /* GL_PROGRAM_PARAMETER_NV */
- 2245, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
- 1473, /* GL_PROGRAM_TARGET_NV */
- 1470, /* GL_PROGRAM_RESIDENT_NV */
- 2102, /* GL_TRACK_MATRIX_NV */
- 2103, /* GL_TRACK_MATRIX_TRANSFORM_NV */
- 2255, /* GL_VERTEX_PROGRAM_BINDING_NV */
- 1449, /* GL_PROGRAM_ERROR_POSITION_ARB */
- 408, /* GL_DEPTH_CLAMP */
- 2221, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
- 2228, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
- 2229, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
- 2230, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
- 2231, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
- 2232, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
- 2233, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
- 2234, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
- 2235, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
- 2236, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
- 2222, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
- 2223, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
- 2224, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
- 2225, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
- 2226, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
- 2227, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
- 904, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
- 911, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
- 912, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
- 913, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
- 914, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
- 915, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
- 916, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
- 917, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
- 918, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
- 919, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
- 905, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
- 906, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
- 907, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
- 908, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
- 909, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
- 910, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
- 931, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
- 938, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
- 939, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
- 940, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
- 941, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
- 942, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
- 943, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
- 1448, /* GL_PROGRAM_BINDING_ARB */
- 945, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
- 946, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
- 932, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
- 933, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
- 934, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
- 935, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
- 936, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
- 937, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
- 2003, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
- 2000, /* GL_TEXTURE_COMPRESSED */
- 1235, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
- 311, /* GL_COMPRESSED_TEXTURE_FORMATS */
- 1134, /* GL_MAX_VERTEX_UNITS_ARB */
- 23, /* GL_ACTIVE_VERTEX_UNITS_ARB */
- 2283, /* GL_WEIGHT_SUM_UNITY_ARB */
- 2253, /* GL_VERTEX_BLEND_ARB */
- 385, /* GL_CURRENT_WEIGHT_ARB */
- 2281, /* GL_WEIGHT_ARRAY_TYPE_ARB */
- 2279, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
- 2277, /* GL_WEIGHT_ARRAY_SIZE_ARB */
- 2275, /* GL_WEIGHT_ARRAY_POINTER_ARB */
- 2270, /* GL_WEIGHT_ARRAY_ARB */
- 442, /* GL_DOT3_RGB */
- 443, /* GL_DOT3_RGBA */
- 305, /* GL_COMPRESSED_RGB_FXT1_3DFX */
- 300, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
- 1202, /* GL_MULTISAMPLE_3DFX */
- 1718, /* GL_SAMPLE_BUFFERS_3DFX */
- 1709, /* GL_SAMPLES_3DFX */
- 1182, /* GL_MODELVIEW2_ARB */
- 1185, /* GL_MODELVIEW3_ARB */
- 1186, /* GL_MODELVIEW4_ARB */
- 1187, /* GL_MODELVIEW5_ARB */
- 1188, /* GL_MODELVIEW6_ARB */
- 1189, /* GL_MODELVIEW7_ARB */
- 1190, /* GL_MODELVIEW8_ARB */
- 1191, /* GL_MODELVIEW9_ARB */
- 1161, /* GL_MODELVIEW10_ARB */
- 1162, /* GL_MODELVIEW11_ARB */
- 1163, /* GL_MODELVIEW12_ARB */
- 1164, /* GL_MODELVIEW13_ARB */
- 1165, /* GL_MODELVIEW14_ARB */
- 1166, /* GL_MODELVIEW15_ARB */
- 1167, /* GL_MODELVIEW16_ARB */
- 1168, /* GL_MODELVIEW17_ARB */
- 1169, /* GL_MODELVIEW18_ARB */
- 1170, /* GL_MODELVIEW19_ARB */
- 1172, /* GL_MODELVIEW20_ARB */
- 1173, /* GL_MODELVIEW21_ARB */
- 1174, /* GL_MODELVIEW22_ARB */
- 1175, /* GL_MODELVIEW23_ARB */
- 1176, /* GL_MODELVIEW24_ARB */
- 1177, /* GL_MODELVIEW25_ARB */
- 1178, /* GL_MODELVIEW26_ARB */
- 1179, /* GL_MODELVIEW27_ARB */
- 1180, /* GL_MODELVIEW28_ARB */
- 1181, /* GL_MODELVIEW29_ARB */
- 1183, /* GL_MODELVIEW30_ARB */
- 1184, /* GL_MODELVIEW31_ARB */
- 447, /* GL_DOT3_RGB_EXT */
- 445, /* GL_DOT3_RGBA_EXT */
- 1155, /* GL_MIRROR_CLAMP_EXT */
- 1158, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
- 1197, /* GL_MODULATE_ADD_ATI */
- 1198, /* GL_MODULATE_SIGNED_ADD_ATI */
- 1199, /* GL_MODULATE_SUBTRACT_ATI */
- 2290, /* GL_YCBCR_MESA */
- 1294, /* GL_PACK_INVERT_MESA */
- 388, /* GL_DEBUG_OBJECT_MESA */
- 389, /* GL_DEBUG_PRINT_MESA */
- 387, /* GL_DEBUG_ASSERT_MESA */
- 139, /* GL_BUFFER_SIZE */
- 141, /* GL_BUFFER_USAGE */
- 145, /* GL_BUMP_ROT_MATRIX_ATI */
- 146, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
- 144, /* GL_BUMP_NUM_TEX_UNITS_ATI */
- 148, /* GL_BUMP_TEX_UNITS_ATI */
- 507, /* GL_DUDV_ATI */
- 506, /* GL_DU8DV8_ATI */
- 143, /* GL_BUMP_ENVMAP_ATI */
- 147, /* GL_BUMP_TARGET_ATI */
- 1238, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */
- 1446, /* GL_PROGRAM_BINARY_FORMATS_OES */
- 1822, /* GL_STENCIL_BACK_FUNC */
- 1820, /* GL_STENCIL_BACK_FAIL */
- 1824, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
- 1826, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
- 595, /* GL_FRAGMENT_PROGRAM_ARB */
- 1444, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
- 1476, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
- 1475, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
- 1458, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- 1464, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- 1463, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- 1064, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
- 1089, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
- 1088, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
- 1077, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- 1083, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- 1082, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- 1652, /* GL_RGBA32F */
- 1615, /* GL_RGB32F */
- 1643, /* GL_RGBA16F */
- 1607, /* GL_RGB16F */
- 1033, /* GL_MAX_DRAW_BUFFERS */
- 451, /* GL_DRAW_BUFFER0 */
- 454, /* GL_DRAW_BUFFER1 */
- 475, /* GL_DRAW_BUFFER2 */
- 478, /* GL_DRAW_BUFFER3 */
- 481, /* GL_DRAW_BUFFER4 */
- 484, /* GL_DRAW_BUFFER5 */
- 487, /* GL_DRAW_BUFFER6 */
- 490, /* GL_DRAW_BUFFER7 */
- 493, /* GL_DRAW_BUFFER8 */
- 496, /* GL_DRAW_BUFFER9 */
- 455, /* GL_DRAW_BUFFER10 */
- 458, /* GL_DRAW_BUFFER11 */
- 461, /* GL_DRAW_BUFFER12 */
- 464, /* GL_DRAW_BUFFER13 */
- 467, /* GL_DRAW_BUFFER14 */
- 470, /* GL_DRAW_BUFFER15 */
- 97, /* GL_BLEND_EQUATION_ALPHA */
- 1007, /* GL_MATRIX_PALETTE_ARB */
- 1057, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
- 1060, /* GL_MAX_PALETTE_MATRICES_ARB */
- 369, /* GL_CURRENT_PALETTE_MATRIX_ARB */
- 995, /* GL_MATRIX_INDEX_ARRAY_ARB */
- 364, /* GL_CURRENT_MATRIX_INDEX_ARB */
- 1000, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
- 1004, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
- 1002, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
- 998, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
- 2038, /* GL_TEXTURE_DEPTH_SIZE */
- 435, /* GL_DEPTH_TEXTURE_MODE */
- 1995, /* GL_TEXTURE_COMPARE_MODE */
- 1993, /* GL_TEXTURE_COMPARE_FUNC */
- 281, /* GL_COMPARE_REF_TO_TEXTURE */
- 1371, /* GL_POINT_SPRITE */
- 343, /* GL_COORD_REPLACE */
- 1376, /* GL_POINT_SPRITE_R_MODE_NV */
- 1516, /* GL_QUERY_COUNTER_BITS */
- 372, /* GL_CURRENT_QUERY */
- 1520, /* GL_QUERY_RESULT */
- 1522, /* GL_QUERY_RESULT_AVAILABLE */
- 1126, /* GL_MAX_VERTEX_ATTRIBS */
- 2243, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
- 433, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
- 432, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
- 1103, /* GL_MAX_TEXTURE_COORDS */
- 1105, /* GL_MAX_TEXTURE_IMAGE_UNITS */
- 1451, /* GL_PROGRAM_ERROR_STRING_ARB */
- 1453, /* GL_PROGRAM_FORMAT_ASCII_ARB */
- 1452, /* GL_PROGRAM_FORMAT_ARB */
- 2094, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
- 405, /* GL_DEPTH_BOUNDS_TEST_EXT */
- 404, /* GL_DEPTH_BOUNDS_EXT */
- 61, /* GL_ARRAY_BUFFER */
- 520, /* GL_ELEMENT_ARRAY_BUFFER */
- 62, /* GL_ARRAY_BUFFER_BINDING */
- 521, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
- 2215, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
- 1224, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
- 187, /* GL_COLOR_ARRAY_BUFFER_BINDING */
- 732, /* GL_INDEX_ARRAY_BUFFER_BINDING */
- 2008, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
- 516, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
- 1730, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
- 573, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
- 2271, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
- 2237, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
- 1454, /* GL_PROGRAM_INSTRUCTIONS_ARB */
- 1070, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
- 1460, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- 1079, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- 1474, /* GL_PROGRAM_TEMPORARIES_ARB */
- 1085, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
- 1462, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
- 1081, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
- 1466, /* GL_PROGRAM_PARAMETERS_ARB */
- 1084, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
- 1461, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
- 1080, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
- 1445, /* GL_PROGRAM_ATTRIBS_ARB */
- 1065, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
- 1459, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
- 1078, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
- 1443, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
- 1063, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
- 1457, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- 1076, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- 1071, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
- 1067, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
- 1477, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
- 2127, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
- 1539, /* GL_READ_ONLY */
- 2285, /* GL_WRITE_ONLY */
- 1541, /* GL_READ_WRITE */
- 124, /* GL_BUFFER_ACCESS */
- 129, /* GL_BUFFER_MAPPED */
- 134, /* GL_BUFFER_MAP_POINTER */
- 2101, /* GL_TIME_ELAPSED_EXT */
- 955, /* GL_MATRIX0_ARB */
- 967, /* GL_MATRIX1_ARB */
- 979, /* GL_MATRIX2_ARB */
- 983, /* GL_MATRIX3_ARB */
- 985, /* GL_MATRIX4_ARB */
- 987, /* GL_MATRIX5_ARB */
- 989, /* GL_MATRIX6_ARB */
- 991, /* GL_MATRIX7_ARB */
- 993, /* GL_MATRIX8_ARB */
- 994, /* GL_MATRIX9_ARB */
- 957, /* GL_MATRIX10_ARB */
- 958, /* GL_MATRIX11_ARB */
- 959, /* GL_MATRIX12_ARB */
- 960, /* GL_MATRIX13_ARB */
- 961, /* GL_MATRIX14_ARB */
- 962, /* GL_MATRIX15_ARB */
- 963, /* GL_MATRIX16_ARB */
- 964, /* GL_MATRIX17_ARB */
- 965, /* GL_MATRIX18_ARB */
- 966, /* GL_MATRIX19_ARB */
- 969, /* GL_MATRIX20_ARB */
- 970, /* GL_MATRIX21_ARB */
- 971, /* GL_MATRIX22_ARB */
- 972, /* GL_MATRIX23_ARB */
- 973, /* GL_MATRIX24_ARB */
- 974, /* GL_MATRIX25_ARB */
- 975, /* GL_MATRIX26_ARB */
- 976, /* GL_MATRIX27_ARB */
- 977, /* GL_MATRIX28_ARB */
- 978, /* GL_MATRIX29_ARB */
- 981, /* GL_MATRIX30_ARB */
- 982, /* GL_MATRIX31_ARB */
- 1863, /* GL_STREAM_DRAW */
- 1865, /* GL_STREAM_READ */
- 1861, /* GL_STREAM_COPY */
- 1812, /* GL_STATIC_DRAW */
- 1814, /* GL_STATIC_READ */
- 1810, /* GL_STATIC_COPY */
- 510, /* GL_DYNAMIC_DRAW */
- 512, /* GL_DYNAMIC_READ */
- 508, /* GL_DYNAMIC_COPY */
- 1334, /* GL_PIXEL_PACK_BUFFER */
- 1338, /* GL_PIXEL_UNPACK_BUFFER */
- 1335, /* GL_PIXEL_PACK_BUFFER_BINDING */
- 1339, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
- 396, /* GL_DEPTH24_STENCIL8 */
- 2090, /* GL_TEXTURE_STENCIL_SIZE */
- 2036, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
- 1066, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
- 1069, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
- 1073, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
- 1072, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
- 2241, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER */
- 1012, /* GL_MAX_ARRAY_TEXTURE_LAYERS */
- 1149, /* GL_MIN_PROGRAM_TEXEL_OFFSET */
- 1086, /* GL_MAX_PROGRAM_TEXEL_OFFSET */
- 1854, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
- 18, /* GL_ACTIVE_STENCIL_FACE_EXT */
- 1156, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
- 1711, /* GL_SAMPLES_PASSED */
- 688, /* GL_GEOMETRY_VERTICES_OUT */
- 682, /* GL_GEOMETRY_INPUT_TYPE */
- 684, /* GL_GEOMETRY_OUTPUT_TYPE */
- 156, /* GL_CLAMP_READ_COLOR */
- 546, /* GL_FIXED_ONLY */
- 1358, /* GL_POINT_SIZE_ARRAY_TYPE_OES */
- 1357, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */
- 1356, /* GL_POINT_SIZE_ARRAY_POINTER_OES */
- 1193, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */
- 1480, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */
- 2070, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */
- 138, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */
- 128, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */
- 1556, /* GL_RELEASED_APPLE */
- 2268, /* GL_VOLATILE_APPLE */
- 1595, /* GL_RETAINED_APPLE */
- 2144, /* GL_UNDEFINED_APPLE */
- 1504, /* GL_PURGEABLE_APPLE */
- 596, /* GL_FRAGMENT_SHADER */
- 2263, /* GL_VERTEX_SHADER */
- 1465, /* GL_PROGRAM_OBJECT_ARB */
- 1747, /* GL_SHADER_OBJECT_ARB */
- 1041, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
- 1131, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
- 1122, /* GL_MAX_VARYING_COMPONENTS */
- 1129, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
- 1024, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
- 1254, /* GL_OBJECT_TYPE_ARB */
- 1749, /* GL_SHADER_TYPE */
- 561, /* GL_FLOAT_VEC2 */
- 563, /* GL_FLOAT_VEC3 */
- 565, /* GL_FLOAT_VEC4 */
- 784, /* GL_INT_VEC2 */
- 786, /* GL_INT_VEC3 */
- 788, /* GL_INT_VEC4 */
- 116, /* GL_BOOL */
- 118, /* GL_BOOL_VEC2 */
- 120, /* GL_BOOL_VEC3 */
- 122, /* GL_BOOL_VEC4 */
- 549, /* GL_FLOAT_MAT2 */
- 553, /* GL_FLOAT_MAT3 */
- 557, /* GL_FLOAT_MAT4 */
- 1687, /* GL_SAMPLER_1D */
- 1693, /* GL_SAMPLER_2D */
- 1701, /* GL_SAMPLER_3D */
- 1705, /* GL_SAMPLER_CUBE */
- 1692, /* GL_SAMPLER_1D_SHADOW */
- 1700, /* GL_SAMPLER_2D_SHADOW */
- 1698, /* GL_SAMPLER_2D_RECT */
- 1699, /* GL_SAMPLER_2D_RECT_SHADOW */
- 551, /* GL_FLOAT_MAT2x3 */
- 552, /* GL_FLOAT_MAT2x4 */
- 555, /* GL_FLOAT_MAT3x2 */
- 556, /* GL_FLOAT_MAT3x4 */
- 559, /* GL_FLOAT_MAT4x2 */
- 560, /* GL_FLOAT_MAT4x3 */
- 394, /* GL_DELETE_STATUS */
- 286, /* GL_COMPILE_STATUS */
- 845, /* GL_LINK_STATUS */
- 2209, /* GL_VALIDATE_STATUS */
- 744, /* GL_INFO_LOG_LENGTH */
- 64, /* GL_ATTACHED_SHADERS */
- 21, /* GL_ACTIVE_UNIFORMS */
- 22, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */
- 1748, /* GL_SHADER_SOURCE_LENGTH */
- 15, /* GL_ACTIVE_ATTRIBUTES */
- 16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */
- 598, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
- 1751, /* GL_SHADING_LANGUAGE_VERSION */
- 371, /* GL_CURRENT_PROGRAM */
- 1303, /* GL_PALETTE4_RGB8_OES */
- 1305, /* GL_PALETTE4_RGBA8_OES */
- 1301, /* GL_PALETTE4_R5_G6_B5_OES */
- 1304, /* GL_PALETTE4_RGBA4_OES */
- 1302, /* GL_PALETTE4_RGB5_A1_OES */
- 1308, /* GL_PALETTE8_RGB8_OES */
- 1310, /* GL_PALETTE8_RGBA8_OES */
- 1306, /* GL_PALETTE8_R5_G6_B5_OES */
- 1309, /* GL_PALETTE8_RGBA4_OES */
- 1307, /* GL_PALETTE8_RGB5_A1_OES */
- 726, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
- 724, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
- 1355, /* GL_POINT_SIZE_ARRAY_OES */
- 2014, /* GL_TEXTURE_CROP_RECT_OES */
- 996, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */
- 1354, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */
- 2192, /* GL_UNSIGNED_NORMALIZED */
- 1951, /* GL_TEXTURE_1D_ARRAY */
- 1490, /* GL_PROXY_TEXTURE_1D_ARRAY */
- 1954, /* GL_TEXTURE_2D_ARRAY */
- 1494, /* GL_PROXY_TEXTURE_2D_ARRAY */
- 1962, /* GL_TEXTURE_BINDING_1D_ARRAY */
- 1965, /* GL_TEXTURE_BINDING_2D_ARRAY */
- 1048, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS */
- 1981, /* GL_TEXTURE_BUFFER */
- 1102, /* GL_MAX_TEXTURE_BUFFER_SIZE */
- 1969, /* GL_TEXTURE_BINDING_BUFFER */
- 1982, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING */
- 1983, /* GL_TEXTURE_BUFFER_FORMAT */
- 1527, /* GL_R11F_G11F_B10F */
- 2158, /* GL_UNSIGNED_INT_10F_11F_11F_REV */
- 1638, /* GL_RGB9_E5 */
- 2167, /* GL_UNSIGNED_INT_5_9_9_9_REV */
- 2088, /* GL_TEXTURE_SHARED_SIZE */
- 1804, /* GL_SRGB */
- 1805, /* GL_SRGB8 */
- 1807, /* GL_SRGB_ALPHA */
- 1806, /* GL_SRGB8_ALPHA8 */
- 1764, /* GL_SLUMINANCE_ALPHA */
- 1763, /* GL_SLUMINANCE8_ALPHA8 */
- 1761, /* GL_SLUMINANCE */
- 1762, /* GL_SLUMINANCE8 */
- 309, /* GL_COMPRESSED_SRGB */
- 310, /* GL_COMPRESSED_SRGB_ALPHA */
- 307, /* GL_COMPRESSED_SLUMINANCE */
- 308, /* GL_COMPRESSED_SLUMINANCE_ALPHA */
- 2123, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH */
- 2112, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE */
- 1120, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS */
- 2121, /* GL_TRANSFORM_FEEDBACK_VARYINGS */
- 2117, /* GL_TRANSFORM_FEEDBACK_BUFFER_START */
- 2115, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE */
- 1437, /* GL_PRIMITIVES_GENERATED */
- 2119, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN */
- 1531, /* GL_RASTERIZER_DISCARD */
- 1116, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS */
- 1118, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS */
- 762, /* GL_INTERLEAVED_ATTRIBS */
- 1740, /* GL_SEPARATE_ATTRIBS */
- 2107, /* GL_TRANSFORM_FEEDBACK_BUFFER */
- 2109, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING */
- 1373, /* GL_POINT_SPRITE_COORD_ORIGIN */
- 853, /* GL_LOWER_LEFT */
- 2206, /* GL_UPPER_LEFT */
- 1828, /* GL_STENCIL_BACK_REF */
- 1829, /* GL_STENCIL_BACK_VALUE_MASK */
- 1830, /* GL_STENCIL_BACK_WRITEMASK */
- 500, /* GL_DRAW_FRAMEBUFFER_BINDING */
- 1561, /* GL_RENDERBUFFER_BINDING */
- 1535, /* GL_READ_FRAMEBUFFER */
- 499, /* GL_DRAW_FRAMEBUFFER */
- 1536, /* GL_READ_FRAMEBUFFER_BINDING */
- 1580, /* GL_RENDERBUFFER_SAMPLES */
- 612, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
- 609, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
- 624, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
- 619, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
- 622, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
- 630, /* GL_FRAMEBUFFER_COMPLETE */
- 635, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
- 650, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
- 644, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
- 639, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
- 645, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
- 641, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
- 655, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
- 661, /* GL_FRAMEBUFFER_UNSUPPORTED */
- 659, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
- 1020, /* GL_MAX_COLOR_ATTACHMENTS */
- 193, /* GL_COLOR_ATTACHMENT0 */
- 196, /* GL_COLOR_ATTACHMENT1 */
- 210, /* GL_COLOR_ATTACHMENT2 */
- 212, /* GL_COLOR_ATTACHMENT3 */
- 214, /* GL_COLOR_ATTACHMENT4 */
- 216, /* GL_COLOR_ATTACHMENT5 */
- 218, /* GL_COLOR_ATTACHMENT6 */
- 220, /* GL_COLOR_ATTACHMENT7 */
- 222, /* GL_COLOR_ATTACHMENT8 */
- 224, /* GL_COLOR_ATTACHMENT9 */
- 197, /* GL_COLOR_ATTACHMENT10 */
- 199, /* GL_COLOR_ATTACHMENT11 */
- 201, /* GL_COLOR_ATTACHMENT12 */
- 203, /* GL_COLOR_ATTACHMENT13 */
- 205, /* GL_COLOR_ATTACHMENT14 */
- 207, /* GL_COLOR_ATTACHMENT15 */
- 399, /* GL_DEPTH_ATTACHMENT */
- 1817, /* GL_STENCIL_ATTACHMENT */
- 600, /* GL_FRAMEBUFFER */
- 1558, /* GL_RENDERBUFFER */
- 1584, /* GL_RENDERBUFFER_WIDTH */
- 1571, /* GL_RENDERBUFFER_HEIGHT */
- 1574, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
- 1849, /* GL_STENCIL_INDEX_EXT */
- 1838, /* GL_STENCIL_INDEX1 */
- 1843, /* GL_STENCIL_INDEX4 */
- 1846, /* GL_STENCIL_INDEX8 */
- 1839, /* GL_STENCIL_INDEX16 */
- 1578, /* GL_RENDERBUFFER_RED_SIZE */
- 1569, /* GL_RENDERBUFFER_GREEN_SIZE */
- 1564, /* GL_RENDERBUFFER_BLUE_SIZE */
- 1559, /* GL_RENDERBUFFER_ALPHA_SIZE */
- 1566, /* GL_RENDERBUFFER_DEPTH_SIZE */
- 1582, /* GL_RENDERBUFFER_STENCIL_SIZE */
- 653, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
- 1097, /* GL_MAX_SAMPLES */
- 2050, /* GL_TEXTURE_GEN_STR_OES */
- 699, /* GL_HALF_FLOAT_OES */
- 1625, /* GL_RGB565_OES */
- 1655, /* GL_RGBA32UI */
- 1618, /* GL_RGB32UI */
- 40, /* GL_ALPHA32UI_EXT */
- 754, /* GL_INTENSITY32UI_EXT */
- 870, /* GL_LUMINANCE32UI_EXT */
- 887, /* GL_LUMINANCE_ALPHA32UI_EXT */
- 1646, /* GL_RGBA16UI */
- 1610, /* GL_RGB16UI */
- 37, /* GL_ALPHA16UI_EXT */
- 751, /* GL_INTENSITY16UI_EXT */
- 865, /* GL_LUMINANCE16UI_EXT */
- 885, /* GL_LUMINANCE_ALPHA16UI_EXT */
- 1665, /* GL_RGBA8UI */
- 1633, /* GL_RGB8UI */
- 45, /* GL_ALPHA8UI_EXT */
- 759, /* GL_INTENSITY8UI_EXT */
- 879, /* GL_LUMINANCE8UI_EXT */
- 889, /* GL_LUMINANCE_ALPHA8UI_EXT */
- 1653, /* GL_RGBA32I */
- 1616, /* GL_RGB32I */
- 39, /* GL_ALPHA32I_EXT */
- 753, /* GL_INTENSITY32I_EXT */
- 869, /* GL_LUMINANCE32I_EXT */
- 886, /* GL_LUMINANCE_ALPHA32I_EXT */
- 1644, /* GL_RGBA16I */
- 1608, /* GL_RGB16I */
- 36, /* GL_ALPHA16I_EXT */
- 750, /* GL_INTENSITY16I_EXT */
- 864, /* GL_LUMINANCE16I_EXT */
- 884, /* GL_LUMINANCE_ALPHA16I_EXT */
- 1663, /* GL_RGBA8I */
- 1631, /* GL_RGB8I */
- 44, /* GL_ALPHA8I_EXT */
- 758, /* GL_INTENSITY8I_EXT */
- 878, /* GL_LUMINANCE8I_EXT */
- 888, /* GL_LUMINANCE_ALPHA8I_EXT */
- 1548, /* GL_RED_INTEGER */
- 695, /* GL_GREEN_INTEGER */
- 113, /* GL_BLUE_INTEGER */
- 49, /* GL_ALPHA_INTEGER_EXT */
- 1677, /* GL_RGB_INTEGER */
- 1671, /* GL_RGBA_INTEGER */
- 84, /* GL_BGR_INTEGER */
- 82, /* GL_BGRA_INTEGER */
- 891, /* GL_LUMINANCE_INTEGER_EXT */
- 890, /* GL_LUMINANCE_ALPHA_INTEGER_EXT */
- 1673, /* GL_RGBA_INTEGER_MODE_EXT */
- 607, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED */
- 648, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS */
- 647, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */
- 1688, /* GL_SAMPLER_1D_ARRAY */
- 1694, /* GL_SAMPLER_2D_ARRAY */
- 1703, /* GL_SAMPLER_BUFFER */
- 1690, /* GL_SAMPLER_1D_ARRAY_SHADOW */
- 1696, /* GL_SAMPLER_2D_ARRAY_SHADOW */
- 1706, /* GL_SAMPLER_CUBE_SHADOW */
- 2186, /* GL_UNSIGNED_INT_VEC2 */
- 2188, /* GL_UNSIGNED_INT_VEC3 */
- 2190, /* GL_UNSIGNED_INT_VEC4 */
- 768, /* GL_INT_SAMPLER_1D */
- 772, /* GL_INT_SAMPLER_2D */
- 778, /* GL_INT_SAMPLER_3D */
- 782, /* GL_INT_SAMPLER_CUBE */
- 776, /* GL_INT_SAMPLER_2D_RECT */
- 769, /* GL_INT_SAMPLER_1D_ARRAY */
- 773, /* GL_INT_SAMPLER_2D_ARRAY */
- 780, /* GL_INT_SAMPLER_BUFFER */
- 2170, /* GL_UNSIGNED_INT_SAMPLER_1D */
- 2174, /* GL_UNSIGNED_INT_SAMPLER_2D */
- 2180, /* GL_UNSIGNED_INT_SAMPLER_3D */
- 2184, /* GL_UNSIGNED_INT_SAMPLER_CUBE */
- 2178, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT */
- 2171, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY */
- 2175, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY */
- 2182, /* GL_UNSIGNED_INT_SAMPLER_BUFFER */
- 686, /* GL_GEOMETRY_SHADER */
- 689, /* GL_GEOMETRY_VERTICES_OUT_ARB */
- 683, /* GL_GEOMETRY_INPUT_TYPE_ARB */
- 685, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */
- 1054, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */
- 1136, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */
- 1052, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS */
- 1046, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES */
- 1050, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS */
- 854, /* GL_LOW_FLOAT */
- 1138, /* GL_MEDIUM_FLOAT */
- 700, /* GL_HIGH_FLOAT */
- 855, /* GL_LOW_INT */
- 1139, /* GL_MEDIUM_INT */
- 701, /* GL_HIGH_INT */
- 2160, /* GL_UNSIGNED_INT_10_10_10_2_OES */
- 767, /* GL_INT_10_10_10_2_OES */
- 1745, /* GL_SHADER_BINARY_FORMATS */
- 1239, /* GL_NUM_SHADER_BINARY_FORMATS */
- 1746, /* GL_SHADER_COMPILER */
- 1133, /* GL_MAX_VERTEX_UNIFORM_VECTORS */
- 1125, /* GL_MAX_VARYING_VECTORS */
- 1043, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */
- 1524, /* GL_QUERY_WAIT */
- 1518, /* GL_QUERY_NO_WAIT */
- 1514, /* GL_QUERY_BY_REGION_WAIT */
- 1512, /* GL_QUERY_BY_REGION_NO_WAIT */
- 2105, /* GL_TRANSFORM_FEEDBACK */
- 2114, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */
- 2108, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */
- 2106, /* GL_TRANSFORM_FEEDBACK_BINDING */
- 1508, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
- 542, /* GL_FIRST_VERTEX_CONVENTION */
- 800, /* GL_LAST_VERTEX_CONVENTION */
- 1482, /* GL_PROVOKING_VERTEX */
- 350, /* GL_COPY_READ_BUFFER */
- 351, /* GL_COPY_WRITE_BUFFER */
- 1551, /* GL_RED_SNORM */
- 1684, /* GL_RG_SNORM */
- 1683, /* GL_RGB_SNORM */
- 1676, /* GL_RGBA_SNORM */
- 1530, /* GL_R8_SNORM */
- 1598, /* GL_RG8_SNORM */
- 1637, /* GL_RGB8_SNORM */
- 1669, /* GL_RGBA8_SNORM */
- 1528, /* GL_R16_SNORM */
- 1597, /* GL_RG16_SNORM */
- 1613, /* GL_RGB16_SNORM */
- 1649, /* GL_RGBA16_SNORM */
- 1757, /* GL_SIGNED_NORMALIZED */
- 1439, /* GL_PRIMITIVE_RESTART */
- 1440, /* GL_PRIMITIVE_RESTART_INDEX */
- 1099, /* GL_MAX_SERVER_WAIT_TIMEOUT */
- 1253, /* GL_OBJECT_TYPE */
- 1870, /* GL_SYNC_CONDITION */
- 1875, /* GL_SYNC_STATUS */
- 1872, /* GL_SYNC_FLAGS */
- 1871, /* GL_SYNC_FENCE */
- 1874, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
- 2153, /* GL_UNSIGNALED */
- 1756, /* GL_SIGNALED */
- 54, /* GL_ALREADY_SIGNALED */
- 2100, /* GL_TIMEOUT_EXPIRED */
- 312, /* GL_CONDITION_SATISFIED */
- 2269, /* GL_WAIT_FAILED */
- 126, /* GL_BUFFER_ACCESS_FLAGS */
- 132, /* GL_BUFFER_MAP_LENGTH */
- 133, /* GL_BUFFER_MAP_OFFSET */
- 1128, /* GL_MAX_VERTEX_OUTPUT_COMPONENTS */
- 1044, /* GL_MAX_GEOMETRY_INPUT_COMPONENTS */
- 1045, /* GL_MAX_GEOMETRY_OUTPUT_COMPONENTS */
- 1040, /* GL_MAX_FRAGMENT_INPUT_COMPONENTS */
- 326, /* GL_CONTEXT_PROFILE_MASK */
- 527, /* GL_EVAL_BIT */
- 1533, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
- 847, /* GL_LIST_BIT */
- 1976, /* GL_TEXTURE_BIT */
- 1726, /* GL_SCISSOR_BIT */
- 30, /* GL_ALL_ATTRIB_BITS */
- 1204, /* GL_MULTISAMPLE_BIT */
- 31, /* GL_ALL_CLIENT_ATTRIB_BITS */
-};
-
-typedef int (*cfunc)(const void *, const void *);
-
-/**
- * Compare a key name to an element in the \c all_enums array.
- *
- * \c bsearch always passes the key as the first parameter and the pointer
- * to the array element as the second parameter. We can elimiate some
- * extra work by taking advantage of that fact.
- *
- * \param a Pointer to the desired enum name.
- * \param b Pointer to an element of the \c all_enums array.
- */
-static int compar_name( const char *a, const enum_elt *b )
-{
- return strcmp( a, & enum_string_table[ b->offset ] );
-}
-
-/**
- * Compare a key enum value to an element in the \c all_enums array.
- *
- * \c bsearch always passes the key as the first parameter and the pointer
- * to the array element as the second parameter. We can elimiate some
- * extra work by taking advantage of that fact.
- *
- * \param a Pointer to the desired enum name.
- * \param b Pointer to an index into the \c all_enums array.
- */
-static int compar_nr( const int *a, const unsigned *b )
-{
- return a[0] - all_enums[*b].n;
-}
-
-
-static char token_tmp[20];
-
-const char *_mesa_lookup_enum_by_nr( int nr )
-{
- unsigned * i;
-
- i = (unsigned *) _mesa_bsearch(& nr, reduced_enums,
- Elements(reduced_enums),
- sizeof(reduced_enums[0]),
- (cfunc) compar_nr);
-
- if ( i != NULL ) {
- return & enum_string_table[ all_enums[ *i ].offset ];
- }
- else {
- /* this is not re-entrant safe, no big deal here */
- _mesa_snprintf(token_tmp, sizeof(token_tmp) - 1, "0x%x", nr);
- token_tmp[sizeof(token_tmp) - 1] = '\0';
- return token_tmp;
- }
-}
-
-/* Get the name of an enum given that it is a primitive type. Avoids
- * GL_FALSE/GL_POINTS ambiguity and others.
- */
-const char *_mesa_lookup_prim_by_nr( int nr )
-{
- switch (nr) {
- case GL_POINTS: return "GL_POINTS";
- case GL_LINES: return "GL_LINES";
- case GL_LINE_STRIP: return "GL_LINE_STRIP";
- case GL_LINE_LOOP: return "GL_LINE_LOOP";
- case GL_TRIANGLES: return "GL_TRIANGLES";
- case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP";
- case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN";
- case GL_QUADS: return "GL_QUADS";
- case GL_QUAD_STRIP: return "GL_QUAD_STRIP";
- case GL_POLYGON: return "GL_POLYGON";
- case GL_POLYGON+1: return "OUTSIDE_BEGIN_END";
- default: return "<invalid>";
- }
-}
-
-
-
-int _mesa_lookup_enum_by_name( const char *symbol )
-{
- enum_elt * f = NULL;
-
- if ( symbol != NULL ) {
- f = (enum_elt *) _mesa_bsearch(symbol, all_enums,
- Elements(all_enums),
- sizeof( enum_elt ),
- (cfunc) compar_name);
- }
-
- return (f != NULL) ? f->n : -1;
-}
-
-
diff --git a/src/mesa/main/enums.h b/src/mesa/main/enums.h
deleted file mode 100644
index c03cd34..0000000
--- a/src/mesa/main/enums.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * \file enums.h
- * Enumeration name/number lookup functions.
- *
- * \if subset
- * (No-op)
- *
- * \endif
- */
-
-/*
- * 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 _ENUMS_H_
-#define _ENUMS_H_
-
-#include "mfeatures.h"
-
-#if defined(_HAVE_FULL_GL) && _HAVE_FULL_GL
-
-extern const char *_mesa_lookup_enum_by_nr( int nr );
-
-/* Get the name of an enum given that it is a primitive type. Avoids
- * GL_FALSE/GL_POINTS ambiguity and others.
- */
-const char *_mesa_lookup_prim_by_nr( int nr );
-
-extern int _mesa_lookup_enum_by_name( const char *symbol );
-
-#else
-
-/** No-op */
-#define _mesa_lookup_enum_by_name( s ) 0
-
-/** No-op */
-#define _mesa_lookup_enum_by_nr( n ) "unknown"
-
-#endif
-
-#endif
diff --git a/src/mesa/main/es_generator.py b/src/mesa/main/es_generator.py
deleted file mode 100644
index aa8dab7..0000000
--- a/src/mesa/main/es_generator.py
+++ /dev/null
@@ -1,760 +0,0 @@
-#*************************************************************************
-# 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"
-#include "main/compiler.h"
-#include "main/api_exec.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, ... );
-"""
-
-# 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 """
-#include "glapi/glapi.h"
-
-#if FEATURE_remap_table
-
-/* cannot include main/dispatch.h here */
-#define _GLAPI_USE_REMAP_TABLE
-#include "%sapi/main/glapidispatch.h"
-
-#define need_MESA_remap_table
-#include "%sapi/main/remap_helper.h"
-
-/* force SET_* macros to use the local remap table */
-#define driDispatchRemapTable remap_table
-static int remap_table[driDispatchRemapTable_size];
-
-static void
-init_remap_table(void)
-{
- _glthread_DECLARE_STATIC_MUTEX(mutex);
- static GLboolean initialized = GL_FALSE;
- const struct gl_function_pool_remap *remap = MESA_remap_table_functions;
- int i;
-
- _glthread_LOCK_MUTEX(mutex);
- if (initialized) {
- _glthread_UNLOCK_MUTEX(mutex);
- return;
- }
-
- for (i = 0; i < driDispatchRemapTable_size; i++) {
- GLint offset;
- const char *spec;
-
- /* sanity check */
- ASSERT(i == remap[i].remap_index);
- spec = _mesa_function_pool + remap[i].pool_index;
-
- offset = _mesa_map_function_spec(spec);
- remap_table[i] = offset;
- }
- initialized = GL_TRUE;
- _glthread_UNLOCK_MUTEX(mutex);
-}
-
-#else /* FEATURE_remap_table */
-
-/* cannot include main/dispatch.h here */
-#include "%sapi/main/glapidispatch.h"
-
-static INLINE void
-init_remap_table(void)
-{
-}
-
-#endif /* FEATURE_remap_table */
-
-struct _glapi_table *
-_mesa_create_exec_table_%s(void)
-{
- struct _glapi_table *exec;
-
- exec = _mesa_alloc_dispatch_table(_gloffset_COUNT);
- if (exec == NULL)
- return NULL;
-
- init_remap_table();
-""" % (shortname, shortname, shortname, 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/src/mesa/main/execmem.c b/src/mesa/main/execmem.c
deleted file mode 100644
index ccd6ab4..0000000
--- a/src/mesa/main/execmem.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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 execmem.c
- * Functions for allocating executable memory.
- *
- * \author Keith Whitwell
- */
-
-
-#include "imports.h"
-#include "glapi/glthread.h"
-
-
-
-#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun)
-
-/*
- * Allocate a large block of memory which can hold code then dole it out
- * in pieces by means of the generic memory manager code.
-*/
-
-#include <unistd.h>
-#include <sys/mman.h>
-#include "mm.h"
-
-#ifdef MESA_SELINUX
-#include <selinux/selinux.h>
-#endif
-
-
-#ifndef MAP_ANONYMOUS
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-
-
-#define EXEC_HEAP_SIZE (10*1024*1024)
-
-_glthread_DECLARE_STATIC_MUTEX(exec_mutex);
-
-static struct mem_block *exec_heap = NULL;
-static unsigned char *exec_mem = NULL;
-
-
-static int
-init_heap(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_heap)
- exec_heap = mmInit( 0, EXEC_HEAP_SIZE );
-
- if (!exec_mem)
- exec_mem = mmap(NULL, EXEC_HEAP_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-
- return (exec_mem != MAP_FAILED);
-}
-
-
-void *
-_mesa_exec_malloc(GLuint size)
-{
- struct mem_block *block = NULL;
- void *addr = NULL;
-
- _glthread_LOCK_MUTEX(exec_mutex);
-
- if (!init_heap())
- goto bail;
-
- if (exec_heap) {
- size = (size + 31) & ~31;
- block = mmAllocMem( exec_heap, size, 32, 0 );
- }
-
- if (block)
- addr = exec_mem + block->ofs;
- else
- printf("_mesa_exec_malloc failed\n");
-
-bail:
- _glthread_UNLOCK_MUTEX(exec_mutex);
-
- return addr;
-}
-
-
-void
-_mesa_exec_free(void *addr)
-{
- _glthread_LOCK_MUTEX(exec_mutex);
-
- if (exec_heap) {
- struct mem_block *block = mmFindBlock(exec_heap, (unsigned char *)addr - exec_mem);
-
- if (block)
- mmFreeMem(block);
- }
-
- _glthread_UNLOCK_MUTEX(exec_mutex);
-}
-
-
-#else
-
-/*
- * Just use regular memory.
- */
-
-void *
-_mesa_exec_malloc(GLuint size)
-{
- return malloc( size );
-}
-
-
-void
-_mesa_exec_free(void *addr)
-{
- free(addr);
-}
-
-
-#endif
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
deleted file mode 100644
index f3bf5cb..0000000
--- a/src/mesa/main/extensions.c
+++ /dev/null
@@ -1,986 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.6
- *
- * Copyright (C) 1999-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 "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "extensions.h"
-#include "mtypes.h"
-
-
-#define F(x) offsetof(struct gl_extensions, x)
-#define ON GL_TRUE
-#define OFF GL_FALSE
-
-
-/*
- * Note: The GL_MESAX_* extensions are placeholders for future ARB extensions.
- */
-static const struct {
- GLboolean enabled;
- const char *name;
- int flag_offset;
-} default_extensions[] = {
- { OFF, "GL_ARB_blend_func_extended", F(ARB_blend_func_extended) },
- { ON, "GL_ARB_copy_buffer", F(ARB_copy_buffer) },
- { 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_explicit_attrib_location", F(ARB_explicit_attrib_location) },
- { 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) },
- /* 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_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_shader_stencil_export", F(ARB_shader_stencil_export) },
- { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) },
- { 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_compression_rgtc", F(ARB_texture_compression_rgtc) },
- { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) },
- { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) },
- { OFF, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine) },
- { OFF, "GL_ARB_texture_env_crossbar", F(ARB_texture_env_crossbar) },
- { 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) },
- { OFF, "GL_EXT_blend_color", F(EXT_blend_color) },
- { OFF, "GL_EXT_blend_equation_separate", F(EXT_blend_equation_separate) },
- { OFF, "GL_EXT_blend_func_separate", F(EXT_blend_func_separate) },
- { OFF, "GL_EXT_blend_logic_op", F(EXT_blend_logic_op) },
- { OFF, "GL_EXT_blend_minmax", F(EXT_blend_minmax) },
- { OFF, "GL_EXT_blend_subtract", F(EXT_blend_subtract) },
- { OFF, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) },
- { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) },
- { 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_gpu_shader4", F(EXT_gpu_shader4) },
- { 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) },
- { OFF, "GL_EXT_point_parameters", F(EXT_point_parameters) },
- { ON, "GL_EXT_polygon_offset", F(EXT_polygon_offset) },
- { OFF, "GL_EXT_provoking_vertex", F(EXT_provoking_vertex) },
- { ON, "GL_EXT_rescale_normal", F(EXT_rescale_normal) },
- { OFF, "GL_EXT_secondary_color", F(EXT_secondary_color) },
- { OFF, "GL_EXT_separate_shader_objects", F(EXT_separate_shader_objects) },
- { ON, "GL_EXT_separate_specular_color", F(EXT_separate_specular_color) },
- { OFF, "GL_EXT_shadow_funcs", F(EXT_shadow_funcs) },
- { OFF, "GL_EXT_shared_texture_palette", F(EXT_shared_texture_palette) },
- { OFF, "GL_EXT_stencil_two_side", F(EXT_stencil_two_side) },
- { OFF, "GL_EXT_stencil_wrap", F(EXT_stencil_wrap) },
- { ON, "GL_EXT_subtexture", F(EXT_subtexture) },
- { ON, "GL_EXT_texture", F(EXT_texture) },
- { 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(ARB_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) },
- { OFF, "GL_3DFX_texture_compression_FXT1", F(TDFX_texture_compression_FXT1) },
- { OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) },
- { ON, "GL_APPLE_packed_pixels", F(APPLE_packed_pixels) },
- { OFF, "GL_APPLE_vertex_array_object", F(APPLE_vertex_array_object) },
- { OFF, "GL_APPLE_object_purgeable", F(APPLE_object_purgeable) },
- { OFF, "GL_ATI_blend_equation_separate", F(EXT_blend_equation_separate) },
- { OFF, "GL_ATI_envmap_bumpmap", F(ATI_envmap_bumpmap) },
- { OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)},
- { OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)},
- { OFF, "GL_ATI_fragment_shader", F(ATI_fragment_shader)},
- { OFF, "GL_ATI_separate_stencil", F(ATI_separate_stencil)},
- { ON, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays) },
- { ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) },
- { OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
- { OFF, "GL_INGR_blend_func_separate", F(EXT_blend_func_separate) },
- { OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) },
- { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) },
- { OFF, "GL_MESA_texture_array", F(MESA_texture_array) },
- { OFF, "GL_MESA_texture_signed_rgba", F(MESA_texture_signed_rgba) },
- { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) },
- { ON, "GL_MESA_window_pos", F(ARB_window_pos) },
- { OFF, "GL_NV_blend_square", F(NV_blend_square) },
- { OFF, "GL_NV_conditional_render", F(NV_conditional_render) },
- { OFF, "GL_NV_depth_clamp", F(ARB_depth_clamp) },
- { OFF, "GL_NV_fragment_program", F(NV_fragment_program) },
- { OFF, "GL_NV_fragment_program_option", F(NV_fragment_program_option) },
- { 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) },
- { 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) },
- { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) },
- { ON, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) },
- { OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) },
- { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
- { 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) },
- { OFF, "GL_EXT_texture_format_BGRA8888", F(EXT_texture_format_BGRA8888) },
-#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 */
-};
-
-
-
-/**
- * Enable all extensions suitable for a software-only renderer.
- * This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc.
- */
-void
-_mesa_enable_sw_extensions(struct gl_context *ctx)
-{
- /*ctx->Extensions.ARB_copy_buffer = GL_TRUE;*/
- ctx->Extensions.ARB_depth_clamp = GL_TRUE;
- ctx->Extensions.ARB_depth_texture = GL_TRUE;
- /*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
- ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
- ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE;
- ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
-#if FEATURE_ARB_fragment_program
- ctx->Extensions.ARB_fragment_program = GL_TRUE;
- ctx->Extensions.ARB_fragment_program_shadow = GL_TRUE;
-#endif
-#if FEATURE_ARB_fragment_shader
- ctx->Extensions.ARB_fragment_shader = GL_TRUE;
-#endif
-#if FEATURE_ARB_framebuffer_object
- ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
-#endif
-#if FEATURE_ARB_geometry_shader4 && 0
- /* XXX re-enable when GLSL compiler again supports geometry shaders */
- 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_map_buffer_range = GL_TRUE;
- ctx->Extensions.ARB_multitexture = GL_TRUE;
-#if FEATURE_queryobj
- ctx->Extensions.ARB_occlusion_query = GL_TRUE;
-#endif
- ctx->Extensions.ARB_point_sprite = GL_TRUE;
-#if FEATURE_ARB_shader_objects
- ctx->Extensions.ARB_shader_objects = GL_TRUE;
- ctx->Extensions.EXT_separate_shader_objects = GL_TRUE;
-#endif
-#if FEATURE_ARB_shading_language_100
- ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
-#endif
- ctx->Extensions.ARB_shadow = GL_TRUE;
- ctx->Extensions.ARB_shadow_ambient = GL_TRUE;
- ctx->Extensions.ARB_texture_border_clamp = GL_TRUE;
- ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
- ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
- ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
- ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
- /*ctx->Extensions.ARB_texture_float = GL_TRUE;*/
- ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE;
- ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
- ctx->Extensions.ARB_texture_rg = GL_TRUE;
- ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
-#if FEATURE_ARB_vertex_program
- ctx->Extensions.ARB_vertex_program = GL_TRUE;
-#endif
-#if FEATURE_ARB_vertex_shader
- ctx->Extensions.ARB_vertex_shader = GL_TRUE;
-#endif
-#if FEATURE_ARB_vertex_buffer_object
- /*ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;*/
-#endif
-#if FEATURE_ARB_sync
- ctx->Extensions.ARB_sync = GL_TRUE;
-#endif
- ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
-#if FEATURE_APPLE_object_purgeable
- ctx->Extensions.APPLE_object_purgeable = GL_TRUE;
-#endif
- ctx->Extensions.ATI_envmap_bumpmap = GL_TRUE;
-#if FEATURE_ATI_fragment_shader
- ctx->Extensions.ATI_fragment_shader = GL_TRUE;
-#endif
- ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
- ctx->Extensions.ATI_texture_mirror_once = GL_TRUE;
- ctx->Extensions.ATI_separate_stencil = GL_TRUE;
- ctx->Extensions.EXT_blend_color = GL_TRUE;
- ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
- ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
- ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
- ctx->Extensions.EXT_blend_minmax = GL_TRUE;
- ctx->Extensions.EXT_blend_subtract = GL_TRUE;
- ctx->Extensions.EXT_depth_bounds_test = GL_TRUE;
- ctx->Extensions.EXT_draw_buffers2 = GL_TRUE;
- ctx->Extensions.EXT_fog_coord = GL_TRUE;
-#if FEATURE_EXT_framebuffer_object
- ctx->Extensions.EXT_framebuffer_object = GL_TRUE;
-#endif
-#if FEATURE_EXT_framebuffer_blit
- ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
-#endif
-#if FEATURE_ARB_framebuffer_object
- ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
-#endif
- /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/
- ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
- ctx->Extensions.EXT_paletted_texture = GL_TRUE;
-#if FEATURE_EXT_pixel_buffer_object
- ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
-#endif
- ctx->Extensions.EXT_point_parameters = GL_TRUE;
- ctx->Extensions.EXT_provoking_vertex = GL_TRUE;
- ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
- ctx->Extensions.EXT_secondary_color = GL_TRUE;
- ctx->Extensions.EXT_shared_texture_palette = GL_TRUE;
- ctx->Extensions.EXT_stencil_wrap = GL_TRUE;
- ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
- ctx->Extensions.EXT_texture_array = GL_TRUE;
- ctx->Extensions.EXT_texture_env_add = GL_TRUE;
- ctx->Extensions.EXT_texture_env_combine = GL_TRUE;
- ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
- ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE;
- ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
-#if FEATURE_EXT_texture_sRGB
- 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;
- ctx->Extensions.MESA_resize_buffers = GL_TRUE;
- ctx->Extensions.MESA_texture_array = GL_TRUE;
- ctx->Extensions.MESA_ycbcr_texture = GL_TRUE;
- ctx->Extensions.NV_blend_square = GL_TRUE;
- ctx->Extensions.NV_conditional_render = GL_TRUE;
- /*ctx->Extensions.NV_light_max_exponent = GL_TRUE;*/
- ctx->Extensions.NV_point_sprite = GL_TRUE;
- ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
- ctx->Extensions.NV_texture_rectangle = GL_TRUE;
- /*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/
-#if FEATURE_NV_vertex_program
- ctx->Extensions.NV_vertex_program = GL_TRUE;
- ctx->Extensions.NV_vertex_program1_1 = GL_TRUE;
-#endif
-#if FEATURE_NV_fragment_program
- ctx->Extensions.NV_fragment_program = GL_TRUE;
-#endif
-#if FEATURE_NV_fragment_program && FEATURE_ARB_fragment_program
- ctx->Extensions.NV_fragment_program_option = GL_TRUE;
-#endif
- ctx->Extensions.SGI_texture_color_table = GL_TRUE;
- /*ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;*/
- ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE;
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
- ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
-#endif
-#if FEATURE_texture_fxt1
- _mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
-#endif
-#if FEATURE_texture_s3tc
- if (ctx->Mesa_DXTn) {
- _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
- _mesa_enable_extension(ctx, "GL_S3_s3tc");
- }
-#endif
-}
-
-
-/**
- * Enable common EXT extensions in the ARB_imaging subset.
- */
-void
-_mesa_enable_imaging_extensions(struct gl_context *ctx)
-{
- ctx->Extensions.EXT_blend_color = GL_TRUE;
- ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
- ctx->Extensions.EXT_blend_minmax = GL_TRUE;
- ctx->Extensions.EXT_blend_subtract = GL_TRUE;
-}
-
-
-
-/**
- * Enable all OpenGL 1.3 features and extensions.
- * A convenience function to be called by drivers.
- */
-void
-_mesa_enable_1_3_extensions(struct gl_context *ctx)
-{
- /*ctx->Extensions.ARB_multisample = GL_TRUE;*/
- ctx->Extensions.ARB_multitexture = GL_TRUE;
- ctx->Extensions.ARB_texture_border_clamp = GL_TRUE;
- /*ctx->Extensions.ARB_texture_compression = GL_TRUE;*/
- ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
- ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
- ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
- ctx->Extensions.EXT_texture_env_add = GL_TRUE;
- /*ctx->Extensions.ARB_transpose_matrix = GL_TRUE;*/
-}
-
-
-
-/**
- * Enable all OpenGL 1.4 features and extensions.
- * A convenience function to be called by drivers.
- */
-void
-_mesa_enable_1_4_extensions(struct gl_context *ctx)
-{
- ctx->Extensions.ARB_depth_texture = GL_TRUE;
- ctx->Extensions.ARB_shadow = GL_TRUE;
- ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
- ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE;
- ctx->Extensions.ARB_window_pos = GL_TRUE;
- ctx->Extensions.EXT_blend_color = GL_TRUE;
- ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
- ctx->Extensions.EXT_blend_minmax = GL_TRUE;
- ctx->Extensions.EXT_blend_subtract = GL_TRUE;
- ctx->Extensions.EXT_fog_coord = GL_TRUE;
- /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/
- ctx->Extensions.EXT_point_parameters = GL_TRUE;
- ctx->Extensions.EXT_secondary_color = GL_TRUE;
- ctx->Extensions.EXT_stencil_wrap = GL_TRUE;
- ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
- /*ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;*/
-}
-
-
-/**
- * Enable all OpenGL 1.5 features and extensions.
- * A convenience function to be called by drivers.
- */
-void
-_mesa_enable_1_5_extensions(struct gl_context *ctx)
-{
- ctx->Extensions.ARB_occlusion_query = GL_TRUE;
- /*ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;*/
- ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
-}
-
-
-/**
- * Enable all OpenGL 2.0 features and extensions.
- * A convenience function to be called by drivers.
- */
-void
-_mesa_enable_2_0_extensions(struct gl_context *ctx)
-{
- /*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
-#if FEATURE_ARB_fragment_shader
- ctx->Extensions.ARB_fragment_shader = GL_TRUE;
-#endif
- ctx->Extensions.ARB_point_sprite = GL_TRUE;
- ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
- ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
-#if FEATURE_ARB_shader_objects
- ctx->Extensions.ARB_shader_objects = GL_TRUE;
-#endif
-#if FEATURE_ARB_shading_language_100
- ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
-#endif
- ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
-#if FEATURE_ARB_vertex_shader
- ctx->Extensions.ARB_vertex_shader = GL_TRUE;
-#endif
-}
-
-
-/**
- * Enable all OpenGL 2.1 features and extensions.
- * A convenience function to be called by drivers.
- */
-void
-_mesa_enable_2_1_extensions(struct gl_context *ctx)
-{
-#if FEATURE_EXT_pixel_buffer_object
- ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
-#endif
-#if FEATURE_EXT_texture_sRGB
- ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
-#endif
-}
-
-
-/**
- * Either enable or disable the named extension.
- * \return GL_TRUE for success, GL_FALSE if invalid extension name
- */
-static GLboolean
-set_extension( struct gl_context *ctx, const char *name, GLboolean state )
-{
- GLboolean *base = (GLboolean *) &ctx->Extensions;
- GLuint i;
-
- if (ctx->Extensions.String) {
- /* The string was already queried - can't change it now! */
- _mesa_problem(ctx, "Trying to enable/disable extension after glGetString(GL_EXTENSIONS): %s", name);
- return GL_FALSE;
- }
-
- for (i = 0 ; i < Elements(default_extensions) ; i++) {
- if (strcmp(default_extensions[i].name, name) == 0) {
- if (default_extensions[i].flag_offset) {
- GLboolean *enabled = base + default_extensions[i].flag_offset;
- *enabled = state;
- }
- return GL_TRUE;
- }
- }
- return GL_FALSE;
-}
-
-
-/**
- * Enable the named extension.
- * Typically called by drivers.
- */
-void
-_mesa_enable_extension( struct gl_context *ctx, const char *name )
-{
- if (!set_extension(ctx, name, GL_TRUE))
- _mesa_problem(ctx, "Trying to enable unknown extension: %s", name);
-}
-
-
-/**
- * Disable the named extension.
- * XXX is this really needed???
- */
-void
-_mesa_disable_extension( struct gl_context *ctx, const char *name )
-{
- if (!set_extension(ctx, name, GL_FALSE))
- _mesa_problem(ctx, "Trying to disable unknown extension: %s", name);
-}
-
-
-/**
- * Check if the i-th extension is enabled.
- */
-static GLboolean
-extension_enabled(struct gl_context *ctx, GLuint index)
-{
- const GLboolean *base = (const GLboolean *) &ctx->Extensions;
- if (!default_extensions[index].flag_offset ||
- *(base + default_extensions[index].flag_offset)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-
-/**
- * Test if the named extension is enabled in this context.
- */
-GLboolean
-_mesa_extension_is_enabled( struct gl_context *ctx, const char *name )
-{
- GLuint i;
-
- for (i = 0 ; i < Elements(default_extensions) ; i++) {
- if (strcmp(default_extensions[i].name, name) == 0) {
- return extension_enabled(ctx, i);
- }
- }
- return GL_FALSE;
-}
-
-
-/**
- * Append string 'b' onto string 'a'. Free 'a' and return new string.
- */
-static char *
-append(const char *a, const char *b)
-{
- const GLuint aLen = a ? strlen(a) : 0;
- const GLuint bLen = b ? strlen(b) : 0;
- char *s = calloc(1, aLen + bLen + 1);
- if (s) {
- if (a)
- memcpy(s, a, aLen);
- if (b)
- memcpy(s + aLen, b, bLen);
- s[aLen + bLen] = '\0';
- }
- if (a)
- free((void *) a);
- return s;
-}
-
-
-/**
- * Check the MESA_EXTENSION_OVERRIDE env var.
- * For extension names that are recognized, turn them on. For extension
- * names that are recognized and prefixed with '-', turn them off.
- * Return a string of the unknown/leftover names.
- */
-static const char *
-get_extension_override( struct gl_context *ctx )
-{
- const char *envExt = _mesa_getenv("MESA_EXTENSION_OVERRIDE");
- char *extraExt = NULL;
- char ext[1000];
- GLuint extLen = 0;
- GLuint i;
- GLboolean disableExt = GL_FALSE;
-
- if (!envExt)
- return NULL;
-
- for (i = 0; ; i++) {
- if (envExt[i] == '\0' || envExt[i] == ' ') {
- /* terminate/process 'ext' if extLen > 0 */
- if (extLen > 0) {
- assert(extLen < sizeof(ext));
- /* enable extension named by 'ext' */
- ext[extLen] = 0;
- if (!set_extension(ctx, ext, !disableExt)) {
- /* unknown extension name, append it to extraExt */
- if (extraExt) {
- extraExt = append(extraExt, " ");
- }
- extraExt = append(extraExt, ext);
- }
- extLen = 0;
- disableExt = GL_FALSE;
- }
- if (envExt[i] == '\0')
- break;
- }
- else if (envExt[i] == '-') {
- disableExt = GL_TRUE;
- }
- else {
- /* accumulate this non-space character */
- ext[extLen++] = envExt[i];
- }
- }
-
- return extraExt;
-}
-
-
-/**
- * Run through the default_extensions array above and set the
- * ctx->Extensions.ARB/EXT_* flags accordingly.
- * To be called during context initialization.
- */
-void
-_mesa_init_extensions( struct gl_context *ctx )
-{
- GLboolean *base = (GLboolean *) &ctx->Extensions;
- GLuint i;
-
- for (i = 0 ; i < Elements(default_extensions) ; i++) {
- if (default_extensions[i].enabled &&
- default_extensions[i].flag_offset) {
- *(base + default_extensions[i].flag_offset) = GL_TRUE;
- }
- }
-}
-
-
-/**
- * Construct the GL_EXTENSIONS string. Called the first time that
- * glGetString(GL_EXTENSIONS) is called.
- */
-static GLubyte *
-compute_extensions( struct gl_context *ctx )
-{
- const char *extraExt = get_extension_override(ctx);
- GLuint extStrLen = 0;
- char *s;
- GLuint i;
-
- /* first, compute length of the extension string */
- for (i = 0 ; i < Elements(default_extensions) ; i++) {
- if (extension_enabled(ctx, i)) {
- extStrLen += (GLuint) strlen(default_extensions[i].name) + 1;
- }
- }
-
- if (extraExt)
- extStrLen += strlen(extraExt) + 1; /* +1 for space */
-
- /* allocate the extension string */
- s = (char *) malloc(extStrLen);
- if (!s)
- return NULL;
-
- /* second, build the extension string */
- extStrLen = 0;
- for (i = 0 ; i < Elements(default_extensions) ; i++) {
- if (extension_enabled(ctx, i)) {
- GLuint len = (GLuint) strlen(default_extensions[i].name);
- memcpy(s + extStrLen, default_extensions[i].name, len);
- extStrLen += len;
- s[extStrLen] = ' ';
- extStrLen++;
- }
- }
- ASSERT(extStrLen > 0);
-
- s[extStrLen - 1] = 0; /* -1 to overwrite trailing the ' ' */
-
- if (extraExt) {
- s = append(s, " ");
- s = append(s, extraExt);
- }
-
- 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 struct gl_context *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 struct gl_context *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 struct gl_context *ctx, GLubyte *str)
-{
- size_t len = 0;
-
- 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 0
- /* disabled because of missing GLSL support */
- if (ctx->Extensions.EXT_texture3D)
- len += append_extension(&str, "GL_OES_texture_3D");
-#endif
-
- 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
-
- if (ctx->Extensions.EXT_texture_format_BGRA8888)
- len += append_extension(&str, "GL_EXT_texture_format_BGRA8888");
-
- return len;
-}
-
-static GLubyte *
-compute_extensions_es2(struct gl_context *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(struct gl_context *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.
- */
-GLuint
-_mesa_get_extension_count(struct gl_context *ctx)
-{
- GLuint i;
-
- /* only count once */
- if (!ctx->Extensions.Count) {
- for (i = 0; i < Elements(default_extensions); i++) {
- if (extension_enabled(ctx, i)) {
- ctx->Extensions.Count++;
- }
- }
- }
-
- if (0)
- _mesa_debug(ctx, "%u of %d extensions enabled\n", ctx->Extensions.Count,
- (int) Elements(default_extensions));
-
- return ctx->Extensions.Count;
-}
-
-
-/**
- * Return name of i-th enabled extension
- */
-const GLubyte *
-_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)
-{
- GLuint i;
-
- for (i = 0; i < Elements(default_extensions); i++) {
- if (extension_enabled(ctx, i)) {
- if (index == 0)
- return (const GLubyte *) default_extensions[i].name;
- index--;
- }
- }
-
- return NULL;
-}
diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h
deleted file mode 100644
index a9ed41f..0000000
--- a/src/mesa/main/extensions.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * \file extensions.h
- * Extension handling.
- *
- * \if subset
- * (No-op)
- *
- * \endif
- */
-
-/*
- * 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 _EXTENSIONS_H_
-#define _EXTENSIONS_H_
-
-#include "glheader.h"
-#include "mfeatures.h"
-
-struct gl_context;
-
-#if _HAVE_FULL_GL
-
-extern void _mesa_enable_sw_extensions(struct gl_context *ctx);
-
-extern void _mesa_enable_imaging_extensions(struct gl_context *ctx);
-
-extern void _mesa_enable_1_3_extensions(struct gl_context *ctx);
-
-extern void _mesa_enable_1_4_extensions(struct gl_context *ctx);
-
-extern void _mesa_enable_1_5_extensions(struct gl_context *ctx);
-
-extern void _mesa_enable_2_0_extensions(struct gl_context *ctx);
-
-extern void _mesa_enable_2_1_extensions(struct gl_context *ctx);
-
-extern void _mesa_enable_extension(struct gl_context *ctx, const char *name);
-
-extern void _mesa_disable_extension(struct gl_context *ctx, const char *name);
-
-extern GLboolean _mesa_extension_is_enabled(struct gl_context *ctx, const char *name);
-
-extern void _mesa_init_extensions(struct gl_context *ctx);
-
-extern GLubyte *_mesa_make_extension_string(struct gl_context *ctx);
-
-extern GLuint
-_mesa_get_extension_count(struct gl_context *ctx);
-
-extern const GLubyte *
-_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index);
-
-
-#else
-
-/** No-op */
-#define _mesa_extensions_dtr( ctx ) ((void)0)
-
-/** No-op */
-#define _mesa_extensions_ctr( ctx ) ((void)0)
-
-/** No-op */
-#define _mesa_extensions_get_string( ctx ) "GL_EXT_texture_object"
-
-/** No-op */
-#define _mesa_enable_imaging_extensions( c ) ((void)0)
-
-/** No-op */
-#define _mesa_enable_extension( c, n ) ((void)0)
-
-#endif
-
-#endif
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
deleted file mode 100644
index cd9eb81..0000000
--- a/src/mesa/main/formats.c
+++ /dev/null
@@ -1,1492 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2008-2009 VMware, 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
- * 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 "imports.h"
-#include "formats.h"
-#include "mfeatures.h"
-
-
-/**
- * Information about texture formats.
- */
-struct gl_format_info
-{
- gl_format Name;
-
- /** text name for debugging */
- const char *StrName;
-
- /**
- * Base format is one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE,
- * GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA, GL_COLOR_INDEX,
- * GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL.
- */
- GLenum BaseFormat;
-
- /**
- * Logical data type: one of GL_UNSIGNED_NORMALIZED, GL_SIGNED_NORMALED,
- * GL_UNSIGNED_INT, GL_INT, GL_FLOAT.
- */
- GLenum DataType;
-
- GLubyte RedBits;
- GLubyte GreenBits;
- GLubyte BlueBits;
- GLubyte AlphaBits;
- GLubyte LuminanceBits;
- GLubyte IntensityBits;
- GLubyte IndexBits;
- GLubyte DepthBits;
- GLubyte StencilBits;
-
- /**
- * To describe compressed formats. If not compressed, Width=Height=1.
- */
- GLubyte BlockWidth, BlockHeight;
- GLubyte BytesPerBlock;
-};
-
-
-/**
- * Info about each format.
- * These must be in the same order as the MESA_FORMAT_* enums so that
- * we can do lookups without searching.
- */
-static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
-{
- {
- MESA_FORMAT_NONE, /* Name */
- "MESA_FORMAT_NONE", /* StrName */
- GL_NONE, /* BaseFormat */
- GL_NONE, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 0, 0, 0 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_RGBA8888, /* Name */
- "MESA_FORMAT_RGBA8888", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_RGBA8888_REV, /* Name */
- "MESA_FORMAT_RGBA8888_REV", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_ARGB8888, /* Name */
- "MESA_FORMAT_ARGB8888", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_ARGB8888_REV, /* Name */
- "MESA_FORMAT_ARGB8888_REV", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_XRGB8888, /* Name */
- "MESA_FORMAT_XRGB8888", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_XRGB8888_REV, /* Name */
- "MESA_FORMAT_XRGB8888_REV", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_RGB888, /* Name */
- "MESA_FORMAT_RGB888", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 3 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_BGR888, /* Name */
- "MESA_FORMAT_BGR888", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 3 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_RGB565, /* Name */
- "MESA_FORMAT_RGB565", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_RGB565_REV, /* Name */
- "MESA_FORMAT_RGB565_REV", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_ARGB4444, /* Name */
- "MESA_FORMAT_ARGB4444", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_ARGB4444_REV, /* Name */
- "MESA_FORMAT_ARGB4444_REV", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_RGBA5551, /* Name */
- "MESA_FORMAT_RGBA5551", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_ARGB1555, /* Name */
- "MESA_FORMAT_ARGB1555", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_ARGB1555_REV, /* Name */
- "MESA_FORMAT_ARGB1555_REV", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_AL88, /* Name */
- "MESA_FORMAT_AL88", /* StrName */
- GL_LUMINANCE_ALPHA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */
- 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_AL88_REV, /* Name */
- "MESA_FORMAT_AL88_REV", /* StrName */
- GL_LUMINANCE_ALPHA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */
- 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_AL1616, /* Name */
- "MESA_FORMAT_AL1616", /* StrName */
- GL_LUMINANCE_ALPHA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */
- 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_AL1616_REV, /* Name */
- "MESA_FORMAT_AL1616_REV", /* StrName */
- GL_LUMINANCE_ALPHA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */
- 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_RGB332, /* Name */
- "MESA_FORMAT_RGB332", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 3, 3, 2, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 1 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_A8, /* Name */
- "MESA_FORMAT_A8", /* StrName */
- GL_ALPHA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 1 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_L8, /* Name */
- "MESA_FORMAT_L8", /* StrName */
- GL_LUMINANCE, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 1 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_I8, /* Name */
- "MESA_FORMAT_I8", /* StrName */
- GL_INTENSITY, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 8, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 1 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_CI8, /* Name */
- "MESA_FORMAT_CI8", /* StrName */
- GL_COLOR_INDEX, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 8, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 1 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_YCBCR, /* Name */
- "MESA_FORMAT_YCBCR", /* StrName */
- GL_YCBCR_MESA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_YCBCR_REV, /* Name */
- "MESA_FORMAT_YCBCR_REV", /* StrName */
- GL_YCBCR_MESA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_R8,
- "MESA_FORMAT_R8",
- GL_RED,
- GL_UNSIGNED_NORMALIZED,
- 8, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1
- },
- {
- MESA_FORMAT_RG88,
- "MESA_FORMAT_RG88",
- GL_RG,
- GL_UNSIGNED_NORMALIZED,
- 8, 8, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_RG88_REV,
- "MESA_FORMAT_RG88_REV",
- GL_RG,
- GL_UNSIGNED_NORMALIZED,
- 8, 8, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_R16,
- "MESA_FORMAT_R16",
- GL_RED,
- GL_UNSIGNED_NORMALIZED,
- 16, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_RG1616,
- "MESA_FORMAT_RG1616",
- GL_RG,
- GL_UNSIGNED_NORMALIZED,
- 16, 16, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_RG1616_REV,
- "MESA_FORMAT_RG1616_REV",
- GL_RG,
- GL_UNSIGNED_NORMALIZED,
- 16, 16, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_Z24_S8, /* Name */
- "MESA_FORMAT_Z24_S8", /* StrName */
- GL_DEPTH_STENCIL, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_S8_Z24, /* Name */
- "MESA_FORMAT_S8_Z24", /* StrName */
- GL_DEPTH_STENCIL, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_Z16, /* Name */
- "MESA_FORMAT_Z16", /* StrName */
- GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 16, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_X8_Z24, /* Name */
- "MESA_FORMAT_X8_Z24", /* StrName */
- GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_Z24_X8, /* Name */
- "MESA_FORMAT_Z24_X8", /* StrName */
- GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_Z32, /* Name */
- "MESA_FORMAT_Z32", /* StrName */
- GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 4 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_S8, /* Name */
- "MESA_FORMAT_S8", /* StrName */
- GL_STENCIL_INDEX, /* BaseFormat */
- GL_UNSIGNED_INT, /* DataType */
- 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 8, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 1 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_SRGB8,
- "MESA_FORMAT_SRGB8",
- GL_RGB,
- GL_UNSIGNED_NORMALIZED,
- 8, 8, 8, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 3
- },
- {
- MESA_FORMAT_SRGBA8,
- "MESA_FORMAT_SRGBA8",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 8, 8, 8, 8,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_SARGB8,
- "MESA_FORMAT_SARGB8",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 8, 8, 8, 8,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_SL8,
- "MESA_FORMAT_SL8",
- GL_LUMINANCE,
- GL_UNSIGNED_NORMALIZED,
- 0, 0, 0, 0,
- 8, 0, 0, 0, 0,
- 1, 1, 1
- },
- {
- MESA_FORMAT_SLA8,
- "MESA_FORMAT_SLA8",
- GL_LUMINANCE_ALPHA,
- GL_UNSIGNED_NORMALIZED,
- 0, 0, 0, 8,
- 8, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_SRGB_DXT1, /* Name */
- "MESA_FORMAT_SRGB_DXT1", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_SRGBA_DXT1,
- "MESA_FORMAT_SRGBA_DXT1",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_SRGBA_DXT3,
- "MESA_FORMAT_SRGBA_DXT3",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_SRGBA_DXT5,
- "MESA_FORMAT_SRGBA_DXT5",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
-
- {
- MESA_FORMAT_RGB_FXT1,
- "MESA_FORMAT_RGB_FXT1",
- GL_RGB,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 0, /* approx Red/Green/BlueBits */
- 0, 0, 0, 0, 0,
- 8, 4, 16 /* 16 bytes per 8x4 block */
- },
- {
- MESA_FORMAT_RGBA_FXT1,
- "MESA_FORMAT_RGBA_FXT1",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 1, /* approx Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0,
- 8, 4, 16 /* 16 bytes per 8x4 block */
- },
-
- {
- MESA_FORMAT_RGB_DXT1, /* Name */
- "MESA_FORMAT_RGB_DXT1", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_RGBA_DXT1,
- "MESA_FORMAT_RGBA_DXT1",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_RGBA_DXT3,
- "MESA_FORMAT_RGBA_DXT3",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_RGBA_DXT5,
- "MESA_FORMAT_RGBA_DXT5",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_RGBA_FLOAT32,
- "MESA_FORMAT_RGBA_FLOAT32",
- GL_RGBA,
- GL_FLOAT,
- 32, 32, 32, 32,
- 0, 0, 0, 0, 0,
- 1, 1, 16
- },
- {
- MESA_FORMAT_RGBA_FLOAT16,
- "MESA_FORMAT_RGBA_FLOAT16",
- GL_RGBA,
- GL_FLOAT,
- 16, 16, 16, 16,
- 0, 0, 0, 0, 0,
- 1, 1, 8
- },
- {
- MESA_FORMAT_RGB_FLOAT32,
- "MESA_FORMAT_RGB_FLOAT32",
- GL_RGB,
- GL_FLOAT,
- 32, 32, 32, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 12
- },
- {
- MESA_FORMAT_RGB_FLOAT16,
- "MESA_FORMAT_RGB_FLOAT16",
- GL_RGB,
- GL_FLOAT,
- 16, 16, 16, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 6
- },
- {
- MESA_FORMAT_ALPHA_FLOAT32,
- "MESA_FORMAT_ALPHA_FLOAT32",
- GL_ALPHA,
- GL_FLOAT,
- 0, 0, 0, 32,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_ALPHA_FLOAT16,
- "MESA_FORMAT_ALPHA_FLOAT16",
- GL_ALPHA,
- GL_FLOAT,
- 0, 0, 0, 16,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_LUMINANCE_FLOAT32,
- "MESA_FORMAT_LUMINANCE_FLOAT32",
- GL_ALPHA,
- GL_FLOAT,
- 0, 0, 0, 0,
- 32, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_LUMINANCE_FLOAT16,
- "MESA_FORMAT_LUMINANCE_FLOAT16",
- GL_ALPHA,
- GL_FLOAT,
- 0, 0, 0, 0,
- 16, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
- "MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32",
- GL_LUMINANCE_ALPHA,
- GL_FLOAT,
- 0, 0, 0, 32,
- 32, 0, 0, 0, 0,
- 1, 1, 8
- },
- {
- MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
- "MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16",
- GL_LUMINANCE_ALPHA,
- GL_FLOAT,
- 0, 0, 0, 16,
- 16, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_INTENSITY_FLOAT32,
- "MESA_FORMAT_INTENSITY_FLOAT32",
- GL_INTENSITY,
- GL_FLOAT,
- 0, 0, 0, 0,
- 0, 32, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_INTENSITY_FLOAT16,
- "MESA_FORMAT_INTENSITY_FLOAT16",
- GL_INTENSITY,
- GL_FLOAT,
- 0, 0, 0, 0,
- 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",
- GL_DUDV_ATI,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 0,
- 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",
- GL_RGBA,
- GL_SIGNED_NORMALIZED,
- 8, 8, 8, 8,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_SIGNED_RGBA8888_REV,
- "MESA_FORMAT_SIGNED_RGBA8888_REV",
- GL_RGBA,
- GL_SIGNED_NORMALIZED,
- 8, 8, 8, 8,
- 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",
- GL_RGBA,
- GL_SIGNED_NORMALIZED,
- 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
- }
-};
-
-
-
-static const struct gl_format_info *
-_mesa_get_format_info(gl_format format)
-{
- const struct gl_format_info *info = &format_info[format];
- assert(info->Name == format);
- return info;
-}
-
-
-/** Return string name of format (for debugging) */
-const char *
-_mesa_get_format_name(gl_format format)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- ASSERT(info->BytesPerBlock);
- return info->StrName;
-}
-
-
-
-/**
- * Return bytes needed to store a block of pixels in the given format.
- * Normally, a block is 1x1 (a single pixel). But for compressed formats
- * a block may be 4x4 or 8x4, etc.
- */
-GLuint
-_mesa_get_format_bytes(gl_format format)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- ASSERT(info->BytesPerBlock);
- return info->BytesPerBlock;
-}
-
-
-/**
- * Return bits per component for the given format.
- * \param format one of MESA_FORMAT_x
- * \param pname the component, such as GL_RED_BITS, GL_TEXTURE_BLUE_BITS, etc.
- */
-GLint
-_mesa_get_format_bits(gl_format format, GLenum pname)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
-
- switch (pname) {
- case GL_RED_BITS:
- case GL_TEXTURE_RED_SIZE:
- case GL_RENDERBUFFER_RED_SIZE_EXT:
- case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
- return info->RedBits;
- case GL_GREEN_BITS:
- case GL_TEXTURE_GREEN_SIZE:
- case GL_RENDERBUFFER_GREEN_SIZE_EXT:
- case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
- return info->GreenBits;
- case GL_BLUE_BITS:
- case GL_TEXTURE_BLUE_SIZE:
- case GL_RENDERBUFFER_BLUE_SIZE_EXT:
- case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
- return info->BlueBits;
- case GL_ALPHA_BITS:
- case GL_TEXTURE_ALPHA_SIZE:
- case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
- case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
- return info->AlphaBits;
- case GL_TEXTURE_INTENSITY_SIZE:
- return info->IntensityBits;
- case GL_TEXTURE_LUMINANCE_SIZE:
- return info->LuminanceBits;
- case GL_INDEX_BITS:
- case GL_TEXTURE_INDEX_SIZE_EXT:
- return info->IndexBits;
- case GL_DEPTH_BITS:
- case GL_TEXTURE_DEPTH_SIZE_ARB:
- case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
- case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
- return info->DepthBits;
- case GL_STENCIL_BITS:
- case GL_TEXTURE_STENCIL_SIZE_EXT:
- case GL_RENDERBUFFER_STENCIL_SIZE_EXT:
- case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
- return info->StencilBits;
- default:
- _mesa_problem(NULL, "bad pname in _mesa_get_format_bits()");
- return 0;
- }
-}
-
-
-/**
- * Return the data type (or more specifically, the data representation)
- * for the given format.
- * The return value will be one of:
- * GL_UNSIGNED_NORMALIZED = unsigned int representing [0,1]
- * GL_SIGNED_NORMALIZED = signed int representing [-1, 1]
- * GL_UNSIGNED_INT = an ordinary unsigned integer
- * GL_INT = an ordinary signed integer
- * GL_FLOAT = an ordinary float
- */
-GLenum
-_mesa_get_format_datatype(gl_format format)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- return info->DataType;
-}
-
-
-/**
- * Return the basic format for the given type. The result will be
- * one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
- * GL_INTENSITY, GL_YCBCR_MESA, GL_COLOR_INDEX, GL_DEPTH_COMPONENT,
- * GL_STENCIL_INDEX, GL_DEPTH_STENCIL.
- */
-GLenum
-_mesa_get_format_base_format(gl_format format)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- return info->BaseFormat;
-}
-
-
-/**
- * Return the block size (in pixels) for the given format. Normally
- * the block size is 1x1. But compressed formats will have block sizes
- * of 4x4 or 8x4 pixels, etc.
- * \param bw returns block width in pixels
- * \param bh returns block height in pixels
- */
-void
-_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- *bw = info->BlockWidth;
- *bh = info->BlockHeight;
-}
-
-
-/** Is the given format a compressed format? */
-GLboolean
-_mesa_is_format_compressed(gl_format format)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- return info->BlockWidth > 1 || info->BlockHeight > 1;
-}
-
-
-/**
- * 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;
-}
-
-
-/**
- * Is the given format a signed/unsigned integer color format?
- */
-GLboolean
-_mesa_is_format_integer_color(gl_format format)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- return (info->DataType == GL_INT || info->DataType == GL_UNSIGNED_INT) &&
- info->BaseFormat != GL_DEPTH_COMPONENT &&
- info->BaseFormat != GL_DEPTH_STENCIL &&
- info->BaseFormat != GL_STENCIL_INDEX;
-}
-
-
-/**
- * Return color encoding for given format.
- * \return GL_LINEAR or GL_SRGB
- */
-GLenum
-_mesa_get_format_color_encoding(gl_format format)
-{
- /* XXX this info should be encoded in gl_format_info */
- switch (format) {
- case MESA_FORMAT_SRGB8:
- case MESA_FORMAT_SRGBA8:
- case MESA_FORMAT_SARGB8:
- case MESA_FORMAT_SL8:
- case MESA_FORMAT_SLA8:
- case MESA_FORMAT_SRGB_DXT1:
- case MESA_FORMAT_SRGBA_DXT1:
- case MESA_FORMAT_SRGBA_DXT3:
- case MESA_FORMAT_SRGBA_DXT5:
- return GL_SRGB;
- default:
- return GL_LINEAR;
- }
-}
-
-
-/**
- * Return number of bytes needed to store an image of the given size
- * in the given format.
- */
-GLuint
-_mesa_format_image_size(gl_format format, GLsizei width,
- GLsizei height, GLsizei depth)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- /* Strictly speaking, a conditional isn't needed here */
- if (info->BlockWidth > 1 || info->BlockHeight > 1) {
- /* compressed format (2D only for now) */
- const GLuint bw = info->BlockWidth, bh = info->BlockHeight;
- const GLuint wblocks = (width + bw - 1) / bw;
- const GLuint hblocks = (height + bh - 1) / bh;
- const GLuint sz = wblocks * hblocks * info->BytesPerBlock;
- assert(depth == 1);
- return sz;
- }
- else {
- /* non-compressed */
- const GLuint sz = width * height * depth * info->BytesPerBlock;
- return sz;
- }
-}
-
-
-/**
- * Same as _mesa_format_image_size() but returns a 64-bit value to
- * accomodate very large textures.
- */
-uint64_t
-_mesa_format_image_size64(gl_format format, GLsizei width,
- GLsizei height, GLsizei depth)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- /* Strictly speaking, a conditional isn't needed here */
- if (info->BlockWidth > 1 || info->BlockHeight > 1) {
- /* compressed format (2D only for now) */
- const uint64_t bw = info->BlockWidth, bh = info->BlockHeight;
- const uint64_t wblocks = (width + bw - 1) / bw;
- const uint64_t hblocks = (height + bh - 1) / bh;
- const uint64_t sz = wblocks * hblocks * info->BytesPerBlock;
- assert(depth == 1);
- return sz;
- }
- else {
- /* non-compressed */
- const uint64_t sz = ((uint64_t) width *
- (uint64_t) height *
- (uint64_t) depth *
- info->BytesPerBlock);
- return sz;
- }
-}
-
-
-
-GLint
-_mesa_format_row_stride(gl_format format, GLsizei width)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- /* Strictly speaking, a conditional isn't needed here */
- if (info->BlockWidth > 1 || info->BlockHeight > 1) {
- /* compressed format */
- const GLuint bw = info->BlockWidth;
- const GLuint wblocks = (width + bw - 1) / bw;
- const GLint stride = wblocks * info->BytesPerBlock;
- return stride;
- }
- else {
- const GLint stride = width * info->BytesPerBlock;
- return stride;
- }
-}
-
-
-
-/**
- * Do sanity checking of the format info table.
- */
-void
-_mesa_test_formats(void)
-{
- GLuint i;
-
- assert(Elements(format_info) == MESA_FORMAT_COUNT);
-
- for (i = 0; i < MESA_FORMAT_COUNT; i++) {
- const struct gl_format_info *info = _mesa_get_format_info(i);
- assert(info);
-
- assert(info->Name == i);
-
- if (info->Name == MESA_FORMAT_NONE)
- continue;
-
- if (info->BlockWidth == 1 && info->BlockHeight == 1) {
- if (info->RedBits > 0) {
- GLuint t = info->RedBits + info->GreenBits
- + info->BlueBits + info->AlphaBits;
- assert(t / 8 == info->BytesPerBlock);
- (void) t;
- }
- }
-
- assert(info->DataType == GL_UNSIGNED_NORMALIZED ||
- info->DataType == GL_SIGNED_NORMALIZED ||
- info->DataType == GL_UNSIGNED_INT ||
- info->DataType == GL_FLOAT);
-
- if (info->BaseFormat == GL_RGB) {
- assert(info->RedBits > 0);
- assert(info->GreenBits > 0);
- assert(info->BlueBits > 0);
- assert(info->AlphaBits == 0);
- assert(info->LuminanceBits == 0);
- assert(info->IntensityBits == 0);
- }
- else if (info->BaseFormat == GL_RGBA) {
- assert(info->RedBits > 0);
- assert(info->GreenBits > 0);
- assert(info->BlueBits > 0);
- assert(info->AlphaBits > 0);
- assert(info->LuminanceBits == 0);
- assert(info->IntensityBits == 0);
- }
- else if (info->BaseFormat == GL_RG) {
- assert(info->RedBits > 0);
- assert(info->GreenBits > 0);
- assert(info->BlueBits == 0);
- assert(info->AlphaBits == 0);
- assert(info->LuminanceBits == 0);
- assert(info->IntensityBits == 0);
- }
- else if (info->BaseFormat == GL_RED) {
- assert(info->RedBits > 0);
- assert(info->GreenBits == 0);
- assert(info->BlueBits == 0);
- assert(info->AlphaBits == 0);
- assert(info->LuminanceBits == 0);
- assert(info->IntensityBits == 0);
- }
- else if (info->BaseFormat == GL_LUMINANCE) {
- assert(info->RedBits == 0);
- assert(info->GreenBits == 0);
- assert(info->BlueBits == 0);
- assert(info->AlphaBits == 0);
- assert(info->LuminanceBits > 0);
- assert(info->IntensityBits == 0);
- }
- else if (info->BaseFormat == GL_INTENSITY) {
- assert(info->RedBits == 0);
- assert(info->GreenBits == 0);
- assert(info->BlueBits == 0);
- assert(info->AlphaBits == 0);
- assert(info->LuminanceBits == 0);
- assert(info->IntensityBits > 0);
- }
-
- }
-}
-
-
-
-/**
- * Return datatype and number of components per texel for the given gl_format.
- * Only used for mipmap generation code.
- */
-void
-_mesa_format_to_type_and_comps(gl_format format,
- GLenum *datatype, GLuint *comps)
-{
- switch (format) {
- case MESA_FORMAT_RGBA8888:
- case MESA_FORMAT_RGBA8888_REV:
- case MESA_FORMAT_ARGB8888:
- case MESA_FORMAT_ARGB8888_REV:
- case MESA_FORMAT_XRGB8888:
- case MESA_FORMAT_XRGB8888_REV:
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 4;
- return;
- case MESA_FORMAT_RGB888:
- case MESA_FORMAT_BGR888:
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 3;
- return;
- case MESA_FORMAT_RGB565:
- case MESA_FORMAT_RGB565_REV:
- *datatype = GL_UNSIGNED_SHORT_5_6_5;
- *comps = 3;
- return;
-
- case MESA_FORMAT_ARGB4444:
- case MESA_FORMAT_ARGB4444_REV:
- *datatype = GL_UNSIGNED_SHORT_4_4_4_4;
- *comps = 4;
- return;
-
- case MESA_FORMAT_ARGB1555:
- case MESA_FORMAT_ARGB1555_REV:
- *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
- *comps = 4;
- return;
-
- case MESA_FORMAT_RGBA5551:
- *datatype = GL_UNSIGNED_SHORT_5_5_5_1;
- *comps = 4;
- return;
-
- case MESA_FORMAT_AL88:
- case MESA_FORMAT_AL88_REV:
- case MESA_FORMAT_RG88:
- case MESA_FORMAT_RG88_REV:
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 2;
- return;
-
- case MESA_FORMAT_AL1616:
- case MESA_FORMAT_AL1616_REV:
- case MESA_FORMAT_RG1616:
- case MESA_FORMAT_RG1616_REV:
- *datatype = GL_UNSIGNED_SHORT;
- *comps = 2;
- return;
-
- case MESA_FORMAT_R16:
- *datatype = GL_UNSIGNED_SHORT;
- *comps = 1;
- return;
-
- case MESA_FORMAT_RGB332:
- *datatype = GL_UNSIGNED_BYTE_3_3_2;
- *comps = 3;
- return;
-
- case MESA_FORMAT_A8:
- case MESA_FORMAT_L8:
- case MESA_FORMAT_I8:
- case MESA_FORMAT_CI8:
- case MESA_FORMAT_R8:
- case MESA_FORMAT_S8:
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 1;
- return;
-
- case MESA_FORMAT_YCBCR:
- case MESA_FORMAT_YCBCR_REV:
- *datatype = GL_UNSIGNED_SHORT;
- *comps = 2;
- return;
-
- case MESA_FORMAT_Z24_S8:
- *datatype = GL_UNSIGNED_INT;
- *comps = 1; /* XXX OK? */
- return;
-
- case MESA_FORMAT_S8_Z24:
- *datatype = GL_UNSIGNED_INT;
- *comps = 1; /* XXX OK? */
- return;
-
- case MESA_FORMAT_Z16:
- *datatype = GL_UNSIGNED_SHORT;
- *comps = 1;
- return;
-
- case MESA_FORMAT_X8_Z24:
- *datatype = GL_UNSIGNED_INT;
- *comps = 1;
- return;
-
- case MESA_FORMAT_Z24_X8:
- *datatype = GL_UNSIGNED_INT;
- *comps = 1;
- return;
-
- case MESA_FORMAT_Z32:
- *datatype = GL_UNSIGNED_INT;
- *comps = 1;
- return;
-
- case MESA_FORMAT_DUDV8:
- *datatype = GL_BYTE;
- *comps = 2;
- return;
-
- case MESA_FORMAT_SIGNED_R8:
- *datatype = GL_BYTE;
- *comps = 1;
- return;
- case MESA_FORMAT_SIGNED_RG88:
- *datatype = GL_BYTE;
- *comps = 2;
- return;
- case MESA_FORMAT_SIGNED_RGBA8888:
- case MESA_FORMAT_SIGNED_RGBA8888_REV:
- case MESA_FORMAT_SIGNED_RGBX8888:
- *datatype = GL_BYTE;
- *comps = 4;
- return;
-
- case MESA_FORMAT_RGBA_16:
- *datatype = GL_UNSIGNED_SHORT;
- *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;
- return;
-
-#if FEATURE_EXT_texture_sRGB
- case MESA_FORMAT_SRGB8:
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 3;
- return;
- case MESA_FORMAT_SRGBA8:
- case MESA_FORMAT_SARGB8:
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 4;
- return;
- case MESA_FORMAT_SL8:
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 1;
- return;
- case MESA_FORMAT_SLA8:
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 2;
- return;
-#endif
-
-#if FEATURE_texture_fxt1
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
-#endif
-#if FEATURE_texture_s3tc
- case MESA_FORMAT_RGB_DXT1:
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_RGBA_DXT3:
- case MESA_FORMAT_RGBA_DXT5:
-#if FEATURE_EXT_texture_sRGB
- case MESA_FORMAT_SRGB_DXT1:
- case MESA_FORMAT_SRGBA_DXT1:
- case MESA_FORMAT_SRGBA_DXT3:
- case MESA_FORMAT_SRGBA_DXT5:
-#endif
-#endif
- /* XXX generate error instead? */
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 0;
- return;
-
- case MESA_FORMAT_RGBA_FLOAT32:
- *datatype = GL_FLOAT;
- *comps = 4;
- return;
- case MESA_FORMAT_RGBA_FLOAT16:
- *datatype = GL_HALF_FLOAT_ARB;
- *comps = 4;
- return;
- case MESA_FORMAT_RGB_FLOAT32:
- *datatype = GL_FLOAT;
- *comps = 3;
- return;
- case MESA_FORMAT_RGB_FLOAT16:
- *datatype = GL_HALF_FLOAT_ARB;
- *comps = 3;
- return;
- case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
- *datatype = GL_FLOAT;
- *comps = 2;
- return;
- case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
- *datatype = GL_HALF_FLOAT_ARB;
- *comps = 2;
- return;
- case MESA_FORMAT_ALPHA_FLOAT32:
- case MESA_FORMAT_LUMINANCE_FLOAT32:
- case MESA_FORMAT_INTENSITY_FLOAT32:
- *datatype = GL_FLOAT;
- *comps = 1;
- return;
- case MESA_FORMAT_ALPHA_FLOAT16:
- case MESA_FORMAT_LUMINANCE_FLOAT16:
- case MESA_FORMAT_INTENSITY_FLOAT16:
- *datatype = GL_HALF_FLOAT_ARB;
- *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;
-
- case MESA_FORMAT_NONE:
- case MESA_FORMAT_COUNT:
- /* For debug builds, warn if any formats are not handled */
-#ifndef DEBUG
- default:
-#endif
- _mesa_problem(NULL, "bad format %s in _mesa_format_to_type_and_comps",
- _mesa_get_format_name(format));
- *datatype = 0;
- *comps = 1;
- }
-}
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
deleted file mode 100644
index 997229b..0000000
--- a/src/mesa/main/formats.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2008-2009 VMware, 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
- * 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.
- */
-
-/*
- * Authors:
- * Brian Paul
- */
-
-
-#ifndef FORMATS_H
-#define FORMATS_H
-
-
-#include <GL/gl.h>
-
-
-
-/**
- * Mesa texture/renderbuffer image formats.
- */
-typedef enum
-{
- MESA_FORMAT_NONE = 0,
-
- /**
- * \name Basic hardware formats
- */
- /*@{*/
- /* msb <------ TEXEL BITS -----------> lsb */
- /* ---- ---- ---- ---- ---- ---- ---- ---- */
- MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
- MESA_FORMAT_RGBA8888_REV, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
- MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
- MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
- MESA_FORMAT_XRGB8888, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
- MESA_FORMAT_XRGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
- MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */
- MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */
- MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */
- MESA_FORMAT_RGB565_REV, /* GGGB BBBB RRRR RGGG */
- MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */
- MESA_FORMAT_ARGB4444_REV, /* GGGG BBBB AAAA RRRR */
- MESA_FORMAT_RGBA5551, /* RRRR RGGG GGBB BBBA */
- MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */
- MESA_FORMAT_ARGB1555_REV, /* GGGB BBBB ARRR RRGG */
- MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */
- MESA_FORMAT_AL88_REV, /* LLLL LLLL AAAA AAAA */
- MESA_FORMAT_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
- MESA_FORMAT_AL1616_REV, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
- MESA_FORMAT_RGB332, /* RRRG GGBB */
- MESA_FORMAT_A8, /* AAAA AAAA */
- MESA_FORMAT_L8, /* LLLL LLLL */
- MESA_FORMAT_I8, /* IIII IIII */
- MESA_FORMAT_CI8, /* CCCC CCCC */
- MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
- MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
- MESA_FORMAT_R8, /* RRRR RRRR */
- MESA_FORMAT_RG88, /* RRRR RRRR GGGG GGGG */
- MESA_FORMAT_RG88_REV, /* GGGG GGGG RRRR RRRR */
- MESA_FORMAT_R16, /* RRRR RRRR RRRR RRRR */
- MESA_FORMAT_RG1616, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
- MESA_FORMAT_RG1616_REV, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
- MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
- MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
- MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */
- MESA_FORMAT_X8_Z24, /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
- MESA_FORMAT_Z24_X8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
- MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
- MESA_FORMAT_S8, /* SSSS SSSS */
- /*@}*/
-
- /**
- * \name 8-bit/channel sRGB formats
- */
- /*@{*/
- MESA_FORMAT_SRGB8,
- MESA_FORMAT_SRGBA8,
- MESA_FORMAT_SARGB8,
- MESA_FORMAT_SL8,
- MESA_FORMAT_SLA8,
- MESA_FORMAT_SRGB_DXT1,
- MESA_FORMAT_SRGBA_DXT1,
- MESA_FORMAT_SRGBA_DXT3,
- MESA_FORMAT_SRGBA_DXT5,
- /*@}*/
-
- /**
- * \name Compressed texture formats.
- */
- /*@{*/
- MESA_FORMAT_RGB_FXT1,
- MESA_FORMAT_RGBA_FXT1,
- MESA_FORMAT_RGB_DXT1,
- MESA_FORMAT_RGBA_DXT1,
- MESA_FORMAT_RGBA_DXT3,
- MESA_FORMAT_RGBA_DXT5,
- /*@}*/
-
- /**
- * \name Floating point texture formats.
- */
- /*@{*/
- MESA_FORMAT_RGBA_FLOAT32,
- MESA_FORMAT_RGBA_FLOAT16,
- MESA_FORMAT_RGB_FLOAT32,
- MESA_FORMAT_RGB_FLOAT16,
- MESA_FORMAT_ALPHA_FLOAT32,
- MESA_FORMAT_ALPHA_FLOAT16,
- MESA_FORMAT_LUMINANCE_FLOAT32,
- MESA_FORMAT_LUMINANCE_FLOAT16,
- MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
- MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
- MESA_FORMAT_INTENSITY_FLOAT32,
- MESA_FORMAT_INTENSITY_FLOAT16,
- /*@}*/
-
- /**
- * \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, /* 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
-} gl_format;
-
-
-extern const char *
-_mesa_get_format_name(gl_format format);
-
-extern GLuint
-_mesa_get_format_bytes(gl_format format);
-
-extern GLint
-_mesa_get_format_bits(gl_format format, GLenum pname);
-
-extern GLenum
-_mesa_get_format_datatype(gl_format format);
-
-extern GLenum
-_mesa_get_format_base_format(gl_format format);
-
-extern void
-_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 GLboolean
-_mesa_is_format_integer_color(gl_format format);
-
-extern GLenum
-_mesa_get_format_color_encoding(gl_format format);
-
-extern GLuint
-_mesa_format_image_size(gl_format format, GLsizei width,
- GLsizei height, GLsizei depth);
-
-extern uint64_t
-_mesa_format_image_size64(gl_format format, GLsizei width,
- GLsizei height, GLsizei depth);
-
-extern GLint
-_mesa_format_row_stride(gl_format format, GLsizei width);
-
-extern void
-_mesa_format_to_type_and_comps(gl_format format,
- GLenum *datatype, GLuint *comps);
-
-extern void
-_mesa_test_formats(void);
-
-#endif /* FORMATS_H */
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
deleted file mode 100644
index 105d4a3..0000000
--- a/src/mesa/main/matrix.c
+++ /dev/null
@@ -1,787 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-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 matrix.c
- * Matrix operations.
- *
- * \note
- * -# 4x4 transformation matrices are stored in memory in column major order.
- * -# Points/vertices are to be thought of as column vectors.
- * -# Transformation of a point p by a matrix M is: p' = M * p
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "enums.h"
-#include "macros.h"
-#include "matrix.h"
-#include "mtypes.h"
-#include "math/m_matrix.h"
-
-
-/**
- * Apply a perspective projection matrix.
- *
- * \param left left clipping plane coordinate.
- * \param right right clipping plane coordinate.
- * \param bottom bottom clipping plane coordinate.
- * \param top top clipping plane coordinate.
- * \param nearval distance to the near clipping plane.
- * \param farval distance to the far clipping plane.
- *
- * \sa glFrustum().
- *
- * Flushes vertices and validates parameters. Calls _math_matrix_frustum() with
- * the top matrix of the current matrix stack and sets
- * __struct gl_contextRec::NewState.
- */
-void GLAPIENTRY
-_mesa_Frustum( GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top,
- GLdouble nearval, GLdouble farval )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (nearval <= 0.0 ||
- farval <= 0.0 ||
- nearval == farval ||
- left == right ||
- top == bottom)
- {
- _mesa_error( ctx, GL_INVALID_VALUE, "glFrustum" );
- return;
- }
-
- _math_matrix_frustum( ctx->CurrentStack->Top,
- (GLfloat) left, (GLfloat) right,
- (GLfloat) bottom, (GLfloat) top,
- (GLfloat) nearval, (GLfloat) farval );
- ctx->NewState |= ctx->CurrentStack->DirtyFlag;
-}
-
-
-/**
- * Apply an orthographic projection matrix.
- *
- * \param left left clipping plane coordinate.
- * \param right right clipping plane coordinate.
- * \param bottom bottom clipping plane coordinate.
- * \param top top clipping plane coordinate.
- * \param nearval distance to the near clipping plane.
- * \param farval distance to the far clipping plane.
- *
- * \sa glOrtho().
- *
- * Flushes vertices and validates parameters. Calls _math_matrix_ortho() with
- * the top matrix of the current matrix stack and sets
- * __struct gl_contextRec::NewState.
- */
-void GLAPIENTRY
-_mesa_Ortho( GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top,
- GLdouble nearval, GLdouble farval )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glOrtho(%f, %f, %f, %f, %f, %f)\n",
- left, right, bottom, top, nearval, farval);
-
- if (left == right ||
- bottom == top ||
- nearval == farval)
- {
- _mesa_error( ctx, GL_INVALID_VALUE, "glOrtho" );
- return;
- }
-
- _math_matrix_ortho( ctx->CurrentStack->Top,
- (GLfloat) left, (GLfloat) right,
- (GLfloat) bottom, (GLfloat) top,
- (GLfloat) nearval, (GLfloat) farval );
- ctx->NewState |= ctx->CurrentStack->DirtyFlag;
-}
-
-
-/**
- * Set the current matrix stack.
- *
- * \param mode matrix stack.
- *
- * \sa glMatrixMode().
- *
- * Flushes the vertices, validates the parameter and updates
- * __struct gl_contextRec::CurrentStack and gl_transform_attrib::MatrixMode with the
- * specified matrix stack.
- */
-void GLAPIENTRY
-_mesa_MatrixMode( GLenum mode )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Transform.MatrixMode == mode && mode != GL_TEXTURE)
- return;
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
-
- switch (mode) {
- case GL_MODELVIEW:
- ctx->CurrentStack = &ctx->ModelviewMatrixStack;
- break;
- case GL_PROJECTION:
- ctx->CurrentStack = &ctx->ProjectionMatrixStack;
- break;
- case GL_TEXTURE:
- /* This error check is disabled because if we're called from
- * glPopAttrib() when the active texture unit is >= MaxTextureCoordUnits
- * we'll generate an unexpected error.
- * From the GL_ARB_vertex_shader spec it sounds like we should instead
- * do error checking in other places when we actually try to access
- * texture matrices beyond MaxTextureCoordUnits.
- */
-#if 0
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(invalid tex unit %d)",
- ctx->Texture.CurrentUnit);
- return;
- }
-#endif
- ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->TextureMatrixStack));
- ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit];
- break;
- case GL_MATRIX0_NV:
- case GL_MATRIX1_NV:
- case GL_MATRIX2_NV:
- case GL_MATRIX3_NV:
- case GL_MATRIX4_NV:
- case GL_MATRIX5_NV:
- case GL_MATRIX6_NV:
- case GL_MATRIX7_NV:
- if (ctx->Extensions.NV_vertex_program) {
- ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" );
- return;
- }
- break;
- case GL_MATRIX0_ARB:
- case GL_MATRIX1_ARB:
- case GL_MATRIX2_ARB:
- case GL_MATRIX3_ARB:
- case GL_MATRIX4_ARB:
- case GL_MATRIX5_ARB:
- case GL_MATRIX6_ARB:
- case GL_MATRIX7_ARB:
- if (ctx->Extensions.ARB_vertex_program ||
- ctx->Extensions.ARB_fragment_program) {
- const GLuint m = mode - GL_MATRIX0_ARB;
- if (m > ctx->Const.MaxProgramMatrices) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glMatrixMode(GL_MATRIX%d_ARB)", m);
- return;
- }
- ctx->CurrentStack = &ctx->ProgramMatrixStack[m];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" );
- return;
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" );
- return;
- }
-
- ctx->Transform.MatrixMode = mode;
-}
-
-
-/**
- * Push the current matrix stack.
- *
- * \sa glPushMatrix().
- *
- * Verifies the current matrix stack is not full, and duplicates the top-most
- * matrix in the stack. Marks __struct gl_contextRec::NewState with the stack dirty
- * flag.
- */
-void GLAPIENTRY
-_mesa_PushMatrix( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_matrix_stack *stack = ctx->CurrentStack;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug(ctx, "glPushMatrix %s\n",
- _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
-
- if (stack->Depth + 1 >= stack->MaxDepth) {
- if (ctx->Transform.MatrixMode == GL_TEXTURE) {
- _mesa_error(ctx, GL_STACK_OVERFLOW,
- "glPushMatrix(mode=GL_TEXTURE, unit=%d)",
- ctx->Texture.CurrentUnit);
- }
- else {
- _mesa_error(ctx, GL_STACK_OVERFLOW, "glPushMatrix(mode=%s)",
- _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
- }
- return;
- }
- _math_matrix_copy( &stack->Stack[stack->Depth + 1],
- &stack->Stack[stack->Depth] );
- stack->Depth++;
- stack->Top = &(stack->Stack[stack->Depth]);
- ctx->NewState |= stack->DirtyFlag;
-}
-
-
-/**
- * Pop the current matrix stack.
- *
- * \sa glPopMatrix().
- *
- * Flushes the vertices, verifies the current matrix stack is not empty, and
- * moves the stack head down. Marks __struct gl_contextRec::NewState with the dirty
- * stack flag.
- */
-void GLAPIENTRY
-_mesa_PopMatrix( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_matrix_stack *stack = ctx->CurrentStack;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug(ctx, "glPopMatrix %s\n",
- _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
-
- if (stack->Depth == 0) {
- if (ctx->Transform.MatrixMode == GL_TEXTURE) {
- _mesa_error(ctx, GL_STACK_UNDERFLOW,
- "glPopMatrix(mode=GL_TEXTURE, unit=%d)",
- ctx->Texture.CurrentUnit);
- }
- else {
- _mesa_error(ctx, GL_STACK_UNDERFLOW, "glPopMatrix(mode=%s)",
- _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
- }
- return;
- }
- stack->Depth--;
- stack->Top = &(stack->Stack[stack->Depth]);
- ctx->NewState |= stack->DirtyFlag;
-}
-
-
-/**
- * Replace the current matrix with the identity matrix.
- *
- * \sa glLoadIdentity().
- *
- * Flushes the vertices and calls _math_matrix_set_identity() with the top-most
- * matrix in the current stack. Marks __struct gl_contextRec::NewState with the stack
- * dirty flag.
- */
-void GLAPIENTRY
-_mesa_LoadIdentity( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glLoadIdentity()\n");
-
- _math_matrix_set_identity( ctx->CurrentStack->Top );
- ctx->NewState |= ctx->CurrentStack->DirtyFlag;
-}
-
-
-/**
- * Replace the current matrix with a given matrix.
- *
- * \param m matrix.
- *
- * \sa glLoadMatrixf().
- *
- * Flushes the vertices and calls _math_matrix_loadf() with the top-most matrix
- * in the current stack and the given matrix. Marks __struct gl_contextRec::NewState
- * with the dirty stack flag.
- */
-void GLAPIENTRY
-_mesa_LoadMatrixf( const GLfloat *m )
-{
- GET_CURRENT_CONTEXT(ctx);
- if (!m) return;
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx,
- "glLoadMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n",
- m[0], m[4], m[8], m[12],
- m[1], m[5], m[9], m[13],
- m[2], m[6], m[10], m[14],
- m[3], m[7], m[11], m[15]);
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- _math_matrix_loadf( ctx->CurrentStack->Top, m );
- ctx->NewState |= ctx->CurrentStack->DirtyFlag;
-}
-
-
-/**
- * Multiply the current matrix with a given matrix.
- *
- * \param m matrix.
- *
- * \sa glMultMatrixf().
- *
- * Flushes the vertices and calls _math_matrix_mul_floats() with the top-most
- * matrix in the current stack and the given matrix. Marks
- * __struct gl_contextRec::NewState with the dirty stack flag.
- */
-void GLAPIENTRY
-_mesa_MultMatrixf( const GLfloat *m )
-{
- GET_CURRENT_CONTEXT(ctx);
- if (!m) return;
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx,
- "glMultMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n",
- m[0], m[4], m[8], m[12],
- m[1], m[5], m[9], m[13],
- m[2], m[6], m[10], m[14],
- m[3], m[7], m[11], m[15]);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- _math_matrix_mul_floats( ctx->CurrentStack->Top, m );
- ctx->NewState |= ctx->CurrentStack->DirtyFlag;
-}
-
-
-/**
- * Multiply the current matrix with a rotation matrix.
- *
- * \param angle angle of rotation, in degrees.
- * \param x rotation vector x coordinate.
- * \param y rotation vector y coordinate.
- * \param z rotation vector z coordinate.
- *
- * \sa glRotatef().
- *
- * Flushes the vertices and calls _math_matrix_rotate() with the top-most
- * matrix in the current stack and the given parameters. Marks
- * __struct gl_contextRec::NewState with the dirty stack flag.
- */
-void GLAPIENTRY
-_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (angle != 0.0F) {
- _math_matrix_rotate( ctx->CurrentStack->Top, angle, x, y, z);
- ctx->NewState |= ctx->CurrentStack->DirtyFlag;
- }
-}
-
-
-/**
- * Multiply the current matrix with a general scaling matrix.
- *
- * \param x x axis scale factor.
- * \param y y axis scale factor.
- * \param z z axis scale factor.
- *
- * \sa glScalef().
- *
- * Flushes the vertices and calls _math_matrix_scale() with the top-most
- * matrix in the current stack and the given parameters. Marks
- * __struct gl_contextRec::NewState with the dirty stack flag.
- */
-void GLAPIENTRY
-_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- _math_matrix_scale( ctx->CurrentStack->Top, x, y, z);
- ctx->NewState |= ctx->CurrentStack->DirtyFlag;
-}
-
-
-/**
- * Multiply the current matrix with a translation matrix.
- *
- * \param x translation vector x coordinate.
- * \param y translation vector y coordinate.
- * \param z translation vector z coordinate.
- *
- * \sa glTranslatef().
- *
- * Flushes the vertices and calls _math_matrix_translate() with the top-most
- * matrix in the current stack and the given parameters. Marks
- * __struct gl_contextRec::NewState with the dirty stack flag.
- */
-void GLAPIENTRY
-_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- _math_matrix_translate( ctx->CurrentStack->Top, x, y, z);
- ctx->NewState |= ctx->CurrentStack->DirtyFlag;
-}
-
-
-#if _HAVE_FULL_GL
-void GLAPIENTRY
-_mesa_LoadMatrixd( const GLdouble *m )
-{
- GLint i;
- GLfloat f[16];
- if (!m) return;
- for (i = 0; i < 16; i++)
- f[i] = (GLfloat) m[i];
- _mesa_LoadMatrixf(f);
-}
-
-void GLAPIENTRY
-_mesa_MultMatrixd( const GLdouble *m )
-{
- GLint i;
- GLfloat f[16];
- if (!m) return;
- for (i = 0; i < 16; i++)
- f[i] = (GLfloat) m[i];
- _mesa_MultMatrixf( f );
-}
-
-
-void GLAPIENTRY
-_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z )
-{
- _mesa_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
-}
-
-
-void GLAPIENTRY
-_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z )
-{
- _mesa_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
-}
-
-
-void GLAPIENTRY
-_mesa_Translated( GLdouble x, GLdouble y, GLdouble z )
-{
- _mesa_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
-}
-#endif
-
-
-#if _HAVE_FULL_GL
-void GLAPIENTRY
-_mesa_LoadTransposeMatrixfARB( const GLfloat *m )
-{
- GLfloat tm[16];
- if (!m) return;
- _math_transposef(tm, m);
- _mesa_LoadMatrixf(tm);
-}
-
-
-void GLAPIENTRY
-_mesa_LoadTransposeMatrixdARB( const GLdouble *m )
-{
- GLfloat tm[16];
- if (!m) return;
- _math_transposefd(tm, m);
- _mesa_LoadMatrixf(tm);
-}
-
-
-void GLAPIENTRY
-_mesa_MultTransposeMatrixfARB( const GLfloat *m )
-{
- GLfloat tm[16];
- if (!m) return;
- _math_transposef(tm, m);
- _mesa_MultMatrixf(tm);
-}
-
-
-void GLAPIENTRY
-_mesa_MultTransposeMatrixdARB( const GLdouble *m )
-{
- GLfloat tm[16];
- if (!m) return;
- _math_transposefd(tm, m);
- _mesa_MultMatrixf(tm);
-}
-#endif
-
-
-
-/**********************************************************************/
-/** \name State management */
-/*@{*/
-
-
-/**
- * Update the projection matrix stack.
- *
- * \param ctx GL context.
- *
- * Calls _math_matrix_analyse() with the top-matrix of the projection matrix
- * stack, and recomputes user clip positions if necessary.
- *
- * \note This routine references __struct gl_contextRec::Tranform attribute values to
- * compute userclip positions in clip space, but is only called on
- * _NEW_PROJECTION. The _mesa_ClipPlane() function keeps these values up to
- * date across changes to the __struct gl_contextRec::Transform attributes.
- */
-static void
-update_projection( struct gl_context *ctx )
-{
- _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
-
-#if FEATURE_userclip
- /* Recompute clip plane positions in clipspace. This is also done
- * in _mesa_ClipPlane().
- */
- if (ctx->Transform.ClipPlanesEnabled) {
- GLuint p;
- for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
- _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
- ctx->Transform.EyeUserPlane[p],
- ctx->ProjectionMatrixStack.Top->inv );
- }
- }
- }
-#endif
-}
-
-
-/**
- * Calculate the combined modelview-projection matrix.
- *
- * \param ctx GL context.
- *
- * Multiplies the top matrices of the projection and model view stacks into
- * __struct gl_contextRec::_ModelProjectMatrix via _math_matrix_mul_matrix() and
- * analyzes the resulting matrix via _math_matrix_analyse().
- */
-static void
-calculate_model_project_matrix( struct gl_context *ctx )
-{
- _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
- ctx->ProjectionMatrixStack.Top,
- ctx->ModelviewMatrixStack.Top );
-
- _math_matrix_analyse( &ctx->_ModelProjectMatrix );
-}
-
-
-/**
- * Updates the combined modelview-projection matrix.
- *
- * \param ctx GL context.
- * \param new_state new state bit mask.
- *
- * If there is a new model view matrix then analyzes it. If there is a new
- * projection matrix, updates it. Finally calls
- * calculate_model_project_matrix() to recalculate the modelview-projection
- * matrix.
- */
-void _mesa_update_modelview_project( struct gl_context *ctx, GLuint new_state )
-{
- if (new_state & _NEW_MODELVIEW) {
- _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
-
- /* Bring cull position uptodate.
- */
- TRANSFORM_POINT3( ctx->Transform.CullObjPos,
- ctx->ModelviewMatrixStack.Top->inv,
- ctx->Transform.CullEyePos );
- }
-
-
- if (new_state & _NEW_PROJECTION)
- update_projection( ctx );
-
- /* Keep ModelviewProject uptodate always to allow tnl
- * implementations that go model->clip even when eye is required.
- */
- calculate_model_project_matrix(ctx);
-}
-
-/*@}*/
-
-
-/**********************************************************************/
-/** Matrix stack initialization */
-/*@{*/
-
-
-/**
- * Initialize a matrix stack.
- *
- * \param stack matrix stack.
- * \param maxDepth maximum stack depth.
- * \param dirtyFlag dirty flag.
- *
- * Allocates an array of \p maxDepth elements for the matrix stack and calls
- * _math_matrix_ctr() and _math_matrix_alloc_inv() for each element to
- * initialize it.
- */
-static void
-init_matrix_stack( struct gl_matrix_stack *stack,
- GLuint maxDepth, GLuint dirtyFlag )
-{
- GLuint i;
-
- stack->Depth = 0;
- stack->MaxDepth = maxDepth;
- stack->DirtyFlag = dirtyFlag;
- /* The stack */
- stack->Stack = (GLmatrix *) CALLOC(maxDepth * sizeof(GLmatrix));
- for (i = 0; i < maxDepth; i++) {
- _math_matrix_ctr(&stack->Stack[i]);
- _math_matrix_alloc_inv(&stack->Stack[i]);
- }
- stack->Top = stack->Stack;
-}
-
-/**
- * Free matrix stack.
- *
- * \param stack matrix stack.
- *
- * Calls _math_matrix_dtr() for each element of the matrix stack and
- * frees the array.
- */
-static void
-free_matrix_stack( struct gl_matrix_stack *stack )
-{
- GLuint i;
- for (i = 0; i < stack->MaxDepth; i++) {
- _math_matrix_dtr(&stack->Stack[i]);
- }
- FREE(stack->Stack);
- stack->Stack = stack->Top = NULL;
-}
-
-/*@}*/
-
-
-/**********************************************************************/
-/** \name Initialization */
-/*@{*/
-
-
-/**
- * Initialize the context matrix data.
- *
- * \param ctx GL context.
- *
- * Initializes each of the matrix stacks and the combined modelview-projection
- * matrix.
- */
-void _mesa_init_matrix( struct gl_context * ctx )
-{
- GLint i;
-
- /* Initialize matrix stacks */
- init_matrix_stack(&ctx->ModelviewMatrixStack, MAX_MODELVIEW_STACK_DEPTH,
- _NEW_MODELVIEW);
- init_matrix_stack(&ctx->ProjectionMatrixStack, MAX_PROJECTION_STACK_DEPTH,
- _NEW_PROJECTION);
- for (i = 0; i < Elements(ctx->TextureMatrixStack); i++)
- init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH,
- _NEW_TEXTURE_MATRIX);
- for (i = 0; i < Elements(ctx->ProgramMatrixStack); i++)
- init_matrix_stack(&ctx->ProgramMatrixStack[i],
- MAX_PROGRAM_MATRIX_STACK_DEPTH, _NEW_TRACK_MATRIX);
- ctx->CurrentStack = &ctx->ModelviewMatrixStack;
-
- /* Init combined Modelview*Projection matrix */
- _math_matrix_ctr( &ctx->_ModelProjectMatrix );
-}
-
-
-/**
- * Free the context matrix data.
- *
- * \param ctx GL context.
- *
- * Frees each of the matrix stacks and the combined modelview-projection
- * matrix.
- */
-void _mesa_free_matrix_data( struct gl_context *ctx )
-{
- GLint i;
-
- free_matrix_stack(&ctx->ModelviewMatrixStack);
- free_matrix_stack(&ctx->ProjectionMatrixStack);
- for (i = 0; i < Elements(ctx->TextureMatrixStack); i++)
- free_matrix_stack(&ctx->TextureMatrixStack[i]);
- for (i = 0; i < Elements(ctx->ProgramMatrixStack); i++)
- free_matrix_stack(&ctx->ProgramMatrixStack[i]);
- /* combined Modelview*Projection matrix */
- _math_matrix_dtr( &ctx->_ModelProjectMatrix );
-
-}
-
-
-/**
- * Initialize the context transform attribute group.
- *
- * \param ctx GL context.
- *
- * \todo Move this to a new file with other 'transform' routines.
- */
-void _mesa_init_transform( struct gl_context *ctx )
-{
- GLint i;
-
- /* Transformation group */
- ctx->Transform.MatrixMode = GL_MODELVIEW;
- ctx->Transform.Normalize = GL_FALSE;
- ctx->Transform.RescaleNormals = GL_FALSE;
- ctx->Transform.RasterPositionUnclipped = GL_FALSE;
- for (i=0;i<MAX_CLIP_PLANES;i++) {
- ASSIGN_4V( ctx->Transform.EyeUserPlane[i], 0.0, 0.0, 0.0, 0.0 );
- }
- ctx->Transform.ClipPlanesEnabled = 0;
-
- ASSIGN_4V( ctx->Transform.CullObjPos, 0.0, 0.0, 1.0, 0.0 );
- ASSIGN_4V( ctx->Transform.CullEyePos, 0.0, 0.0, 1.0, 0.0 );
-}
-
-
-/*@}*/
diff --git a/src/mesa/main/matrix.h b/src/mesa/main/matrix.h
deleted file mode 100644
index 2878cc1..0000000
--- a/src/mesa/main/matrix.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-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.
- */
-
-
-#ifndef MATRIX_H
-#define MATRIX_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-extern void GLAPIENTRY
-_mesa_Frustum( GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top,
- GLdouble nearval, GLdouble farval );
-
-extern void GLAPIENTRY
-_mesa_Ortho( GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top,
- GLdouble nearval, GLdouble farval );
-
-extern void GLAPIENTRY
-_mesa_PushMatrix( void );
-
-extern void GLAPIENTRY
-_mesa_PopMatrix( void );
-
-extern void GLAPIENTRY
-_mesa_LoadIdentity( void );
-
-extern void GLAPIENTRY
-_mesa_LoadMatrixf( const GLfloat *m );
-
-extern void GLAPIENTRY
-_mesa_LoadMatrixd( const GLdouble *m );
-
-extern void GLAPIENTRY
-_mesa_MatrixMode( GLenum mode );
-
-extern void GLAPIENTRY
-_mesa_MultMatrixf( const GLfloat *m );
-
-extern void GLAPIENTRY
-_mesa_MultMatrixd( const GLdouble *m );
-
-extern void GLAPIENTRY
-_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
-
-extern void GLAPIENTRY
-_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z );
-
-extern void GLAPIENTRY
-_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z );
-
-extern void GLAPIENTRY
-_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z );
-
-extern void GLAPIENTRY
-_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z );
-
-extern void GLAPIENTRY
-_mesa_Translated( GLdouble x, GLdouble y, GLdouble z );
-
-extern void GLAPIENTRY
-_mesa_LoadTransposeMatrixfARB( const GLfloat *m );
-
-extern void GLAPIENTRY
-_mesa_LoadTransposeMatrixdARB( const GLdouble *m );
-
-extern void GLAPIENTRY
-_mesa_MultTransposeMatrixfARB( const GLfloat *m );
-
-extern void GLAPIENTRY
-_mesa_MultTransposeMatrixdARB( const GLdouble *m );
-
-
-extern void
-_mesa_init_matrix( struct gl_context * ctx );
-
-extern void
-_mesa_init_transform( struct gl_context *ctx );
-
-extern void
-_mesa_free_matrix_data( struct gl_context *ctx );
-
-extern void
-_mesa_update_modelview_project( struct gl_context *ctx, GLuint newstate );
-
-
-#endif
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
deleted file mode 100644
index ad63b17..0000000
--- a/src/mesa/main/mipmap.c
+++ /dev/null
@@ -1,1966 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-/**
- * \file mipmap.c mipmap generation and teximage resizing functions.
- */
-
-#include "imports.h"
-#include "formats.h"
-#include "mipmap.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "image.h"
-
-
-
-static GLint
-bytes_per_pixel(GLenum datatype, GLuint comps)
-{
- GLint b = _mesa_sizeof_packed_type(datatype);
- assert(b >= 0);
-
- if (_mesa_type_is_packed(datatype))
- return b;
- else
- return b * comps;
-}
-
-
-/**
- * \name Support macros for do_row and do_row_3d
- *
- * The macro madness is here for two reasons. First, it compacts the code
- * slightly. Second, it makes it much easier to adjust the specifics of the
- * filter to tune the rounding characteristics.
- */
-/*@{*/
-#define DECLARE_ROW_POINTERS(t, e) \
- const t(*rowA)[e] = (const t(*)[e]) srcRowA; \
- const t(*rowB)[e] = (const t(*)[e]) srcRowB; \
- const t(*rowC)[e] = (const t(*)[e]) srcRowC; \
- const t(*rowD)[e] = (const t(*)[e]) srcRowD; \
- t(*dst)[e] = (t(*)[e]) dstRow
-
-#define DECLARE_ROW_POINTERS0(t) \
- const t *rowA = (const t *) srcRowA; \
- const t *rowB = (const t *) srcRowB; \
- const t *rowC = (const t *) srcRowC; \
- const t *rowD = (const t *) srcRowD; \
- t *dst = (t *) dstRow
-
-#define FILTER_SUM_3D(Aj, Ak, Bj, Bk, Cj, Ck, Dj, Dk) \
- ((unsigned) Aj + (unsigned) Ak \
- + (unsigned) Bj + (unsigned) Bk \
- + (unsigned) Cj + (unsigned) Ck \
- + (unsigned) Dj + (unsigned) Dk \
- + 4) >> 3
-
-#define FILTER_3D(e) \
- do { \
- dst[i][e] = FILTER_SUM_3D(rowA[j][e], rowA[k][e], \
- rowB[j][e], rowB[k][e], \
- rowC[j][e], rowC[k][e], \
- rowD[j][e], rowD[k][e]); \
- } while(0)
-
-#define FILTER_SUM_3D_SIGNED(Aj, Ak, Bj, Bk, Cj, Ck, Dj, Dk) \
- (Aj + Ak \
- + Bj + Bk \
- + Cj + Ck \
- + Dj + Dk \
- + 4) / 8
-
-#define FILTER_3D_SIGNED(e) \
- do { \
- dst[i][e] = FILTER_SUM_3D_SIGNED(rowA[j][e], rowA[k][e], \
- rowB[j][e], rowB[k][e], \
- rowC[j][e], rowC[k][e], \
- rowD[j][e], rowD[k][e]); \
- } while(0)
-
-#define FILTER_F_3D(e) \
- do { \
- dst[i][e] = (rowA[j][e] + rowA[k][e] \
- + rowB[j][e] + rowB[k][e] \
- + rowC[j][e] + rowC[k][e] \
- + rowD[j][e] + rowD[k][e]) * 0.125F; \
- } while(0)
-
-#define FILTER_HF_3D(e) \
- do { \
- const GLfloat aj = _mesa_half_to_float(rowA[j][e]); \
- const GLfloat ak = _mesa_half_to_float(rowA[k][e]); \
- const GLfloat bj = _mesa_half_to_float(rowB[j][e]); \
- const GLfloat bk = _mesa_half_to_float(rowB[k][e]); \
- const GLfloat cj = _mesa_half_to_float(rowC[j][e]); \
- const GLfloat ck = _mesa_half_to_float(rowC[k][e]); \
- const GLfloat dj = _mesa_half_to_float(rowD[j][e]); \
- const GLfloat dk = _mesa_half_to_float(rowD[k][e]); \
- dst[i][e] = _mesa_float_to_half((aj + ak + bj + bk + cj + ck + dj + dk) \
- * 0.125F); \
- } while(0)
-/*@}*/
-
-
-/**
- * Average together two rows of a source image to produce a single new
- * row in the dest image. It's legal for the two source rows to point
- * to the same data. The source width must be equal to either the
- * dest width or two times the dest width.
- * \param datatype GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, GL_FLOAT, etc.
- * \param comps number of components per pixel (1..4)
- */
-static void
-do_row(GLenum datatype, GLuint comps, GLint srcWidth,
- const GLvoid *srcRowA, const GLvoid *srcRowB,
- GLint dstWidth, GLvoid *dstRow)
-{
- const GLuint k0 = (srcWidth == dstWidth) ? 0 : 1;
- const GLuint colStride = (srcWidth == dstWidth) ? 1 : 2;
-
- ASSERT(comps >= 1);
- ASSERT(comps <= 4);
-
- /* This assertion is no longer valid with non-power-of-2 textures
- assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth);
- */
-
- if (datatype == GL_UNSIGNED_BYTE && comps == 4) {
- GLuint i, j, k;
- const GLubyte(*rowA)[4] = (const GLubyte(*)[4]) srcRowA;
- const GLubyte(*rowB)[4] = (const GLubyte(*)[4]) srcRowB;
- GLubyte(*dst)[4] = (GLubyte(*)[4]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
- }
- }
- else if (datatype == GL_UNSIGNED_BYTE && comps == 3) {
- GLuint i, j, k;
- const GLubyte(*rowA)[3] = (const GLubyte(*)[3]) srcRowA;
- const GLubyte(*rowB)[3] = (const GLubyte(*)[3]) srcRowB;
- GLubyte(*dst)[3] = (GLubyte(*)[3]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- }
- }
- else if (datatype == GL_UNSIGNED_BYTE && comps == 2) {
- GLuint i, j, k;
- const GLubyte(*rowA)[2] = (const GLubyte(*)[2]) srcRowA;
- const GLubyte(*rowB)[2] = (const GLubyte(*)[2]) srcRowB;
- GLubyte(*dst)[2] = (GLubyte(*)[2]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) >> 2;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2;
- }
- }
- else if (datatype == GL_UNSIGNED_BYTE && comps == 1) {
- GLuint i, j, k;
- const GLubyte *rowA = (const GLubyte *) srcRowA;
- const GLubyte *rowB = (const GLubyte *) srcRowB;
- GLubyte *dst = (GLubyte *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2;
- }
- }
-
- else if (datatype == GL_BYTE && comps == 4) {
- GLuint i, j, k;
- const GLbyte(*rowA)[4] = (const GLbyte(*)[4]) srcRowA;
- const GLbyte(*rowB)[4] = (const GLbyte(*)[4]) srcRowB;
- GLbyte(*dst)[4] = (GLbyte(*)[4]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
- }
- }
- else if (datatype == GL_BYTE && comps == 3) {
- GLuint i, j, k;
- const GLbyte(*rowA)[3] = (const GLbyte(*)[3]) srcRowA;
- const GLbyte(*rowB)[3] = (const GLbyte(*)[3]) srcRowB;
- GLbyte(*dst)[3] = (GLbyte(*)[3]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- }
- }
- else if (datatype == GL_BYTE && comps == 2) {
- GLuint i, j, k;
- const GLbyte(*rowA)[2] = (const GLbyte(*)[2]) srcRowA;
- const GLbyte(*rowB)[2] = (const GLbyte(*)[2]) srcRowB;
- GLbyte(*dst)[2] = (GLbyte(*)[2]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- }
- }
- else if (datatype == GL_BYTE && comps == 1) {
- GLuint i, j, k;
- const GLbyte *rowA = (const GLbyte *) srcRowA;
- const GLbyte *rowB = (const GLbyte *) srcRowB;
- GLbyte *dst = (GLbyte *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
- }
- }
-
- else if (datatype == GL_UNSIGNED_SHORT && comps == 4) {
- GLuint i, j, k;
- const GLushort(*rowA)[4] = (const GLushort(*)[4]) srcRowA;
- const GLushort(*rowB)[4] = (const GLushort(*)[4]) srcRowB;
- GLushort(*dst)[4] = (GLushort(*)[4]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
- }
- }
- else if (datatype == GL_UNSIGNED_SHORT && comps == 3) {
- GLuint i, j, k;
- const GLushort(*rowA)[3] = (const GLushort(*)[3]) srcRowA;
- const GLushort(*rowB)[3] = (const GLushort(*)[3]) srcRowB;
- GLushort(*dst)[3] = (GLushort(*)[3]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- }
- }
- else if (datatype == GL_UNSIGNED_SHORT && comps == 2) {
- GLuint i, j, k;
- const GLushort(*rowA)[2] = (const GLushort(*)[2]) srcRowA;
- const GLushort(*rowB)[2] = (const GLushort(*)[2]) srcRowB;
- GLushort(*dst)[2] = (GLushort(*)[2]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- }
- }
- else if (datatype == GL_UNSIGNED_SHORT && comps == 1) {
- GLuint i, j, k;
- const GLushort *rowA = (const GLushort *) srcRowA;
- const GLushort *rowB = (const GLushort *) srcRowB;
- GLushort *dst = (GLushort *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
- }
- }
-
- else if (datatype == GL_SHORT && comps == 4) {
- GLuint i, j, k;
- const GLshort(*rowA)[4] = (const GLshort(*)[4]) srcRowA;
- const GLshort(*rowB)[4] = (const GLshort(*)[4]) srcRowB;
- GLshort(*dst)[4] = (GLshort(*)[4]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
- }
- }
- else if (datatype == GL_SHORT && comps == 3) {
- GLuint i, j, k;
- const GLshort(*rowA)[3] = (const GLshort(*)[3]) srcRowA;
- const GLshort(*rowB)[3] = (const GLshort(*)[3]) srcRowB;
- GLshort(*dst)[3] = (GLshort(*)[3]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- }
- }
- else if (datatype == GL_SHORT && comps == 2) {
- GLuint i, j, k;
- const GLshort(*rowA)[2] = (const GLshort(*)[2]) srcRowA;
- const GLshort(*rowB)[2] = (const GLshort(*)[2]) srcRowB;
- GLshort(*dst)[2] = (GLshort(*)[2]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- }
- }
- else if (datatype == GL_SHORT && comps == 1) {
- GLuint i, j, k;
- const GLshort *rowA = (const GLshort *) srcRowA;
- const GLshort *rowB = (const GLshort *) srcRowB;
- GLshort *dst = (GLshort *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
- }
- }
-
- else if (datatype == GL_FLOAT && comps == 4) {
- GLuint i, j, k;
- const GLfloat(*rowA)[4] = (const GLfloat(*)[4]) srcRowA;
- const GLfloat(*rowB)[4] = (const GLfloat(*)[4]) srcRowB;
- GLfloat(*dst)[4] = (GLfloat(*)[4]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] +
- rowB[j][0] + rowB[k][0]) * 0.25F;
- dst[i][1] = (rowA[j][1] + rowA[k][1] +
- rowB[j][1] + rowB[k][1]) * 0.25F;
- dst[i][2] = (rowA[j][2] + rowA[k][2] +
- rowB[j][2] + rowB[k][2]) * 0.25F;
- dst[i][3] = (rowA[j][3] + rowA[k][3] +
- rowB[j][3] + rowB[k][3]) * 0.25F;
- }
- }
- else if (datatype == GL_FLOAT && comps == 3) {
- GLuint i, j, k;
- const GLfloat(*rowA)[3] = (const GLfloat(*)[3]) srcRowA;
- const GLfloat(*rowB)[3] = (const GLfloat(*)[3]) srcRowB;
- GLfloat(*dst)[3] = (GLfloat(*)[3]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] +
- rowB[j][0] + rowB[k][0]) * 0.25F;
- dst[i][1] = (rowA[j][1] + rowA[k][1] +
- rowB[j][1] + rowB[k][1]) * 0.25F;
- dst[i][2] = (rowA[j][2] + rowA[k][2] +
- rowB[j][2] + rowB[k][2]) * 0.25F;
- }
- }
- else if (datatype == GL_FLOAT && comps == 2) {
- GLuint i, j, k;
- const GLfloat(*rowA)[2] = (const GLfloat(*)[2]) srcRowA;
- const GLfloat(*rowB)[2] = (const GLfloat(*)[2]) srcRowB;
- GLfloat(*dst)[2] = (GLfloat(*)[2]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] +
- rowB[j][0] + rowB[k][0]) * 0.25F;
- dst[i][1] = (rowA[j][1] + rowA[k][1] +
- rowB[j][1] + rowB[k][1]) * 0.25F;
- }
- }
- else if (datatype == GL_FLOAT && comps == 1) {
- GLuint i, j, k;
- const GLfloat *rowA = (const GLfloat *) srcRowA;
- const GLfloat *rowB = (const GLfloat *) srcRowB;
- GLfloat *dst = (GLfloat *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F;
- }
- }
-
- else if (datatype == GL_HALF_FLOAT_ARB && comps == 4) {
- GLuint i, j, k, comp;
- const GLhalfARB(*rowA)[4] = (const GLhalfARB(*)[4]) srcRowA;
- const GLhalfARB(*rowB)[4] = (const GLhalfARB(*)[4]) srcRowB;
- GLhalfARB(*dst)[4] = (GLhalfARB(*)[4]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- for (comp = 0; comp < 4; comp++) {
- GLfloat aj, ak, bj, bk;
- aj = _mesa_half_to_float(rowA[j][comp]);
- ak = _mesa_half_to_float(rowA[k][comp]);
- bj = _mesa_half_to_float(rowB[j][comp]);
- bk = _mesa_half_to_float(rowB[k][comp]);
- dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F);
- }
- }
- }
- else if (datatype == GL_HALF_FLOAT_ARB && comps == 3) {
- GLuint i, j, k, comp;
- const GLhalfARB(*rowA)[3] = (const GLhalfARB(*)[3]) srcRowA;
- const GLhalfARB(*rowB)[3] = (const GLhalfARB(*)[3]) srcRowB;
- GLhalfARB(*dst)[3] = (GLhalfARB(*)[3]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- for (comp = 0; comp < 3; comp++) {
- GLfloat aj, ak, bj, bk;
- aj = _mesa_half_to_float(rowA[j][comp]);
- ak = _mesa_half_to_float(rowA[k][comp]);
- bj = _mesa_half_to_float(rowB[j][comp]);
- bk = _mesa_half_to_float(rowB[k][comp]);
- dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F);
- }
- }
- }
- else if (datatype == GL_HALF_FLOAT_ARB && comps == 2) {
- GLuint i, j, k, comp;
- const GLhalfARB(*rowA)[2] = (const GLhalfARB(*)[2]) srcRowA;
- const GLhalfARB(*rowB)[2] = (const GLhalfARB(*)[2]) srcRowB;
- GLhalfARB(*dst)[2] = (GLhalfARB(*)[2]) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- for (comp = 0; comp < 2; comp++) {
- GLfloat aj, ak, bj, bk;
- aj = _mesa_half_to_float(rowA[j][comp]);
- ak = _mesa_half_to_float(rowA[k][comp]);
- bj = _mesa_half_to_float(rowB[j][comp]);
- bk = _mesa_half_to_float(rowB[k][comp]);
- dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F);
- }
- }
- }
- else if (datatype == GL_HALF_FLOAT_ARB && comps == 1) {
- GLuint i, j, k;
- const GLhalfARB *rowA = (const GLhalfARB *) srcRowA;
- const GLhalfARB *rowB = (const GLhalfARB *) srcRowB;
- GLhalfARB *dst = (GLhalfARB *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- GLfloat aj, ak, bj, bk;
- aj = _mesa_half_to_float(rowA[j]);
- ak = _mesa_half_to_float(rowA[k]);
- bj = _mesa_half_to_float(rowB[j]);
- bk = _mesa_half_to_float(rowB[k]);
- dst[i] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F);
- }
- }
-
- else if (datatype == GL_UNSIGNED_INT && comps == 1) {
- GLuint i, j, k;
- const GLuint *rowA = (const GLuint *) srcRowA;
- const GLuint *rowB = (const GLuint *) srcRowB;
- 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);
- }
- }
-
- else if (datatype == GL_UNSIGNED_SHORT_5_6_5 && comps == 3) {
- GLuint i, j, k;
- const GLushort *rowA = (const GLushort *) srcRowA;
- const GLushort *rowB = (const GLushort *) srcRowB;
- GLushort *dst = (GLushort *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const GLint rowAr0 = rowA[j] & 0x1f;
- const GLint rowAr1 = rowA[k] & 0x1f;
- const GLint rowBr0 = rowB[j] & 0x1f;
- const GLint rowBr1 = rowB[k] & 0x1f;
- const GLint rowAg0 = (rowA[j] >> 5) & 0x3f;
- const GLint rowAg1 = (rowA[k] >> 5) & 0x3f;
- const GLint rowBg0 = (rowB[j] >> 5) & 0x3f;
- const GLint rowBg1 = (rowB[k] >> 5) & 0x3f;
- const GLint rowAb0 = (rowA[j] >> 11) & 0x1f;
- const GLint rowAb1 = (rowA[k] >> 11) & 0x1f;
- const GLint rowBb0 = (rowB[j] >> 11) & 0x1f;
- const GLint rowBb1 = (rowB[k] >> 11) & 0x1f;
- const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
- const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
- const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
- dst[i] = (blue << 11) | (green << 5) | red;
- }
- }
- else if (datatype == GL_UNSIGNED_SHORT_4_4_4_4 && comps == 4) {
- GLuint i, j, k;
- const GLushort *rowA = (const GLushort *) srcRowA;
- const GLushort *rowB = (const GLushort *) srcRowB;
- GLushort *dst = (GLushort *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const GLint rowAr0 = rowA[j] & 0xf;
- const GLint rowAr1 = rowA[k] & 0xf;
- const GLint rowBr0 = rowB[j] & 0xf;
- const GLint rowBr1 = rowB[k] & 0xf;
- const GLint rowAg0 = (rowA[j] >> 4) & 0xf;
- const GLint rowAg1 = (rowA[k] >> 4) & 0xf;
- const GLint rowBg0 = (rowB[j] >> 4) & 0xf;
- const GLint rowBg1 = (rowB[k] >> 4) & 0xf;
- const GLint rowAb0 = (rowA[j] >> 8) & 0xf;
- const GLint rowAb1 = (rowA[k] >> 8) & 0xf;
- const GLint rowBb0 = (rowB[j] >> 8) & 0xf;
- const GLint rowBb1 = (rowB[k] >> 8) & 0xf;
- const GLint rowAa0 = (rowA[j] >> 12) & 0xf;
- const GLint rowAa1 = (rowA[k] >> 12) & 0xf;
- const GLint rowBa0 = (rowB[j] >> 12) & 0xf;
- const GLint rowBa1 = (rowB[k] >> 12) & 0xf;
- const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
- const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
- const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
- const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
- dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red;
- }
- }
- else if (datatype == GL_UNSIGNED_SHORT_1_5_5_5_REV && comps == 4) {
- GLuint i, j, k;
- const GLushort *rowA = (const GLushort *) srcRowA;
- const GLushort *rowB = (const GLushort *) srcRowB;
- GLushort *dst = (GLushort *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const GLint rowAr0 = rowA[j] & 0x1f;
- const GLint rowAr1 = rowA[k] & 0x1f;
- const GLint rowBr0 = rowB[j] & 0x1f;
- const GLint rowBr1 = rowB[k] & 0x1f;
- const GLint rowAg0 = (rowA[j] >> 5) & 0x1f;
- const GLint rowAg1 = (rowA[k] >> 5) & 0x1f;
- const GLint rowBg0 = (rowB[j] >> 5) & 0x1f;
- const GLint rowBg1 = (rowB[k] >> 5) & 0x1f;
- const GLint rowAb0 = (rowA[j] >> 10) & 0x1f;
- const GLint rowAb1 = (rowA[k] >> 10) & 0x1f;
- const GLint rowBb0 = (rowB[j] >> 10) & 0x1f;
- const GLint rowBb1 = (rowB[k] >> 10) & 0x1f;
- const GLint rowAa0 = (rowA[j] >> 15) & 0x1;
- const GLint rowAa1 = (rowA[k] >> 15) & 0x1;
- const GLint rowBa0 = (rowB[j] >> 15) & 0x1;
- const GLint rowBa1 = (rowB[k] >> 15) & 0x1;
- const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
- const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
- const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
- const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
- dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red;
- }
- }
- else if (datatype == GL_UNSIGNED_SHORT_5_5_5_1 && comps == 4) {
- GLuint i, j, k;
- const GLushort *rowA = (const GLushort *) srcRowA;
- const GLushort *rowB = (const GLushort *) srcRowB;
- GLushort *dst = (GLushort *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const GLint rowAr0 = (rowA[j] >> 11) & 0x1f;
- const GLint rowAr1 = (rowA[k] >> 11) & 0x1f;
- const GLint rowBr0 = (rowB[j] >> 11) & 0x1f;
- const GLint rowBr1 = (rowB[k] >> 11) & 0x1f;
- const GLint rowAg0 = (rowA[j] >> 6) & 0x1f;
- const GLint rowAg1 = (rowA[k] >> 6) & 0x1f;
- const GLint rowBg0 = (rowB[j] >> 6) & 0x1f;
- const GLint rowBg1 = (rowB[k] >> 6) & 0x1f;
- const GLint rowAb0 = (rowA[j] >> 1) & 0x1f;
- const GLint rowAb1 = (rowA[k] >> 1) & 0x1f;
- const GLint rowBb0 = (rowB[j] >> 1) & 0x1f;
- const GLint rowBb1 = (rowB[k] >> 1) & 0x1f;
- const GLint rowAa0 = (rowA[j] & 0x1);
- const GLint rowAa1 = (rowA[k] & 0x1);
- const GLint rowBa0 = (rowB[j] & 0x1);
- const GLint rowBa1 = (rowB[k] & 0x1);
- const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
- const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
- const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
- const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
- dst[i] = (red << 11) | (green << 6) | (blue << 1) | alpha;
- }
- }
-
- else if (datatype == GL_UNSIGNED_BYTE_3_3_2 && comps == 3) {
- GLuint i, j, k;
- const GLubyte *rowA = (const GLubyte *) srcRowA;
- const GLubyte *rowB = (const GLubyte *) srcRowB;
- GLubyte *dst = (GLubyte *) dstRow;
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const GLint rowAr0 = rowA[j] & 0x3;
- const GLint rowAr1 = rowA[k] & 0x3;
- const GLint rowBr0 = rowB[j] & 0x3;
- const GLint rowBr1 = rowB[k] & 0x3;
- const GLint rowAg0 = (rowA[j] >> 2) & 0x7;
- const GLint rowAg1 = (rowA[k] >> 2) & 0x7;
- const GLint rowBg0 = (rowB[j] >> 2) & 0x7;
- const GLint rowBg1 = (rowB[k] >> 2) & 0x7;
- const GLint rowAb0 = (rowA[j] >> 5) & 0x7;
- const GLint rowAb1 = (rowA[k] >> 5) & 0x7;
- const GLint rowBb0 = (rowB[j] >> 5) & 0x7;
- const GLint rowBb1 = (rowB[k] >> 5) & 0x7;
- const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
- const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
- const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
- dst[i] = (blue << 5) | (green << 2) | red;
- }
- }
- else {
- _mesa_problem(NULL, "bad format in do_row()");
- }
-}
-
-
-/**
- * Average together four rows of a source image to produce a single new
- * row in the dest image. It's legal for the two source rows to point
- * to the same data. The source width must be equal to either the
- * dest width or two times the dest width.
- *
- * \param datatype GL pixel type \c GL_UNSIGNED_BYTE, \c GL_UNSIGNED_SHORT,
- * \c GL_FLOAT, etc.
- * \param comps number of components per pixel (1..4)
- * \param srcWidth Width of a row in the source data
- * \param srcRowA Pointer to one of the rows of source data
- * \param srcRowB Pointer to one of the rows of source data
- * \param srcRowC Pointer to one of the rows of source data
- * \param srcRowD Pointer to one of the rows of source data
- * \param dstWidth Width of a row in the destination data
- * \param srcRowA Pointer to the row of destination data
- */
-static void
-do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
- const GLvoid *srcRowA, const GLvoid *srcRowB,
- const GLvoid *srcRowC, const GLvoid *srcRowD,
- GLint dstWidth, GLvoid *dstRow)
-{
- const GLuint k0 = (srcWidth == dstWidth) ? 0 : 1;
- const GLuint colStride = (srcWidth == dstWidth) ? 1 : 2;
- GLuint i, j, k;
-
- ASSERT(comps >= 1);
- ASSERT(comps <= 4);
-
- if ((datatype == GL_UNSIGNED_BYTE) && (comps == 4)) {
- DECLARE_ROW_POINTERS(GLubyte, 4);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- FILTER_3D(2);
- FILTER_3D(3);
- }
- }
- else if ((datatype == GL_UNSIGNED_BYTE) && (comps == 3)) {
- DECLARE_ROW_POINTERS(GLubyte, 3);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- FILTER_3D(2);
- }
- }
- else if ((datatype == GL_UNSIGNED_BYTE) && (comps == 2)) {
- DECLARE_ROW_POINTERS(GLubyte, 2);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- }
- }
- else if ((datatype == GL_UNSIGNED_BYTE) && (comps == 1)) {
- DECLARE_ROW_POINTERS(GLubyte, 1);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- }
- }
- else if ((datatype == GL_BYTE) && (comps == 4)) {
- DECLARE_ROW_POINTERS(GLbyte, 4);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D_SIGNED(0);
- FILTER_3D_SIGNED(1);
- FILTER_3D_SIGNED(2);
- FILTER_3D_SIGNED(3);
- }
- }
- else if ((datatype == GL_BYTE) && (comps == 3)) {
- DECLARE_ROW_POINTERS(GLbyte, 3);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D_SIGNED(0);
- FILTER_3D_SIGNED(1);
- FILTER_3D_SIGNED(2);
- }
- }
- else if ((datatype == GL_BYTE) && (comps == 2)) {
- DECLARE_ROW_POINTERS(GLbyte, 2);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D_SIGNED(0);
- FILTER_3D_SIGNED(1);
- }
- }
- else if ((datatype == GL_BYTE) && (comps == 1)) {
- DECLARE_ROW_POINTERS(GLbyte, 1);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D_SIGNED(0);
- }
- }
- else if ((datatype == GL_UNSIGNED_SHORT) && (comps == 4)) {
- DECLARE_ROW_POINTERS(GLushort, 4);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- FILTER_3D(2);
- FILTER_3D(3);
- }
- }
- else if ((datatype == GL_UNSIGNED_SHORT) && (comps == 3)) {
- DECLARE_ROW_POINTERS(GLushort, 3);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- FILTER_3D(2);
- }
- }
- else if ((datatype == GL_UNSIGNED_SHORT) && (comps == 2)) {
- DECLARE_ROW_POINTERS(GLushort, 2);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- }
- }
- else if ((datatype == GL_UNSIGNED_SHORT) && (comps == 1)) {
- DECLARE_ROW_POINTERS(GLushort, 1);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- }
- }
- else if ((datatype == GL_SHORT) && (comps == 4)) {
- DECLARE_ROW_POINTERS(GLshort, 4);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- FILTER_3D(2);
- FILTER_3D(3);
- }
- }
- else if ((datatype == GL_SHORT) && (comps == 3)) {
- DECLARE_ROW_POINTERS(GLshort, 3);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- FILTER_3D(2);
- }
- }
- else if ((datatype == GL_SHORT) && (comps == 2)) {
- DECLARE_ROW_POINTERS(GLshort, 2);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- }
- }
- else if ((datatype == GL_SHORT) && (comps == 1)) {
- DECLARE_ROW_POINTERS(GLshort, 1);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- }
- }
- else if ((datatype == GL_FLOAT) && (comps == 4)) {
- DECLARE_ROW_POINTERS(GLfloat, 4);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_F_3D(0);
- FILTER_F_3D(1);
- FILTER_F_3D(2);
- FILTER_F_3D(3);
- }
- }
- else if ((datatype == GL_FLOAT) && (comps == 3)) {
- DECLARE_ROW_POINTERS(GLfloat, 3);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_F_3D(0);
- FILTER_F_3D(1);
- FILTER_F_3D(2);
- }
- }
- else if ((datatype == GL_FLOAT) && (comps == 2)) {
- DECLARE_ROW_POINTERS(GLfloat, 2);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_F_3D(0);
- FILTER_F_3D(1);
- }
- }
- else if ((datatype == GL_FLOAT) && (comps == 1)) {
- DECLARE_ROW_POINTERS(GLfloat, 1);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_F_3D(0);
- }
- }
- else if ((datatype == GL_HALF_FLOAT_ARB) && (comps == 4)) {
- DECLARE_ROW_POINTERS(GLhalfARB, 4);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_HF_3D(0);
- FILTER_HF_3D(1);
- FILTER_HF_3D(2);
- FILTER_HF_3D(3);
- }
- }
- else if ((datatype == GL_HALF_FLOAT_ARB) && (comps == 3)) {
- DECLARE_ROW_POINTERS(GLhalfARB, 4);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_HF_3D(0);
- FILTER_HF_3D(1);
- FILTER_HF_3D(2);
- }
- }
- else if ((datatype == GL_HALF_FLOAT_ARB) && (comps == 2)) {
- DECLARE_ROW_POINTERS(GLhalfARB, 4);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_HF_3D(0);
- FILTER_HF_3D(1);
- }
- }
- else if ((datatype == GL_HALF_FLOAT_ARB) && (comps == 1)) {
- DECLARE_ROW_POINTERS(GLhalfARB, 4);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_HF_3D(0);
- }
- }
- else if ((datatype == GL_UNSIGNED_INT) && (comps == 1)) {
- const GLuint *rowA = (const GLuint *) srcRowA;
- const GLuint *rowB = (const GLuint *) srcRowB;
- const GLuint *rowC = (const GLuint *) srcRowC;
- const GLuint *rowD = (const GLuint *) srcRowD;
- GLfloat *dst = (GLfloat *) dstRow;
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const uint64_t tmp = (((uint64_t) rowA[j] + (uint64_t) rowA[k])
- + ((uint64_t) rowB[j] + (uint64_t) rowB[k])
- + ((uint64_t) rowC[j] + (uint64_t) rowC[k])
- + ((uint64_t) rowD[j] + (uint64_t) rowD[k]));
- dst[i] = (GLfloat)((double) tmp * 0.125);
- }
- }
- else if ((datatype == GL_UNSIGNED_SHORT_5_6_5) && (comps == 3)) {
- DECLARE_ROW_POINTERS0(GLushort);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const GLint rowAr0 = rowA[j] & 0x1f;
- const GLint rowAr1 = rowA[k] & 0x1f;
- const GLint rowBr0 = rowB[j] & 0x1f;
- const GLint rowBr1 = rowB[k] & 0x1f;
- const GLint rowCr0 = rowC[j] & 0x1f;
- const GLint rowCr1 = rowC[k] & 0x1f;
- const GLint rowDr0 = rowD[j] & 0x1f;
- const GLint rowDr1 = rowD[k] & 0x1f;
- const GLint rowAg0 = (rowA[j] >> 5) & 0x3f;
- const GLint rowAg1 = (rowA[k] >> 5) & 0x3f;
- const GLint rowBg0 = (rowB[j] >> 5) & 0x3f;
- const GLint rowBg1 = (rowB[k] >> 5) & 0x3f;
- const GLint rowCg0 = (rowC[j] >> 5) & 0x3f;
- const GLint rowCg1 = (rowC[k] >> 5) & 0x3f;
- const GLint rowDg0 = (rowD[j] >> 5) & 0x3f;
- const GLint rowDg1 = (rowD[k] >> 5) & 0x3f;
- const GLint rowAb0 = (rowA[j] >> 11) & 0x1f;
- const GLint rowAb1 = (rowA[k] >> 11) & 0x1f;
- const GLint rowBb0 = (rowB[j] >> 11) & 0x1f;
- const GLint rowBb1 = (rowB[k] >> 11) & 0x1f;
- const GLint rowCb0 = (rowC[j] >> 11) & 0x1f;
- const GLint rowCb1 = (rowC[k] >> 11) & 0x1f;
- const GLint rowDb0 = (rowD[j] >> 11) & 0x1f;
- const GLint rowDb1 = (rowD[k] >> 11) & 0x1f;
- const GLint r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
- rowCr0, rowCr1, rowDr0, rowDr1);
- const GLint g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
- rowCg0, rowCg1, rowDg0, rowDg1);
- const GLint b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
- rowCb0, rowCb1, rowDb0, rowDb1);
- dst[i] = (b << 11) | (g << 5) | r;
- }
- }
- else if ((datatype == GL_UNSIGNED_SHORT_4_4_4_4) && (comps == 4)) {
- DECLARE_ROW_POINTERS0(GLushort);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const GLint rowAr0 = rowA[j] & 0xf;
- const GLint rowAr1 = rowA[k] & 0xf;
- const GLint rowBr0 = rowB[j] & 0xf;
- const GLint rowBr1 = rowB[k] & 0xf;
- const GLint rowCr0 = rowC[j] & 0xf;
- const GLint rowCr1 = rowC[k] & 0xf;
- const GLint rowDr0 = rowD[j] & 0xf;
- const GLint rowDr1 = rowD[k] & 0xf;
- const GLint rowAg0 = (rowA[j] >> 4) & 0xf;
- const GLint rowAg1 = (rowA[k] >> 4) & 0xf;
- const GLint rowBg0 = (rowB[j] >> 4) & 0xf;
- const GLint rowBg1 = (rowB[k] >> 4) & 0xf;
- const GLint rowCg0 = (rowC[j] >> 4) & 0xf;
- const GLint rowCg1 = (rowC[k] >> 4) & 0xf;
- const GLint rowDg0 = (rowD[j] >> 4) & 0xf;
- const GLint rowDg1 = (rowD[k] >> 4) & 0xf;
- const GLint rowAb0 = (rowA[j] >> 8) & 0xf;
- const GLint rowAb1 = (rowA[k] >> 8) & 0xf;
- const GLint rowBb0 = (rowB[j] >> 8) & 0xf;
- const GLint rowBb1 = (rowB[k] >> 8) & 0xf;
- const GLint rowCb0 = (rowC[j] >> 8) & 0xf;
- const GLint rowCb1 = (rowC[k] >> 8) & 0xf;
- const GLint rowDb0 = (rowD[j] >> 8) & 0xf;
- const GLint rowDb1 = (rowD[k] >> 8) & 0xf;
- const GLint rowAa0 = (rowA[j] >> 12) & 0xf;
- const GLint rowAa1 = (rowA[k] >> 12) & 0xf;
- const GLint rowBa0 = (rowB[j] >> 12) & 0xf;
- const GLint rowBa1 = (rowB[k] >> 12) & 0xf;
- const GLint rowCa0 = (rowC[j] >> 12) & 0xf;
- const GLint rowCa1 = (rowC[k] >> 12) & 0xf;
- const GLint rowDa0 = (rowD[j] >> 12) & 0xf;
- const GLint rowDa1 = (rowD[k] >> 12) & 0xf;
- const GLint r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
- rowCr0, rowCr1, rowDr0, rowDr1);
- const GLint g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
- rowCg0, rowCg1, rowDg0, rowDg1);
- const GLint b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
- rowCb0, rowCb1, rowDb0, rowDb1);
- const GLint a = FILTER_SUM_3D(rowAa0, rowAa1, rowBa0, rowBa1,
- rowCa0, rowCa1, rowDa0, rowDa1);
-
- dst[i] = (a << 12) | (b << 8) | (g << 4) | r;
- }
- }
- else if ((datatype == GL_UNSIGNED_SHORT_1_5_5_5_REV) && (comps == 4)) {
- DECLARE_ROW_POINTERS0(GLushort);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const GLint rowAr0 = rowA[j] & 0x1f;
- const GLint rowAr1 = rowA[k] & 0x1f;
- const GLint rowBr0 = rowB[j] & 0x1f;
- const GLint rowBr1 = rowB[k] & 0x1f;
- const GLint rowCr0 = rowC[j] & 0x1f;
- const GLint rowCr1 = rowC[k] & 0x1f;
- const GLint rowDr0 = rowD[j] & 0x1f;
- const GLint rowDr1 = rowD[k] & 0x1f;
- const GLint rowAg0 = (rowA[j] >> 5) & 0x1f;
- const GLint rowAg1 = (rowA[k] >> 5) & 0x1f;
- const GLint rowBg0 = (rowB[j] >> 5) & 0x1f;
- const GLint rowBg1 = (rowB[k] >> 5) & 0x1f;
- const GLint rowCg0 = (rowC[j] >> 5) & 0x1f;
- const GLint rowCg1 = (rowC[k] >> 5) & 0x1f;
- const GLint rowDg0 = (rowD[j] >> 5) & 0x1f;
- const GLint rowDg1 = (rowD[k] >> 5) & 0x1f;
- const GLint rowAb0 = (rowA[j] >> 10) & 0x1f;
- const GLint rowAb1 = (rowA[k] >> 10) & 0x1f;
- const GLint rowBb0 = (rowB[j] >> 10) & 0x1f;
- const GLint rowBb1 = (rowB[k] >> 10) & 0x1f;
- const GLint rowCb0 = (rowC[j] >> 10) & 0x1f;
- const GLint rowCb1 = (rowC[k] >> 10) & 0x1f;
- const GLint rowDb0 = (rowD[j] >> 10) & 0x1f;
- const GLint rowDb1 = (rowD[k] >> 10) & 0x1f;
- const GLint rowAa0 = (rowA[j] >> 15) & 0x1;
- const GLint rowAa1 = (rowA[k] >> 15) & 0x1;
- const GLint rowBa0 = (rowB[j] >> 15) & 0x1;
- const GLint rowBa1 = (rowB[k] >> 15) & 0x1;
- const GLint rowCa0 = (rowC[j] >> 15) & 0x1;
- const GLint rowCa1 = (rowC[k] >> 15) & 0x1;
- const GLint rowDa0 = (rowD[j] >> 15) & 0x1;
- const GLint rowDa1 = (rowD[k] >> 15) & 0x1;
- const GLint r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
- rowCr0, rowCr1, rowDr0, rowDr1);
- const GLint g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
- rowCg0, rowCg1, rowDg0, rowDg1);
- const GLint b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
- rowCb0, rowCb1, rowDb0, rowDb1);
- const GLint a = FILTER_SUM_3D(rowAa0, rowAa1, rowBa0, rowBa1,
- rowCa0, rowCa1, rowDa0, rowDa1);
-
- dst[i] = (a << 15) | (b << 10) | (g << 5) | r;
- }
- }
- else if ((datatype == GL_UNSIGNED_SHORT_5_5_5_1) && (comps == 4)) {
- DECLARE_ROW_POINTERS0(GLushort);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const GLint rowAr0 = (rowA[j] >> 11) & 0x1f;
- const GLint rowAr1 = (rowA[k] >> 11) & 0x1f;
- const GLint rowBr0 = (rowB[j] >> 11) & 0x1f;
- const GLint rowBr1 = (rowB[k] >> 11) & 0x1f;
- const GLint rowCr0 = (rowC[j] >> 11) & 0x1f;
- const GLint rowCr1 = (rowC[k] >> 11) & 0x1f;
- const GLint rowDr0 = (rowD[j] >> 11) & 0x1f;
- const GLint rowDr1 = (rowD[k] >> 11) & 0x1f;
- const GLint rowAg0 = (rowA[j] >> 6) & 0x1f;
- const GLint rowAg1 = (rowA[k] >> 6) & 0x1f;
- const GLint rowBg0 = (rowB[j] >> 6) & 0x1f;
- const GLint rowBg1 = (rowB[k] >> 6) & 0x1f;
- const GLint rowCg0 = (rowC[j] >> 6) & 0x1f;
- const GLint rowCg1 = (rowC[k] >> 6) & 0x1f;
- const GLint rowDg0 = (rowD[j] >> 6) & 0x1f;
- const GLint rowDg1 = (rowD[k] >> 6) & 0x1f;
- const GLint rowAb0 = (rowA[j] >> 1) & 0x1f;
- const GLint rowAb1 = (rowA[k] >> 1) & 0x1f;
- const GLint rowBb0 = (rowB[j] >> 1) & 0x1f;
- const GLint rowBb1 = (rowB[k] >> 1) & 0x1f;
- const GLint rowCb0 = (rowC[j] >> 1) & 0x1f;
- const GLint rowCb1 = (rowC[k] >> 1) & 0x1f;
- const GLint rowDb0 = (rowD[j] >> 1) & 0x1f;
- const GLint rowDb1 = (rowD[k] >> 1) & 0x1f;
- const GLint rowAa0 = (rowA[j] & 0x1);
- const GLint rowAa1 = (rowA[k] & 0x1);
- const GLint rowBa0 = (rowB[j] & 0x1);
- const GLint rowBa1 = (rowB[k] & 0x1);
- const GLint rowCa0 = (rowC[j] & 0x1);
- const GLint rowCa1 = (rowC[k] & 0x1);
- const GLint rowDa0 = (rowD[j] & 0x1);
- const GLint rowDa1 = (rowD[k] & 0x1);
- const GLint r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
- rowCr0, rowCr1, rowDr0, rowDr1);
- const GLint g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
- rowCg0, rowCg1, rowDg0, rowDg1);
- const GLint b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
- rowCb0, rowCb1, rowDb0, rowDb1);
- const GLint a = FILTER_SUM_3D(rowAa0, rowAa1, rowBa0, rowBa1,
- rowCa0, rowCa1, rowDa0, rowDa1);
-
- dst[i] = (r << 11) | (g << 6) | (b << 1) | a;
- }
- }
- else if ((datatype == GL_UNSIGNED_BYTE_3_3_2) && (comps == 3)) {
- DECLARE_ROW_POINTERS0(GLushort);
-
- for (i = j = 0, k = k0; i < (GLuint) dstWidth;
- i++, j += colStride, k += colStride) {
- const GLint rowAr0 = rowA[j] & 0x3;
- const GLint rowAr1 = rowA[k] & 0x3;
- const GLint rowBr0 = rowB[j] & 0x3;
- const GLint rowBr1 = rowB[k] & 0x3;
- const GLint rowCr0 = rowC[j] & 0x3;
- const GLint rowCr1 = rowC[k] & 0x3;
- const GLint rowDr0 = rowD[j] & 0x3;
- const GLint rowDr1 = rowD[k] & 0x3;
- const GLint rowAg0 = (rowA[j] >> 2) & 0x7;
- const GLint rowAg1 = (rowA[k] >> 2) & 0x7;
- const GLint rowBg0 = (rowB[j] >> 2) & 0x7;
- const GLint rowBg1 = (rowB[k] >> 2) & 0x7;
- const GLint rowCg0 = (rowC[j] >> 2) & 0x7;
- const GLint rowCg1 = (rowC[k] >> 2) & 0x7;
- const GLint rowDg0 = (rowD[j] >> 2) & 0x7;
- const GLint rowDg1 = (rowD[k] >> 2) & 0x7;
- const GLint rowAb0 = (rowA[j] >> 5) & 0x7;
- const GLint rowAb1 = (rowA[k] >> 5) & 0x7;
- const GLint rowBb0 = (rowB[j] >> 5) & 0x7;
- const GLint rowBb1 = (rowB[k] >> 5) & 0x7;
- const GLint rowCb0 = (rowC[j] >> 5) & 0x7;
- const GLint rowCb1 = (rowC[k] >> 5) & 0x7;
- const GLint rowDb0 = (rowD[j] >> 5) & 0x7;
- const GLint rowDb1 = (rowD[k] >> 5) & 0x7;
- const GLint r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
- rowCr0, rowCr1, rowDr0, rowDr1);
- const GLint g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
- rowCg0, rowCg1, rowDg0, rowDg1);
- const GLint b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
- rowCb0, rowCb1, rowDb0, rowDb1);
- dst[i] = (b << 5) | (g << 2) | r;
- }
- }
- else {
- _mesa_problem(NULL, "bad format in do_row()");
- }
-}
-
-
-/*
- * These functions generate a 1/2-size mipmap image from a source image.
- * Texture borders are handled by copying or averaging the source image's
- * border texels, depending on the scale-down factor.
- */
-
-static void
-make_1d_mipmap(GLenum datatype, GLuint comps, GLint border,
- GLint srcWidth, const GLubyte *srcPtr,
- GLint dstWidth, GLubyte *dstPtr)
-{
- const GLint bpt = bytes_per_pixel(datatype, comps);
- const GLubyte *src;
- GLubyte *dst;
-
- /* skip the border pixel, if any */
- src = srcPtr + border * bpt;
- dst = dstPtr + border * bpt;
-
- /* we just duplicate the input row, kind of hack, saves code */
- do_row(datatype, comps, srcWidth - 2 * border, src, src,
- dstWidth - 2 * border, dst);
-
- if (border) {
- /* copy left-most pixel from source */
- assert(dstPtr);
- assert(srcPtr);
- memcpy(dstPtr, srcPtr, bpt);
- /* copy right-most pixel from source */
- memcpy(dstPtr + (dstWidth - 1) * bpt,
- srcPtr + (srcWidth - 1) * bpt,
- bpt);
- }
-}
-
-
-static void
-make_2d_mipmap(GLenum datatype, GLuint comps, GLint border,
- GLint srcWidth, GLint srcHeight,
- const GLubyte *srcPtr, GLint srcRowStride,
- GLint dstWidth, GLint dstHeight,
- GLubyte *dstPtr, GLint dstRowStride)
-{
- const GLint bpt = bytes_per_pixel(datatype, comps);
- const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */
- const GLint dstWidthNB = dstWidth - 2 * border;
- const GLint dstHeightNB = dstHeight - 2 * border;
- const GLint srcRowBytes = bpt * srcRowStride;
- const GLint dstRowBytes = bpt * dstRowStride;
- const GLubyte *srcA, *srcB;
- GLubyte *dst;
- GLint row, srcRowStep;
-
- /* Compute src and dst pointers, skipping any border */
- srcA = srcPtr + border * ((srcWidth + 1) * bpt);
- if (srcHeight > 1 && srcHeight > dstHeight) {
- /* sample from two source rows */
- srcB = srcA + srcRowBytes;
- 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 += srcRowStep * srcRowBytes;
- srcB += srcRowStep * srcRowBytes;
- dst += dstRowBytes;
- }
-
- /* This is ugly but probably won't be used much */
- if (border > 0) {
- /* fill in dest border */
- /* lower-left border pixel */
- assert(dstPtr);
- assert(srcPtr);
- memcpy(dstPtr, srcPtr, bpt);
- /* lower-right border pixel */
- memcpy(dstPtr + (dstWidth - 1) * bpt,
- srcPtr + (srcWidth - 1) * bpt, bpt);
- /* upper-left border pixel */
- memcpy(dstPtr + dstWidth * (dstHeight - 1) * bpt,
- srcPtr + srcWidth * (srcHeight - 1) * bpt, bpt);
- /* upper-right border pixel */
- memcpy(dstPtr + (dstWidth * dstHeight - 1) * bpt,
- srcPtr + (srcWidth * srcHeight - 1) * bpt, bpt);
- /* lower border */
- do_row(datatype, comps, srcWidthNB,
- srcPtr + bpt,
- srcPtr + bpt,
- dstWidthNB, dstPtr + bpt);
- /* upper border */
- do_row(datatype, comps, srcWidthNB,
- srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt,
- srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt,
- dstWidthNB,
- dstPtr + (dstWidth * (dstHeight - 1) + 1) * bpt);
- /* left and right borders */
- if (srcHeight == dstHeight) {
- /* copy border pixel from src to dst */
- for (row = 1; row < srcHeight; row++) {
- memcpy(dstPtr + dstWidth * row * bpt,
- srcPtr + srcWidth * row * bpt, bpt);
- memcpy(dstPtr + (dstWidth * row + dstWidth - 1) * bpt,
- srcPtr + (srcWidth * row + srcWidth - 1) * bpt, bpt);
- }
- }
- else {
- /* average two src pixels each dest pixel */
- for (row = 0; row < dstHeightNB; row += 2) {
- do_row(datatype, comps, 1,
- srcPtr + (srcWidth * (row * 2 + 1)) * bpt,
- srcPtr + (srcWidth * (row * 2 + 2)) * bpt,
- 1, dstPtr + (dstWidth * row + 1) * bpt);
- do_row(datatype, comps, 1,
- srcPtr + (srcWidth * (row * 2 + 1) + srcWidth - 1) * bpt,
- srcPtr + (srcWidth * (row * 2 + 2) + srcWidth - 1) * bpt,
- 1, dstPtr + (dstWidth * row + 1 + dstWidth - 1) * bpt);
- }
- }
- }
-}
-
-
-static void
-make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- const GLubyte *srcPtr, GLint srcRowStride,
- GLint dstWidth, GLint dstHeight, GLint dstDepth,
- GLubyte *dstPtr, GLint dstRowStride)
-{
- const GLint bpt = bytes_per_pixel(datatype, comps);
- const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */
- const GLint srcDepthNB = srcDepth - 2 * border;
- const GLint dstWidthNB = dstWidth - 2 * border;
- const GLint dstHeightNB = dstHeight - 2 * border;
- const GLint dstDepthNB = dstDepth - 2 * border;
- GLint img, row;
- GLint bytesPerSrcImage, bytesPerDstImage;
- GLint bytesPerSrcRow, bytesPerDstRow;
- GLint srcImageOffset, srcRowOffset;
-
- (void) srcDepthNB; /* silence warnings */
-
-
- bytesPerSrcImage = srcWidth * srcHeight * bpt;
- bytesPerDstImage = dstWidth * dstHeight * bpt;
-
- bytesPerSrcRow = srcWidth * bpt;
- bytesPerDstRow = dstWidth * bpt;
-
- /* Offset between adjacent src images to be averaged together */
- srcImageOffset = (srcDepth == dstDepth) ? 0 : bytesPerSrcImage;
-
- /* Offset between adjacent src rows to be averaged together */
- srcRowOffset = (srcHeight == dstHeight) ? 0 : srcWidth * bpt;
-
- /*
- * Need to average together up to 8 src pixels for each dest pixel.
- * Break that down into 3 operations:
- * 1. take two rows from source image and average them together.
- * 2. take two rows from next source image and average them together.
- * 3. take the two averaged rows and average them for the final dst row.
- */
-
- /*
- printf("mip3d %d x %d x %d -> %d x %d x %d\n",
- srcWidth, srcHeight, srcDepth, dstWidth, dstHeight, dstDepth);
- */
-
- for (img = 0; img < dstDepthNB; img++) {
- /* first source image pointer, skipping border */
- const GLubyte *imgSrcA = srcPtr
- + (bytesPerSrcImage + bytesPerSrcRow + border) * bpt * border
- + img * (bytesPerSrcImage + srcImageOffset);
- /* second source image pointer, skipping border */
- const GLubyte *imgSrcB = imgSrcA + srcImageOffset;
- /* address of the dest image, skipping border */
- GLubyte *imgDst = dstPtr
- + (bytesPerDstImage + bytesPerDstRow + border) * bpt * border
- + img * bytesPerDstImage;
-
- /* setup the four source row pointers and the dest row pointer */
- const GLubyte *srcImgARowA = imgSrcA;
- const GLubyte *srcImgARowB = imgSrcA + srcRowOffset;
- const GLubyte *srcImgBRowA = imgSrcB;
- const GLubyte *srcImgBRowB = imgSrcB + srcRowOffset;
- GLubyte *dstImgRow = imgDst;
-
- for (row = 0; row < dstHeightNB; row++) {
- do_row_3D(datatype, comps, srcWidthNB,
- srcImgARowA, srcImgARowB,
- srcImgBRowA, srcImgBRowB,
- dstWidthNB, dstImgRow);
-
- /* advance to next rows */
- srcImgARowA += bytesPerSrcRow + srcRowOffset;
- srcImgARowB += bytesPerSrcRow + srcRowOffset;
- srcImgBRowA += bytesPerSrcRow + srcRowOffset;
- srcImgBRowB += bytesPerSrcRow + srcRowOffset;
- dstImgRow += bytesPerDstRow;
- }
- }
-
-
- /* Luckily we can leverage the make_2d_mipmap() function here! */
- if (border > 0) {
- /* do front border image */
- make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, srcPtr, srcRowStride,
- dstWidth, dstHeight, dstPtr, dstRowStride);
- /* do back border image */
- make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight,
- srcPtr + bytesPerSrcImage * (srcDepth - 1), srcRowStride,
- dstWidth, dstHeight,
- dstPtr + bytesPerDstImage * (dstDepth - 1), dstRowStride);
- /* do four remaining border edges that span the image slices */
- if (srcDepth == dstDepth) {
- /* just copy border pixels from src to dst */
- for (img = 0; img < dstDepthNB; img++) {
- const GLubyte *src;
- GLubyte *dst;
-
- /* do border along [img][row=0][col=0] */
- src = srcPtr + (img + 1) * bytesPerSrcImage;
- dst = dstPtr + (img + 1) * bytesPerDstImage;
- memcpy(dst, src, bpt);
-
- /* do border along [img][row=dstHeight-1][col=0] */
- src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
- + (srcHeight - 1) * bytesPerSrcRow;
- dst = dstPtr + (img + 1) * bytesPerDstImage
- + (dstHeight - 1) * bytesPerDstRow;
- memcpy(dst, src, bpt);
-
- /* do border along [img][row=0][col=dstWidth-1] */
- src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
- + (srcWidth - 1) * bpt;
- dst = dstPtr + (img + 1) * bytesPerDstImage
- + (dstWidth - 1) * bpt;
- memcpy(dst, src, bpt);
-
- /* do border along [img][row=dstHeight-1][col=dstWidth-1] */
- src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
- + (bytesPerSrcImage - bpt);
- dst = dstPtr + (img + 1) * bytesPerDstImage
- + (bytesPerDstImage - bpt);
- memcpy(dst, src, bpt);
- }
- }
- else {
- /* average border pixels from adjacent src image pairs */
- ASSERT(srcDepthNB == 2 * dstDepthNB);
- for (img = 0; img < dstDepthNB; img++) {
- const GLubyte *src;
- GLubyte *dst;
-
- /* do border along [img][row=0][col=0] */
- src = srcPtr + (img * 2 + 1) * bytesPerSrcImage;
- dst = dstPtr + (img + 1) * bytesPerDstImage;
- do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst);
-
- /* do border along [img][row=dstHeight-1][col=0] */
- src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
- + (srcHeight - 1) * bytesPerSrcRow;
- dst = dstPtr + (img + 1) * bytesPerDstImage
- + (dstHeight - 1) * bytesPerDstRow;
- do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst);
-
- /* do border along [img][row=0][col=dstWidth-1] */
- src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
- + (srcWidth - 1) * bpt;
- dst = dstPtr + (img + 1) * bytesPerDstImage
- + (dstWidth - 1) * bpt;
- do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst);
-
- /* do border along [img][row=dstHeight-1][col=dstWidth-1] */
- src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
- + (bytesPerSrcImage - bpt);
- dst = dstPtr + (img + 1) * bytesPerDstImage
- + (bytesPerDstImage - bpt);
- do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst);
- }
- }
- }
-}
-
-
-static void
-make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
- GLint srcWidth, const GLubyte *srcPtr, GLuint srcRowStride,
- GLint dstWidth, GLint dstHeight,
- GLubyte *dstPtr, GLuint dstRowStride )
-{
- const GLint bpt = bytes_per_pixel(datatype, comps);
- const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */
- const GLint dstWidthNB = dstWidth - 2 * border;
- const GLint dstHeightNB = dstHeight - 2 * border;
- const GLint srcRowBytes = bpt * srcRowStride;
- const GLint dstRowBytes = bpt * dstRowStride;
- const GLubyte *src;
- GLubyte *dst;
- GLint row;
-
- /* Compute src and dst pointers, skipping any border */
- src = srcPtr + border * ((srcWidth + 1) * bpt);
- dst = dstPtr + border * ((dstWidth + 1) * bpt);
-
- for (row = 0; row < dstHeightNB; row++) {
- do_row(datatype, comps, srcWidthNB, src, src,
- dstWidthNB, dst);
- src += srcRowBytes;
- dst += dstRowBytes;
- }
-
- if (border) {
- /* copy left-most pixel from source */
- assert(dstPtr);
- assert(srcPtr);
- memcpy(dstPtr, srcPtr, bpt);
- /* copy right-most pixel from source */
- memcpy(dstPtr + (dstWidth - 1) * bpt,
- srcPtr + (srcWidth - 1) * bpt,
- bpt);
- }
-}
-
-
-/**
- * \bug
- * There is quite a bit of refactoring that could be done with this function
- * and \c make_2d_mipmap.
- */
-static void
-make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
- GLint srcWidth, GLint srcHeight,
- const GLubyte *srcPtr, GLint srcRowStride,
- GLint dstWidth, GLint dstHeight, GLint dstDepth,
- GLubyte *dstPtr, GLint dstRowStride)
-{
- const GLint bpt = bytes_per_pixel(datatype, comps);
- const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */
- const GLint dstWidthNB = dstWidth - 2 * border;
- const GLint dstHeightNB = dstHeight - 2 * border;
- const GLint dstDepthNB = dstDepth - 2 * border;
- const GLint srcRowBytes = bpt * srcRowStride;
- const GLint dstRowBytes = bpt * dstRowStride;
- const GLubyte *srcA, *srcB;
- GLubyte *dst;
- GLint layer;
- GLint row;
-
- /* Compute src and dst pointers, skipping any border */
- srcA = srcPtr + border * ((srcWidth + 1) * bpt);
- if (srcHeight > 1)
- srcB = srcA + srcRowBytes;
- else
- srcB = srcA;
- dst = dstPtr + border * ((dstWidth + 1) * bpt);
-
- for (layer = 0; layer < dstDepthNB; layer++) {
- for (row = 0; row < dstHeightNB; row++) {
- do_row(datatype, comps, srcWidthNB, srcA, srcB,
- dstWidthNB, dst);
- srcA += 2 * srcRowBytes;
- srcB += 2 * srcRowBytes;
- dst += dstRowBytes;
- }
-
- /* This is ugly but probably won't be used much */
- if (border > 0) {
- /* fill in dest border */
- /* lower-left border pixel */
- assert(dstPtr);
- assert(srcPtr);
- memcpy(dstPtr, srcPtr, bpt);
- /* lower-right border pixel */
- memcpy(dstPtr + (dstWidth - 1) * bpt,
- srcPtr + (srcWidth - 1) * bpt, bpt);
- /* upper-left border pixel */
- memcpy(dstPtr + dstWidth * (dstHeight - 1) * bpt,
- srcPtr + srcWidth * (srcHeight - 1) * bpt, bpt);
- /* upper-right border pixel */
- memcpy(dstPtr + (dstWidth * dstHeight - 1) * bpt,
- srcPtr + (srcWidth * srcHeight - 1) * bpt, bpt);
- /* lower border */
- do_row(datatype, comps, srcWidthNB,
- srcPtr + bpt,
- srcPtr + bpt,
- dstWidthNB, dstPtr + bpt);
- /* upper border */
- do_row(datatype, comps, srcWidthNB,
- srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt,
- srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt,
- dstWidthNB,
- dstPtr + (dstWidth * (dstHeight - 1) + 1) * bpt);
- /* left and right borders */
- if (srcHeight == dstHeight) {
- /* copy border pixel from src to dst */
- for (row = 1; row < srcHeight; row++) {
- memcpy(dstPtr + dstWidth * row * bpt,
- srcPtr + srcWidth * row * bpt, bpt);
- memcpy(dstPtr + (dstWidth * row + dstWidth - 1) * bpt,
- srcPtr + (srcWidth * row + srcWidth - 1) * bpt, bpt);
- }
- }
- else {
- /* average two src pixels each dest pixel */
- for (row = 0; row < dstHeightNB; row += 2) {
- do_row(datatype, comps, 1,
- srcPtr + (srcWidth * (row * 2 + 1)) * bpt,
- srcPtr + (srcWidth * (row * 2 + 2)) * bpt,
- 1, dstPtr + (dstWidth * row + 1) * bpt);
- do_row(datatype, comps, 1,
- srcPtr + (srcWidth * (row * 2 + 1) + srcWidth - 1) * bpt,
- srcPtr + (srcWidth * (row * 2 + 2) + srcWidth - 1) * bpt,
- 1, dstPtr + (dstWidth * row + 1 + dstWidth - 1) * bpt);
- }
- }
- }
- }
-}
-
-
-/**
- * Down-sample a texture image to produce the next lower mipmap level.
- * \param comps components per texel (1, 2, 3 or 4)
- * \param srcRowStride stride between source rows, in texels
- * \param dstRowStride stride between destination rows, in texels
- */
-void
-_mesa_generate_mipmap_level(GLenum target,
- GLenum datatype, GLuint comps,
- GLint border,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- const GLubyte *srcData,
- GLint srcRowStride,
- GLint dstWidth, GLint dstHeight, GLint dstDepth,
- GLubyte *dstData,
- GLint dstRowStride)
-{
- /*
- * We use simple 2x2 averaging to compute the next mipmap level.
- */
- switch (target) {
- case GL_TEXTURE_1D:
- make_1d_mipmap(datatype, comps, border,
- srcWidth, srcData,
- dstWidth, dstData);
- break;
- case GL_TEXTURE_2D:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
- make_2d_mipmap(datatype, comps, border,
- srcWidth, srcHeight, srcData, srcRowStride,
- dstWidth, dstHeight, dstData, dstRowStride);
- break;
- case GL_TEXTURE_3D:
- make_3d_mipmap(datatype, comps, border,
- srcWidth, srcHeight, srcDepth,
- srcData, srcRowStride,
- dstWidth, dstHeight, dstDepth,
- dstData, dstRowStride);
- break;
- case GL_TEXTURE_1D_ARRAY_EXT:
- make_1d_stack_mipmap(datatype, comps, border,
- srcWidth, srcData, srcRowStride,
- dstWidth, dstHeight,
- dstData, dstRowStride);
- break;
- case GL_TEXTURE_2D_ARRAY_EXT:
- make_2d_stack_mipmap(datatype, comps, border,
- srcWidth, srcHeight,
- srcData, srcRowStride,
- dstWidth, dstHeight,
- dstDepth, dstData, dstRowStride);
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- /* no mipmaps, do nothing */
- break;
- default:
- _mesa_problem(NULL, "bad dimensions in _mesa_generate_mipmaps");
- return;
- }
-}
-
-
-/**
- * compute next (level+1) image size
- * \return GL_FALSE if no smaller size can be generated (eg. src is 1x1x1 size)
- */
-static GLboolean
-next_mipmap_level_size(GLenum target, GLint border,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLint *dstWidth, GLint *dstHeight, GLint *dstDepth)
-{
- if (srcWidth - 2 * border > 1) {
- *dstWidth = (srcWidth - 2 * border) / 2 + 2 * border;
- }
- else {
- *dstWidth = srcWidth; /* can't go smaller */
- }
-
- if ((srcHeight - 2 * border > 1) &&
- (target != GL_TEXTURE_1D_ARRAY_EXT)) {
- *dstHeight = (srcHeight - 2 * border) / 2 + 2 * border;
- }
- else {
- *dstHeight = srcHeight; /* can't go smaller */
- }
-
- if ((srcDepth - 2 * border > 1) &&
- (target != GL_TEXTURE_2D_ARRAY_EXT)) {
- *dstDepth = (srcDepth - 2 * border) / 2 + 2 * border;
- }
- else {
- *dstDepth = srcDepth; /* can't go smaller */
- }
-
- if (*dstWidth == srcWidth &&
- *dstHeight == srcHeight &&
- *dstDepth == srcDepth) {
- return GL_FALSE;
- }
- else {
- return GL_TRUE;
- }
-}
-
-
-
-
-/**
- * Automatic mipmap generation.
- * This is the fallback/default function for ctx->Driver.GenerateMipmap().
- * Generate a complete set of mipmaps from texObj's BaseLevel image.
- * Stop at texObj's MaxLevel or when we get to the 1x1 texture.
- * For cube maps, target will be one of
- * GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z; never GL_TEXTURE_CUBE_MAP.
- */
-void
-_mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
- struct gl_texture_object *texObj)
-{
- const struct gl_texture_image *srcImage;
- gl_format convertFormat;
- const GLubyte *srcData = NULL;
- GLubyte *dstData = NULL;
- GLint level, maxLevels;
- GLenum datatype;
- GLuint comps;
-
- ASSERT(texObj);
- srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel);
- ASSERT(srcImage);
-
- maxLevels = _mesa_max_texture_levels(ctx, texObj->Target);
- ASSERT(maxLevels > 0); /* bad target */
-
- /* Find convertFormat - the format that do_row() will process */
-
- if (_mesa_is_format_compressed(srcImage->TexFormat)) {
- /* setup for compressed textures - need to allocate temporary
- * image buffers to hold uncompressed images.
- */
- GLuint row;
- GLint components, size;
- GLchan *dst;
-
- assert(texObj->Target == GL_TEXTURE_2D ||
- texObj->Target == GL_TEXTURE_CUBE_MAP_ARB);
-
- if (srcImage->_BaseFormat == GL_RGB) {
- convertFormat = MESA_FORMAT_RGB888;
- components = 3;
- }
- else if (srcImage->_BaseFormat == GL_RGBA) {
- convertFormat = MESA_FORMAT_RGBA8888;
- components = 4;
- }
- else {
- _mesa_problem(ctx, "bad srcImage->_BaseFormat in _mesa_generate_mipmaps");
- return;
- }
-
- /* allocate storage for uncompressed GL_RGB or GL_RGBA images */
- size = _mesa_bytes_per_pixel(srcImage->_BaseFormat, CHAN_TYPE)
- * srcImage->Width * srcImage->Height * srcImage->Depth + 20;
- /* 20 extra bytes, just be safe when calling last FetchTexel */
- srcData = (GLubyte *) malloc(size);
- if (!srcData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
- return;
- }
- dstData = (GLubyte *) malloc(size / 2); /* 1/4 would probably be OK */
- if (!dstData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
- free((void *) srcData);
- return;
- }
-
- /* decompress base image here */
- dst = (GLchan *) srcData;
- for (row = 0; row < srcImage->Height; row++) {
- GLuint col;
- for (col = 0; col < srcImage->Width; col++) {
- srcImage->FetchTexelc(srcImage, col, row, 0, dst);
- dst += components;
- }
- }
- }
- else {
- /* uncompressed */
- convertFormat = srcImage->TexFormat;
- }
-
- _mesa_format_to_type_and_comps(convertFormat, &datatype, &comps);
-
- for (level = texObj->BaseLevel; level < texObj->MaxLevel
- && level < maxLevels - 1; level++) {
- /* generate image[level+1] from image[level] */
- const struct gl_texture_image *srcImage;
- struct gl_texture_image *dstImage;
- GLint srcWidth, srcHeight, srcDepth;
- GLint dstWidth, dstHeight, dstDepth;
- GLint border;
- GLboolean nextLevel;
-
- /* get src image parameters */
- srcImage = _mesa_select_tex_image(ctx, texObj, target, level);
- ASSERT(srcImage);
- srcWidth = srcImage->Width;
- srcHeight = srcImage->Height;
- srcDepth = srcImage->Depth;
- border = srcImage->Border;
-
- nextLevel = next_mipmap_level_size(target, border,
- srcWidth, srcHeight, srcDepth,
- &dstWidth, &dstHeight, &dstDepth);
- if (!nextLevel) {
- /* all done */
- if (_mesa_is_format_compressed(srcImage->TexFormat)) {
- free((void *) srcData);
- free(dstData);
- }
- return;
- }
-
- /* get dest gl_texture_image */
- dstImage = _mesa_get_tex_image(ctx, texObj, target, level + 1);
- if (!dstImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
- return;
- }
-
- /* Free old image data */
- if (dstImage->Data)
- ctx->Driver.FreeTexImageData(ctx, dstImage);
-
- /* initialize new image */
- _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight,
- dstDepth, border, srcImage->InternalFormat,
- srcImage->TexFormat);
- dstImage->DriverData = NULL;
- dstImage->FetchTexelc = srcImage->FetchTexelc;
- dstImage->FetchTexelf = srcImage->FetchTexelf;
-
- /* 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 {
- srcData = (const GLubyte *) srcImage->Data;
- dstData = (GLubyte *) dstImage->Data;
- }
-
- ASSERT(dstImage->TexFormat);
- ASSERT(dstImage->FetchTexelc);
- ASSERT(dstImage->FetchTexelf);
-
- _mesa_generate_mipmap_level(target, datatype, comps, border,
- srcWidth, srcHeight, srcDepth,
- srcData, srcImage->RowStride,
- dstWidth, dstHeight, dstDepth,
- dstData, dstImage->RowStride);
-
-
- if (_mesa_is_format_compressed(dstImage->TexFormat)) {
- GLubyte *temp;
- /* compress image from dstData into dstImage->Data */
- const GLenum srcFormat = _mesa_get_format_base_format(convertFormat);
- GLint dstRowStride
- = _mesa_format_row_stride(dstImage->TexFormat, dstWidth);
- ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA);
-
- _mesa_texstore(ctx, 2, dstImage->_BaseFormat,
- dstImage->TexFormat,
- dstImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride, 0, /* strides */
- dstWidth, dstHeight, 1, /* size */
- srcFormat, CHAN_TYPE,
- dstData, /* src data, actually */
- &ctx->DefaultPacking);
-
- /* swap src and dest pointers */
- temp = (GLubyte *) srcData;
- srcData = dstData;
- dstData = temp;
- }
-
- } /* loop over mipmap levels */
-}
-
-
-/**
- * Helper function for drivers which need to rescale texture images to
- * certain aspect ratios.
- * Nearest filtering only (for broken hardware that can't support
- * all aspect ratios). This can be made a lot faster, but I don't
- * really care enough...
- */
-void
-_mesa_rescale_teximage2d(GLuint bytesPerPixel,
- GLuint srcStrideInPixels,
- GLuint dstRowStride,
- GLint srcWidth, GLint srcHeight,
- GLint dstWidth, GLint dstHeight,
- const GLvoid *srcImage, GLvoid *dstImage)
-{
- GLint row, col;
-
-#define INNER_LOOP( TYPE, HOP, WOP ) \
- for ( row = 0 ; row < dstHeight ; row++ ) { \
- GLint srcRow = row HOP hScale; \
- for ( col = 0 ; col < dstWidth ; col++ ) { \
- GLint srcCol = col WOP wScale; \
- dst[col] = src[srcRow * srcStrideInPixels + srcCol]; \
- } \
- dst = (TYPE *) ((GLubyte *) dst + dstRowStride); \
- } \
-
-#define RESCALE_IMAGE( TYPE ) \
-do { \
- const TYPE *src = (const TYPE *)srcImage; \
- TYPE *dst = (TYPE *)dstImage; \
- \
- if ( srcHeight < dstHeight ) { \
- const GLint hScale = dstHeight / srcHeight; \
- if ( srcWidth < dstWidth ) { \
- const GLint wScale = dstWidth / srcWidth; \
- INNER_LOOP( TYPE, /, / ); \
- } \
- else { \
- const GLint wScale = srcWidth / dstWidth; \
- INNER_LOOP( TYPE, /, * ); \
- } \
- } \
- else { \
- const GLint hScale = srcHeight / dstHeight; \
- if ( srcWidth < dstWidth ) { \
- const GLint wScale = dstWidth / srcWidth; \
- INNER_LOOP( TYPE, *, / ); \
- } \
- else { \
- const GLint wScale = srcWidth / dstWidth; \
- INNER_LOOP( TYPE, *, * ); \
- } \
- } \
-} while (0)
-
- switch ( bytesPerPixel ) {
- case 4:
- RESCALE_IMAGE( GLuint );
- break;
-
- case 2:
- RESCALE_IMAGE( GLushort );
- break;
-
- case 1:
- RESCALE_IMAGE( GLubyte );
- break;
- default:
- _mesa_problem(NULL,"unexpected bytes/pixel in _mesa_rescale_teximage2d");
- }
-}
-
-
-/**
- * Upscale an image by replication, not (typical) stretching.
- * We use this when the image width or height is less than a
- * certain size (4, 8) and we need to upscale an image.
- */
-void
-_mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight,
- GLsizei outWidth, GLsizei outHeight,
- GLint comps, const GLchan *src, GLint srcRowStride,
- GLchan *dest )
-{
- GLint i, j, k;
-
- ASSERT(outWidth >= inWidth);
- ASSERT(outHeight >= inHeight);
-#if 0
- ASSERT(inWidth == 1 || inWidth == 2 || inHeight == 1 || inHeight == 2);
- ASSERT((outWidth & 3) == 0);
- ASSERT((outHeight & 3) == 0);
-#endif
-
- for (i = 0; i < outHeight; i++) {
- const GLint ii = i % inHeight;
- for (j = 0; j < outWidth; j++) {
- const GLint jj = j % inWidth;
- for (k = 0; k < comps; k++) {
- dest[(i * outWidth + j) * comps + k]
- = src[ii * srcRowStride + jj * comps + k];
- }
- }
- }
-}
-
diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h
deleted file mode 100644
index 4c7ee63..0000000
--- a/src/mesa/main/mipmap.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.
- */
-
-
-#ifndef MIPMAP_H
-#define MIPMAP_H
-
-#include "mtypes.h"
-
-
-extern void
-_mesa_generate_mipmap_level(GLenum target,
- GLenum datatype, GLuint comps,
- GLint border,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- const GLubyte *srcData,
- GLint srcRowStride,
- GLint dstWidth, GLint dstHeight, GLint dstDepth,
- GLubyte *dstData,
- GLint dstRowStride);
-
-
-extern void
-_mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
- struct gl_texture_object *texObj);
-
-
-extern void
-_mesa_rescale_teximage2d(GLuint bytesPerPixel,
- GLuint srcStrideInPixels,
- GLuint dstRowStride,
- GLint srcWidth, GLint srcHeight,
- GLint dstWidth, GLint dstHeight,
- const GLvoid *srcImage, GLvoid *dstImage);
-
-extern void
-_mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight,
- GLsizei outWidth, GLsizei outHeight,
- GLint comps, const GLchan *src, GLint srcRowStride,
- GLchan *dest);
-
-
-#endif /* MIPMAP_H */
diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c
deleted file mode 100644
index 25a0293..0000000
--- a/src/mesa/main/mm.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * GLX Hardware Device Driver common code
- * Copyright (C) 1999 Wittawat Yamwong
- *
- * 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
- * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS 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 "compiler.h"
-#include "mm.h"
-
-
-void
-mmDumpMemInfo(const struct mem_block *heap)
-{
- fprintf(stderr, "Memory heap %p:\n", (void *)heap);
- if (heap == 0) {
- fprintf(stderr, " heap == 0\n");
- } else {
- const struct mem_block *p;
-
- for(p = heap->next; p != heap; p = p->next) {
- fprintf(stderr, " Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
- p->free ? 'F':'.',
- p->reserved ? 'R':'.');
- }
-
- fprintf(stderr, "\nFree list:\n");
-
- for(p = heap->next_free; p != heap; p = p->next_free) {
- fprintf(stderr, " FREE Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
- p->free ? 'F':'.',
- p->reserved ? 'R':'.');
- }
-
- }
- fprintf(stderr, "End of memory blocks\n");
-}
-
-struct mem_block *
-mmInit(unsigned ofs, unsigned size)
-{
- struct mem_block *heap, *block;
-
- if (!size)
- return NULL;
-
- heap = (struct mem_block *) calloc(1, sizeof(struct mem_block));
- if (!heap)
- return NULL;
-
- block = (struct mem_block *) calloc(1, sizeof(struct mem_block));
- if (!block) {
- free(heap);
- return NULL;
- }
-
- heap->next = block;
- heap->prev = block;
- heap->next_free = block;
- heap->prev_free = block;
-
- block->heap = heap;
- block->next = heap;
- block->prev = heap;
- block->next_free = heap;
- block->prev_free = heap;
-
- block->ofs = ofs;
- block->size = size;
- block->free = 1;
-
- return heap;
-}
-
-
-static struct mem_block *
-SliceBlock(struct mem_block *p,
- unsigned startofs, unsigned size,
- unsigned reserved, unsigned alignment)
-{
- struct mem_block *newblock;
-
- /* break left [p, newblock, p->next], then p = newblock */
- if (startofs > p->ofs) {
- newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
- if (!newblock)
- return NULL;
- newblock->ofs = startofs;
- newblock->size = p->size - (startofs - p->ofs);
- newblock->free = 1;
- newblock->heap = p->heap;
-
- newblock->next = p->next;
- newblock->prev = p;
- p->next->prev = newblock;
- p->next = newblock;
-
- newblock->next_free = p->next_free;
- newblock->prev_free = p;
- p->next_free->prev_free = newblock;
- p->next_free = newblock;
-
- p->size -= newblock->size;
- p = newblock;
- }
-
- /* break right, also [p, newblock, p->next] */
- if (size < p->size) {
- newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
- if (!newblock)
- return NULL;
- newblock->ofs = startofs + size;
- newblock->size = p->size - size;
- newblock->free = 1;
- newblock->heap = p->heap;
-
- newblock->next = p->next;
- newblock->prev = p;
- p->next->prev = newblock;
- p->next = newblock;
-
- newblock->next_free = p->next_free;
- newblock->prev_free = p;
- p->next_free->prev_free = newblock;
- p->next_free = newblock;
-
- p->size = size;
- }
-
- /* p = middle block */
- p->free = 0;
-
- /* Remove p from the free list:
- */
- p->next_free->prev_free = p->prev_free;
- p->prev_free->next_free = p->next_free;
-
- p->next_free = 0;
- p->prev_free = 0;
-
- p->reserved = reserved;
- return p;
-}
-
-
-struct mem_block *
-mmAllocMem(struct mem_block *heap, unsigned size, unsigned align2, unsigned startSearch)
-{
- struct mem_block *p;
- const unsigned mask = (1 << align2)-1;
- unsigned startofs = 0;
- unsigned endofs;
-
- if (!heap || !size)
- return NULL;
-
- for (p = heap->next_free; p != heap; p = p->next_free) {
- assert(p->free);
-
- startofs = (p->ofs + mask) & ~mask;
- if ( startofs < startSearch ) {
- startofs = startSearch;
- }
- endofs = startofs+size;
- if (endofs <= (p->ofs+p->size))
- break;
- }
-
- if (p == heap)
- return NULL;
-
- assert(p->free);
- p = SliceBlock(p,startofs,size,0,mask+1);
-
- return p;
-}
-
-
-struct mem_block *
-mmFindBlock(struct mem_block *heap, unsigned start)
-{
- struct mem_block *p;
-
- for (p = heap->next; p != heap; p = p->next) {
- if (p->ofs == start)
- return p;
- }
-
- return NULL;
-}
-
-
-static INLINE int
-Join2Blocks(struct mem_block *p)
-{
- /* XXX there should be some assertions here */
-
- /* NOTE: heap->free == 0 */
-
- if (p->free && p->next->free) {
- struct mem_block *q = p->next;
-
- assert(p->ofs + p->size == q->ofs);
- p->size += q->size;
-
- p->next = q->next;
- q->next->prev = p;
-
- q->next_free->prev_free = q->prev_free;
- q->prev_free->next_free = q->next_free;
-
- free(q);
- return 1;
- }
- return 0;
-}
-
-int
-mmFreeMem(struct mem_block *b)
-{
- if (!b)
- return 0;
-
- if (b->free) {
- fprintf(stderr, "block already free\n");
- return -1;
- }
- if (b->reserved) {
- fprintf(stderr, "block is reserved\n");
- return -1;
- }
-
- b->free = 1;
- b->next_free = b->heap->next_free;
- b->prev_free = b->heap;
- b->next_free->prev_free = b;
- b->prev_free->next_free = b;
-
- Join2Blocks(b);
- if (b->prev != b->heap)
- Join2Blocks(b->prev);
-
- return 0;
-}
-
-
-void
-mmDestroy(struct mem_block *heap)
-{
- struct mem_block *p;
-
- if (!heap)
- return;
-
- for (p = heap->next; p != heap; ) {
- struct mem_block *next = p->next;
- free(p);
- p = next;
- }
-
- free(heap);
-}
diff --git a/src/mesa/main/mm.h b/src/mesa/main/mm.h
deleted file mode 100644
index 228721c..0000000
--- a/src/mesa/main/mm.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * GLX Hardware Device Driver common code
- * Copyright (C) 1999 Wittawat Yamwong
- *
- * 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
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS 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.
- */
-
-
-/**
- * Memory manager code. Primarily used by device drivers to manage texture
- * heaps, etc.
- */
-
-
-#ifndef MM_H
-#define MM_H
-
-
-struct mem_block {
- struct mem_block *next, *prev;
- struct mem_block *next_free, *prev_free;
- struct mem_block *heap;
- unsigned ofs;
- unsigned size;
- unsigned free:1;
- unsigned reserved:1;
-};
-
-
-
-/**
- * input: total size in bytes
- * return: a heap pointer if OK, NULL if error
- */
-extern struct mem_block *mmInit(unsigned ofs, unsigned size);
-
-/**
- * Allocate 'size' bytes with 2^align2 bytes alignment,
- * restrict the search to free memory after 'startSearch'
- * depth and back buffers should be in different 4mb banks
- * to get better page hits if possible
- * input: size = size of block
- * align2 = 2^align2 bytes alignment
- * startSearch = linear offset from start of heap to begin search
- * return: pointer to the allocated block, 0 if error
- */
-extern struct mem_block *mmAllocMem(struct mem_block *heap, unsigned size,
- unsigned align2, unsigned startSearch);
-
-/**
- * Free block starts at offset
- * input: pointer to a block
- * return: 0 if OK, -1 if error
- */
-extern int mmFreeMem(struct mem_block *b);
-
-/**
- * Free block starts at offset
- * input: pointer to a heap, start offset
- * return: pointer to a block
- */
-extern struct mem_block *mmFindBlock(struct mem_block *heap, unsigned start);
-
-/**
- * destroy MM
- */
-extern void mmDestroy(struct mem_block *mmInit);
-
-/**
- * For debuging purpose.
- */
-extern void mmDumpMemInfo(const struct mem_block *mmInit);
-
-#endif
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
deleted file mode 100644
index 5487d45..0000000
--- a/src/mesa/main/multisample.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/macros.h"
-#include "main/multisample.h"
-
-
-/**
- * Called via glSampleCoverageARB
- */
-void GLAPIENTRY
-_mesa_SampleCoverageARB(GLclampf value, GLboolean invert)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
-
- ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0);
- ctx->Multisample.SampleCoverageInvert = invert;
- ctx->NewState |= _NEW_MULTISAMPLE;
-}
-
-
-/**
- * Initialize the context's multisample state.
- * \param ctx the GL context.
- */
-void
-_mesa_init_multisample(struct gl_context *ctx)
-{
- ctx->Multisample.Enabled = GL_TRUE;
- ctx->Multisample.SampleAlphaToCoverage = GL_FALSE;
- ctx->Multisample.SampleAlphaToOne = GL_FALSE;
- ctx->Multisample.SampleCoverage = GL_FALSE;
- ctx->Multisample.SampleCoverageValue = 1.0;
- ctx->Multisample.SampleCoverageInvert = GL_FALSE;
-}
diff --git a/src/mesa/main/multisample.h b/src/mesa/main/multisample.h
deleted file mode 100644
index e86d409..0000000
--- a/src/mesa/main/multisample.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#ifndef MULTISAMPLE_H
-#define MULTISAMPLE_H
-
-#include "glheader.h"
-
-struct gl_context;
-
-extern void GLAPIENTRY
-_mesa_SampleCoverageARB(GLclampf value, GLboolean invert);
-
-
-extern void
-_mesa_init_multisample(struct gl_context *ctx);
-
-
-#endif
diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c
deleted file mode 100644
index 36cea3b..0000000
--- a/src/mesa/main/nvprogram.c
+++ /dev/null
@@ -1,919 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \file nvprogram.c
- * NVIDIA vertex/fragment program state management functions.
- * \author Brian Paul
- */
-
-/*
- * Regarding GL_NV_fragment/vertex_program, GL_NV_vertex_program1_1, etc:
- *
- * Portions of this software may use or implement intellectual
- * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims
- * any and all warranties with respect to such intellectual property,
- * including any use thereof or modifications thereto.
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/hash.h"
-#include "main/imports.h"
-#include "main/macros.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"
-
-
-
-/**
- * Execute a vertex state program.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
-{
- struct gl_vertex_program *vprog;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target != GL_VERTEX_STATE_PROGRAM_NV) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glExecuteProgramNV");
- return;
- }
-
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
-
- vprog = (struct gl_vertex_program *) _mesa_lookup_program(ctx, id);
-
- if (!vprog || vprog->Base.Target != GL_VERTEX_STATE_PROGRAM_NV) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glExecuteProgramNV");
- return;
- }
-
- _mesa_problem(ctx, "glExecuteProgramNV() not supported");
-}
-
-
-/**
- * Determine if a set of programs is resident in hardware.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-GLboolean GLAPIENTRY
-_mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids,
- GLboolean *residences)
-{
- GLint i, j;
- GLboolean allResident = GL_TRUE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
-
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV(n)");
- return GL_FALSE;
- }
-
- for (i = 0; i < n; i++) {
- const struct gl_program *prog;
- if (ids[i] == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV");
- return GL_FALSE;
- }
- prog = _mesa_lookup_program(ctx, ids[i]);
- if (!prog) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV");
- return GL_FALSE;
- }
- if (prog->Resident) {
- if (!allResident)
- residences[i] = GL_TRUE;
- }
- else {
- if (allResident) {
- allResident = GL_FALSE;
- for (j = 0; j < i; j++)
- residences[j] = GL_TRUE;
- }
- residences[i] = GL_FALSE;
- }
- }
-
- return allResident;
-}
-
-
-/**
- * Request that a set of programs be resident in hardware.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids)
-{
- GLint i;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(n)");
- return;
- }
-
- /* just error checking for now */
- for (i = 0; i < n; i++) {
- struct gl_program *prog;
-
- if (ids[i] == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)");
- return;
- }
-
- prog = _mesa_lookup_program(ctx, ids[i]);
- if (!prog) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)");
- return;
- }
-
- /* XXX this is really a hardware thing we should hook out */
- prog->Resident = GL_TRUE;
- }
-}
-
-
-/**
- * Get a program parameter register.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetProgramParameterfvNV(GLenum target, GLuint index,
- GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_VERTEX_PROGRAM_NV) {
- if (pname == GL_PROGRAM_PARAMETER_NV) {
- if (index < MAX_NV_VERTEX_PROGRAM_PARAMS) {
- COPY_4V(params, ctx->VertexProgram.Parameters[index]);
- }
- else {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glGetProgramParameterfvNV(index)");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterfvNV(pname)");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterfvNV(target)");
- return;
- }
-}
-
-
-/**
- * Get a program parameter register.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetProgramParameterdvNV(GLenum target, GLuint index,
- GLenum pname, GLdouble *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_VERTEX_PROGRAM_NV) {
- if (pname == GL_PROGRAM_PARAMETER_NV) {
- if (index < MAX_NV_VERTEX_PROGRAM_PARAMS) {
- COPY_4V(params, ctx->VertexProgram.Parameters[index]);
- }
- else {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glGetProgramParameterdvNV(index)");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterdvNV(pname)");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterdvNV(target)");
- return;
- }
-}
-
-
-/**
- * Get a program attribute.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params)
-{
- struct gl_program *prog;
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- prog = _mesa_lookup_program(ctx, id);
- if (!prog) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramivNV");
- return;
- }
-
- switch (pname) {
- case GL_PROGRAM_TARGET_NV:
- *params = prog->Target;
- return;
- case GL_PROGRAM_LENGTH_NV:
- *params = prog->String ?(GLint) strlen((char *) prog->String) : 0;
- return;
- case GL_PROGRAM_RESIDENT_NV:
- *params = prog->Resident;
- return;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivNV(pname)");
- return;
- }
-}
-
-
-/**
- * Get the program source code.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program)
-{
- struct gl_program *prog;
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (pname != GL_PROGRAM_STRING_NV) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringNV(pname)");
- return;
- }
-
- prog = _mesa_lookup_program(ctx, id);
- if (!prog) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramStringNV");
- return;
- }
-
- if (prog->String) {
- memcpy(program, prog->String, strlen((char *) prog->String));
- }
- else {
- program[0] = 0;
- }
-}
-
-
-/**
- * Get matrix tracking information.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetTrackMatrixivNV(GLenum target, GLuint address,
- GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_VERTEX_PROGRAM_NV
- && ctx->Extensions.NV_vertex_program) {
- GLuint i;
-
- if ((address & 0x3) || address >= MAX_NV_VERTEX_PROGRAM_PARAMS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetTrackMatrixivNV(address)");
- return;
- }
-
- i = address / 4;
-
- switch (pname) {
- case GL_TRACK_MATRIX_NV:
- params[0] = (GLint) ctx->VertexProgram.TrackMatrix[i];
- return;
- case GL_TRACK_MATRIX_TRANSFORM_NV:
- params[0] = (GLint) ctx->VertexProgram.TrackMatrixTransform[i];
- return;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTrackMatrixivNV");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTrackMatrixivNV");
- return;
- }
-}
-
-
-/**
- * Get a vertex (or vertex array) attribute.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params)
-{
- const struct gl_client_array *array;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)");
- return;
- }
-
- array = &ctx->Array.ArrayObj->VertexAttrib[index];
-
- switch (pname) {
- case GL_ATTRIB_ARRAY_SIZE_NV:
- params[0] = array->Size;
- break;
- case GL_ATTRIB_ARRAY_STRIDE_NV:
- params[0] = array->Stride;
- break;
- case GL_ATTRIB_ARRAY_TYPE_NV:
- params[0] = array->Type;
- break;
- case GL_CURRENT_ATTRIB_NV:
- if (index == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetVertexAttribdvNV(index == 0)");
- return;
- }
- FLUSH_CURRENT(ctx, 0);
- COPY_4V(params, ctx->Current.Attrib[index]);
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV");
- return;
- }
-}
-
-/**
- * Get a vertex (or vertex array) attribute.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params)
-{
- const struct gl_client_array *array;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)");
- return;
- }
-
- array = &ctx->Array.ArrayObj->VertexAttrib[index];
-
- switch (pname) {
- case GL_ATTRIB_ARRAY_SIZE_NV:
- params[0] = (GLfloat) array->Size;
- break;
- case GL_ATTRIB_ARRAY_STRIDE_NV:
- params[0] = (GLfloat) array->Stride;
- break;
- case GL_ATTRIB_ARRAY_TYPE_NV:
- params[0] = (GLfloat) array->Type;
- break;
- case GL_CURRENT_ATTRIB_NV:
- if (index == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetVertexAttribfvNV(index == 0)");
- return;
- }
- FLUSH_CURRENT(ctx, 0);
- COPY_4V(params, ctx->Current.Attrib[index]);
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV");
- return;
- }
-}
-
-/**
- * Get a vertex (or vertex array) attribute.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params)
-{
- const struct gl_client_array *array;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)");
- return;
- }
-
- array = &ctx->Array.ArrayObj->VertexAttrib[index];
-
- switch (pname) {
- case GL_ATTRIB_ARRAY_SIZE_NV:
- params[0] = array->Size;
- break;
- case GL_ATTRIB_ARRAY_STRIDE_NV:
- params[0] = array->Stride;
- break;
- case GL_ATTRIB_ARRAY_TYPE_NV:
- params[0] = array->Type;
- break;
- case GL_CURRENT_ATTRIB_NV:
- if (index == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetVertexAttribivNV(index == 0)");
- return;
- }
- FLUSH_CURRENT(ctx, 0);
- params[0] = (GLint) ctx->Current.Attrib[index][0];
- params[1] = (GLint) ctx->Current.Attrib[index][1];
- params[2] = (GLint) ctx->Current.Attrib[index][2];
- params[3] = (GLint) ctx->Current.Attrib[index][3];
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
- params[0] = array->BufferObj->Name;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV");
- return;
- }
-}
-
-
-/**
- * Get a vertex array attribute pointer.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerNV(index)");
- return;
- }
-
- if (pname != GL_ATTRIB_ARRAY_POINTER_NV) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerNV(pname)");
- return;
- }
-
- *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr;
-}
-
-void
-_mesa_emit_nv_temp_initialization(struct gl_context *ctx,
- struct gl_program *program)
-{
- struct prog_instruction *inst;
- GLuint i;
- struct gl_shader_compiler_options* options =
- &ctx->ShaderCompilerOptions[_mesa_program_target_to_index(program->Target)];
-
- if (!options->EmitNVTempInitialization)
- return;
-
- /* We'll swizzle up a zero temporary so we can use it for the
- * ARL.
- */
- if (program->NumTemporaries == 0)
- program->NumTemporaries = 1;
-
- _mesa_insert_instructions(program, 0, program->NumTemporaries + 1);
-
- for (i = 0; i < program->NumTemporaries; i++) {
- struct prog_instruction *inst = &program->Instructions[i];
-
- inst->Opcode = OPCODE_SWZ;
- inst->DstReg.File = PROGRAM_TEMPORARY;
- inst->DstReg.Index = i;
- inst->DstReg.WriteMask = WRITEMASK_XYZW;
- inst->SrcReg[0].File = PROGRAM_TEMPORARY;
- inst->SrcReg[0].Index = 0;
- inst->SrcReg[0].Swizzle = MAKE_SWIZZLE4(SWIZZLE_ZERO,
- SWIZZLE_ZERO,
- SWIZZLE_ZERO,
- SWIZZLE_ZERO);
- }
-
- inst = &program->Instructions[i];
- inst->Opcode = OPCODE_ARL;
- inst->DstReg.File = PROGRAM_ADDRESS;
- inst->DstReg.Index = 0;
- inst->DstReg.WriteMask = WRITEMASK_XYZW;
- inst->SrcReg[0].File = PROGRAM_TEMPORARY;
- inst->SrcReg[0].Index = 0;
- inst->SrcReg[0].Swizzle = SWIZZLE_XXXX;
-
- if (program->NumAddressRegs == 0)
- program->NumAddressRegs = 1;
-}
-
-void
-_mesa_setup_nv_temporary_count(struct gl_context *ctx, struct gl_program *program)
-{
- GLuint i;
-
- program->NumTemporaries = 0;
- for (i = 0; i < program->NumInstructions; i++) {
- struct prog_instruction *inst = &program->Instructions[i];
-
- if (inst->DstReg.File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2(program->NumTemporaries,
- inst->DstReg.Index + 1);
- }
- if (inst->SrcReg[0].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
- inst->SrcReg[0].Index + 1);
- }
- if (inst->SrcReg[1].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
- inst->SrcReg[1].Index + 1);
- }
- if (inst->SrcReg[2].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
- inst->SrcReg[2].Index + 1);
- }
- }
-}
-
-/**
- * Load/parse/compile a program.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
- const GLubyte *program)
-{
- struct gl_program *prog;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!ctx->Extensions.NV_vertex_program
- && !ctx->Extensions.NV_fragment_program) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV()");
- return;
- }
-
- if (id == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(id)");
- return;
- }
-
- if (len < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(len)");
- return;
- }
-
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
-
- prog = _mesa_lookup_program(ctx, id);
-
- if (prog && prog->Target != 0 && prog->Target != target) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(target)");
- return;
- }
-
- if ((target == GL_VERTEX_PROGRAM_NV ||
- target == GL_VERTEX_STATE_PROGRAM_NV)
- && ctx->Extensions.NV_vertex_program) {
- struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog;
- if (!vprog || prog == &_mesa_DummyProgram) {
- vprog = (struct gl_vertex_program *)
- ctx->Driver.NewProgram(ctx, target, id);
- if (!vprog) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- _mesa_HashInsert(ctx->Shared->Programs, id, vprog);
- }
-
- if (ctx->Extensions.ARB_vertex_program
- && (strncmp((char *) program, "!!ARB", 5) == 0)) {
- _mesa_parse_arb_vertex_program(ctx, target, program, len, vprog);
- } else {
- _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog);
- }
- }
- else if (target == GL_FRAGMENT_PROGRAM_NV
- && ctx->Extensions.NV_fragment_program) {
- struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
- if (!fprog || prog == &_mesa_DummyProgram) {
- fprog = (struct gl_fragment_program *)
- ctx->Driver.NewProgram(ctx, target, id);
- if (!fprog) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- _mesa_HashInsert(ctx->Shared->Programs, id, fprog);
- }
- _mesa_parse_nv_fragment_program(ctx, target, program, len, fprog);
- }
- else if (target == GL_FRAGMENT_PROGRAM_ARB
- && ctx->Extensions.ARB_fragment_program) {
- struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
- if (!fprog || prog == &_mesa_DummyProgram) {
- fprog = (struct gl_fragment_program *)
- ctx->Driver.NewProgram(ctx, target, id);
- if (!fprog) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- _mesa_HashInsert(ctx->Shared->Programs, id, fprog);
- }
- _mesa_parse_arb_fragment_program(ctx, target, program, len, fprog);
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glLoadProgramNV(target)");
- }
-}
-
-
-
-/**
- * Set a sequence of program parameter registers.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_ProgramParameters4dvNV(GLenum target, GLuint index,
- GLsizei num, const GLdouble *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) {
- GLint i;
- if (index + num > MAX_NV_VERTEX_PROGRAM_PARAMS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameters4dvNV");
- return;
- }
- for (i = 0; i < num; i++) {
- ctx->VertexProgram.Parameters[index + i][0] = (GLfloat) params[0];
- ctx->VertexProgram.Parameters[index + i][1] = (GLfloat) params[1];
- ctx->VertexProgram.Parameters[index + i][2] = (GLfloat) params[2];
- ctx->VertexProgram.Parameters[index + i][3] = (GLfloat) params[3];
- params += 4;
- };
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameters4dvNV");
- return;
- }
-}
-
-
-/**
- * Set a sequence of program parameter registers.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_ProgramParameters4fvNV(GLenum target, GLuint index,
- GLsizei num, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) {
- GLint i;
- if (index + num > MAX_NV_VERTEX_PROGRAM_PARAMS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameters4fvNV");
- return;
- }
- for (i = 0; i < num; i++) {
- COPY_4V(ctx->VertexProgram.Parameters[index + i], params);
- params += 4;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameters4fvNV");
- return;
- }
-}
-
-
-
-/**
- * Setup tracking of matrices into program parameter registers.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_TrackMatrixNV(GLenum target, GLuint address,
- GLenum matrix, GLenum transform)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
-
- if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) {
- if (address & 0x3) {
- /* addr must be multiple of four */
- _mesa_error(ctx, GL_INVALID_VALUE, "glTrackMatrixNV(address)");
- return;
- }
-
- switch (matrix) {
- case GL_NONE:
- case GL_MODELVIEW:
- case GL_PROJECTION:
- case GL_TEXTURE:
- case GL_COLOR:
- case GL_MODELVIEW_PROJECTION_NV:
- case GL_MATRIX0_NV:
- case GL_MATRIX1_NV:
- case GL_MATRIX2_NV:
- case GL_MATRIX3_NV:
- case GL_MATRIX4_NV:
- case GL_MATRIX5_NV:
- case GL_MATRIX6_NV:
- case GL_MATRIX7_NV:
- /* OK, fallthrough */
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(matrix)");
- return;
- }
-
- switch (transform) {
- case GL_IDENTITY_NV:
- case GL_INVERSE_NV:
- case GL_TRANSPOSE_NV:
- case GL_INVERSE_TRANSPOSE_NV:
- /* OK, fallthrough */
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(transform)");
- return;
- }
-
- ctx->VertexProgram.TrackMatrix[address / 4] = matrix;
- ctx->VertexProgram.TrackMatrixTransform[address / 4] = transform;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(target)");
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- struct gl_program *prog;
- struct gl_fragment_program *fragProg;
- GLfloat *v;
-
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
-
- prog = _mesa_lookup_program(ctx, id);
- if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramNamedParameterNV");
- return;
- }
-
- if (len <= 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glProgramNamedParameterNV(len)");
- return;
- }
-
- fragProg = (struct gl_fragment_program *) prog;
- v = _mesa_lookup_parameter_value(fragProg->Base.Parameters, len,
- (char *) name);
- if (v) {
- v[0] = x;
- v[1] = y;
- v[2] = z;
- v[3] = w;
- return;
- }
-
- _mesa_error(ctx, GL_INVALID_VALUE, "glProgramNamedParameterNV(name)");
-}
-
-
-void GLAPIENTRY
-_mesa_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name,
- const float v[])
-{
- _mesa_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]);
-}
-
-
-void GLAPIENTRY
-_mesa_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name,
- GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- _mesa_ProgramNamedParameter4fNV(id, len, name, (GLfloat)x, (GLfloat)y,
- (GLfloat)z, (GLfloat)w);
-}
-
-
-void GLAPIENTRY
-_mesa_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name,
- const double v[])
-{
- _mesa_ProgramNamedParameter4fNV(id, len, name,
- (GLfloat)v[0], (GLfloat)v[1],
- (GLfloat)v[2], (GLfloat)v[3]);
-}
-
-
-void GLAPIENTRY
-_mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name,
- GLfloat *params)
-{
- struct gl_program *prog;
- struct gl_fragment_program *fragProg;
- const GLfloat *v;
-
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- prog = _mesa_lookup_program(ctx, id);
- if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramNamedParameterNV");
- return;
- }
-
- if (len <= 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramNamedParameterNV");
- return;
- }
-
- fragProg = (struct gl_fragment_program *) prog;
- v = _mesa_lookup_parameter_value(fragProg->Base.Parameters,
- len, (char *) name);
- if (v) {
- params[0] = v[0];
- params[1] = v[1];
- params[2] = v[2];
- params[3] = v[3];
- return;
- }
-
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramNamedParameterNV");
-}
-
-
-void GLAPIENTRY
-_mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name,
- GLdouble *params)
-{
- GLfloat floatParams[4];
- _mesa_GetProgramNamedParameterfvNV(id, len, name, floatParams);
- COPY_4V(params, floatParams);
-}
diff --git a/src/mesa/main/nvprogram.h b/src/mesa/main/nvprogram.h
deleted file mode 100644
index 3a55783..0000000
--- a/src/mesa/main/nvprogram.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 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.
- *
- * Authors:
- * Brian Paul
- */
-
-
-#ifndef NVPROGRAM_H
-#define NVPROGRAM_H
-
-#include "glheader.h"
-
-struct gl_context;
-struct gl_program;
-
-extern void GLAPIENTRY
-_mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params);
-
-extern GLboolean GLAPIENTRY
-_mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, GLboolean *residences);
-
-extern void GLAPIENTRY
-_mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids);
-
-extern void GLAPIENTRY
-_mesa_GetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat *params);
-
-extern void GLAPIENTRY
-_mesa_GetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble *params);
-
-extern void GLAPIENTRY
-_mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program);
-
-extern void GLAPIENTRY
-_mesa_GetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params);
-
-extern void GLAPIENTRY
-_mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params);
-
-extern void GLAPIENTRY
-_mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer);
-
-extern void GLAPIENTRY
-_mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program);
-
-extern void GLAPIENTRY
-_mesa_ProgramParameters4dvNV(GLenum target, GLuint index, GLsizei num,
- const GLdouble *params);
-
-extern void GLAPIENTRY
-_mesa_ProgramParameters4fvNV(GLenum target, GLuint index, GLsizei num,
- const GLfloat *params);
-
-extern void GLAPIENTRY
-_mesa_TrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform);
-
-
-extern void GLAPIENTRY
-_mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-
-extern void GLAPIENTRY
-_mesa_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name,
- const float v[]);
-
-extern void GLAPIENTRY
-_mesa_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name,
- GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-
-extern void GLAPIENTRY
-_mesa_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name,
- const double v[]);
-
-extern void GLAPIENTRY
-_mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name,
- GLfloat *params);
-
-extern void GLAPIENTRY
-_mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name,
- GLdouble *params);
-
-extern void
-_mesa_setup_nv_temporary_count(struct gl_context *ctx, struct gl_program *program);
-
-extern void
-_mesa_emit_nv_temp_initialization(struct gl_context *ctx,
- struct gl_program *program);
-
-#endif
diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
deleted file mode 100644
index 6d524e6..0000000
--- a/src/mesa/main/pack.c
+++ /dev/null
@@ -1,5063 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 1999-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
- * THEA 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.
- */
-
-
-/**
- * \file pack.c
- * Image and pixel span packing and unpacking.
- */
-
-
-#include "glheader.h"
-#include "colormac.h"
-#include "enums.h"
-#include "image.h"
-#include "imports.h"
-#include "pack.h"
-#include "pixeltransfer.h"
-#include "imports.h"
-
-
-/**
- * NOTE:
- * Normally, BYTE_TO_FLOAT(0) returns 0.00392 That causes problems when
- * we later convert the float to a packed integer value (such as for
- * GL_RGB5_A1) because we'll wind up with a non-zero value.
- *
- * We redefine the macros here so zero is handled correctly.
- */
-#undef BYTE_TO_FLOAT
-#define BYTE_TO_FLOAT(B) ((B) == 0 ? 0.0F : ((2.0F * (B) + 1.0F) * (1.0F/255.0F)))
-
-#undef SHORT_TO_FLOAT
-#define SHORT_TO_FLOAT(S) ((S) == 0 ? 0.0F : ((2.0F * (S) + 1.0F) * (1.0F/65535.0F)))
-
-
-
-/** Compute ceiling of integer quotient of A divided by B. */
-#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
-
-
-/**
- * Flip the 8 bits in each byte of the given array.
- *
- * \param p array.
- * \param n number of bytes.
- *
- * \todo try this trick to flip bytes someday:
- * \code
- * v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555);
- * v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333);
- * v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f);
- * \endcode
- */
-static void
-flip_bytes( GLubyte *p, GLuint n )
-{
- GLuint i, a, b;
- for (i = 0; i < n; i++) {
- b = (GLuint) p[i]; /* words are often faster than bytes */
- a = ((b & 0x01) << 7) |
- ((b & 0x02) << 5) |
- ((b & 0x04) << 3) |
- ((b & 0x08) << 1) |
- ((b & 0x10) >> 1) |
- ((b & 0x20) >> 3) |
- ((b & 0x40) >> 5) |
- ((b & 0x80) >> 7);
- p[i] = (GLubyte) a;
- }
-}
-
-
-
-/*
- * Unpack a 32x32 pixel polygon stipple from user memory using the
- * current pixel unpack settings.
- */
-void
-_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
- const struct gl_pixelstore_attrib *unpacking )
-{
- GLubyte *ptrn = (GLubyte *) _mesa_unpack_bitmap(32, 32, pattern, unpacking);
- if (ptrn) {
- /* Convert pattern from GLubytes to GLuints and handle big/little
- * endian differences
- */
- GLubyte *p = ptrn;
- GLint i;
- for (i = 0; i < 32; i++) {
- dest[i] = (p[0] << 24)
- | (p[1] << 16)
- | (p[2] << 8)
- | (p[3] );
- p += 4;
- }
- free(ptrn);
- }
-}
-
-
-/*
- * Pack polygon stipple into user memory given current pixel packing
- * settings.
- */
-void
-_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest,
- const struct gl_pixelstore_attrib *packing )
-{
- /* Convert pattern from GLuints to GLubytes to handle big/little
- * endian differences.
- */
- GLubyte ptrn[32*4];
- GLint i;
- for (i = 0; i < 32; i++) {
- ptrn[i * 4 + 0] = (GLubyte) ((pattern[i] >> 24) & 0xff);
- ptrn[i * 4 + 1] = (GLubyte) ((pattern[i] >> 16) & 0xff);
- ptrn[i * 4 + 2] = (GLubyte) ((pattern[i] >> 8 ) & 0xff);
- ptrn[i * 4 + 3] = (GLubyte) ((pattern[i] ) & 0xff);
- }
-
- _mesa_pack_bitmap(32, 32, ptrn, dest, packing);
-}
-
-
-/*
- * Unpack bitmap data. Resulting data will be in most-significant-bit-first
- * order with row alignment = 1 byte.
- */
-GLvoid *
-_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
- const struct gl_pixelstore_attrib *packing )
-{
- GLint bytes, row, width_in_bytes;
- GLubyte *buffer, *dst;
-
- if (!pixels)
- return NULL;
-
- /* Alloc dest storage */
- bytes = ((width + 7) / 8 * height);
- buffer = (GLubyte *) malloc( bytes );
- if (!buffer)
- return NULL;
-
- width_in_bytes = CEILING( width, 8 );
- dst = buffer;
- for (row = 0; row < height; row++) {
- const GLubyte *src = (const GLubyte *)
- _mesa_image_address2d(packing, pixels, width, height,
- GL_COLOR_INDEX, GL_BITMAP, row, 0);
- if (!src) {
- free(buffer);
- return NULL;
- }
-
- if ((packing->SkipPixels & 7) == 0) {
- memcpy( dst, src, width_in_bytes );
- if (packing->LsbFirst) {
- flip_bytes( dst, width_in_bytes );
- }
- }
- else {
- /* handling SkipPixels is a bit tricky (no pun intended!) */
- GLint i;
- if (packing->LsbFirst) {
- GLubyte srcMask = 1 << (packing->SkipPixels & 0x7);
- GLubyte dstMask = 128;
- const GLubyte *s = src;
- GLubyte *d = dst;
- *d = 0;
- for (i = 0; i < width; i++) {
- if (*s & srcMask) {
- *d |= dstMask;
- }
- if (srcMask == 128) {
- srcMask = 1;
- s++;
- }
- else {
- srcMask = srcMask << 1;
- }
- if (dstMask == 1) {
- dstMask = 128;
- d++;
- *d = 0;
- }
- else {
- dstMask = dstMask >> 1;
- }
- }
- }
- else {
- GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7);
- GLubyte dstMask = 128;
- const GLubyte *s = src;
- GLubyte *d = dst;
- *d = 0;
- for (i = 0; i < width; i++) {
- if (*s & srcMask) {
- *d |= dstMask;
- }
- if (srcMask == 1) {
- srcMask = 128;
- s++;
- }
- else {
- srcMask = srcMask >> 1;
- }
- if (dstMask == 1) {
- dstMask = 128;
- d++;
- *d = 0;
- }
- else {
- dstMask = dstMask >> 1;
- }
- }
- }
- }
- dst += width_in_bytes;
- }
-
- return buffer;
-}
-
-
-/*
- * Pack bitmap data.
- */
-void
-_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
- GLubyte *dest, const struct gl_pixelstore_attrib *packing )
-{
- GLint row, width_in_bytes;
- const GLubyte *src;
-
- if (!source)
- return;
-
- width_in_bytes = CEILING( width, 8 );
- src = source;
- for (row = 0; row < height; row++) {
- GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing, dest,
- width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0);
- if (!dst)
- return;
-
- if ((packing->SkipPixels & 7) == 0) {
- memcpy( dst, src, width_in_bytes );
- if (packing->LsbFirst) {
- flip_bytes( dst, width_in_bytes );
- }
- }
- else {
- /* handling SkipPixels is a bit tricky (no pun intended!) */
- GLint i;
- if (packing->LsbFirst) {
- GLubyte srcMask = 128;
- GLubyte dstMask = 1 << (packing->SkipPixels & 0x7);
- const GLubyte *s = src;
- GLubyte *d = dst;
- *d = 0;
- for (i = 0; i < width; i++) {
- if (*s & srcMask) {
- *d |= dstMask;
- }
- if (srcMask == 1) {
- srcMask = 128;
- s++;
- }
- else {
- srcMask = srcMask >> 1;
- }
- if (dstMask == 128) {
- dstMask = 1;
- d++;
- *d = 0;
- }
- else {
- dstMask = dstMask << 1;
- }
- }
- }
- else {
- GLubyte srcMask = 128;
- GLubyte dstMask = 128 >> (packing->SkipPixels & 0x7);
- const GLubyte *s = src;
- GLubyte *d = dst;
- *d = 0;
- for (i = 0; i < width; i++) {
- if (*s & srcMask) {
- *d |= dstMask;
- }
- if (srcMask == 1) {
- srcMask = 128;
- s++;
- }
- else {
- srcMask = srcMask >> 1;
- }
- if (dstMask == 1) {
- dstMask = 128;
- d++;
- *d = 0;
- }
- else {
- dstMask = dstMask >> 1;
- }
- }
- }
- }
- src += width_in_bytes;
- }
-}
-
-
-/**
- * Get indexes of color components for a basic color format, such as
- * GL_RGBA, GL_RED, GL_LUMINANCE_ALPHA, etc. Return -1 for indexes
- * that do not apply.
- */
-static void
-get_component_indexes(GLenum format,
- GLint *redIndex,
- GLint *greenIndex,
- GLint *blueIndex,
- GLint *alphaIndex,
- GLint *luminanceIndex,
- GLint *intensityIndex)
-{
- *redIndex = -1;
- *greenIndex = -1;
- *blueIndex = -1;
- *alphaIndex = -1;
- *luminanceIndex = -1;
- *intensityIndex = -1;
-
- switch (format) {
- case GL_LUMINANCE:
- case GL_LUMINANCE_INTEGER_EXT:
- *luminanceIndex = 0;
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- *luminanceIndex = 0;
- *alphaIndex = 1;
- break;
- case GL_INTENSITY:
- *intensityIndex = 0;
- break;
- case GL_RED:
- case GL_RED_INTEGER_EXT:
- *redIndex = 0;
- break;
- case GL_GREEN:
- case GL_GREEN_INTEGER_EXT:
- *greenIndex = 0;
- break;
- case GL_BLUE:
- case GL_BLUE_INTEGER_EXT:
- *blueIndex = 0;
- break;
- case GL_ALPHA:
- case GL_ALPHA_INTEGER_EXT:
- *alphaIndex = 0;
- break;
- case GL_RG:
- case GL_RG_INTEGER:
- *redIndex = 0;
- *greenIndex = 1;
- break;
- case GL_RGB:
- case GL_RGB_INTEGER_EXT:
- *redIndex = 0;
- *greenIndex = 1;
- *blueIndex = 2;
- break;
- case GL_BGR:
- case GL_BGR_INTEGER_EXT:
- *blueIndex = 0;
- *greenIndex = 1;
- *redIndex = 2;
- break;
- case GL_RGBA:
- case GL_RGBA_INTEGER_EXT:
- *redIndex = 0;
- *greenIndex = 1;
- *blueIndex = 2;
- *alphaIndex = 3;
- break;
- case GL_BGRA:
- case GL_BGRA_INTEGER:
- *redIndex = 2;
- *greenIndex = 1;
- *blueIndex = 0;
- *alphaIndex = 3;
- break;
- case GL_ABGR_EXT:
- *redIndex = 3;
- *greenIndex = 2;
- *blueIndex = 1;
- *alphaIndex = 0;
- break;
- case GL_DU8DV8_ATI:
- case GL_DUDV_ATI:
- *redIndex = 0;
- *greenIndex = 1;
- break;
- default:
- assert(0 && "bad format in get_component_indexes()");
- }
-}
-
-
-
-/**
- * For small integer types, return the min and max possible values.
- * Used for clamping floats to unscaled integer types.
- * \return GL_TRUE if type is handled, GL_FALSE otherwise.
- */
-static GLboolean
-get_type_min_max(GLenum type, GLfloat *min, GLfloat *max)
-{
- switch (type) {
- case GL_BYTE:
- *min = -128.0;
- *max = 127.0;
- return GL_TRUE;
- case GL_UNSIGNED_BYTE:
- *min = 0.0;
- *max = 255.0;
- return GL_TRUE;
- case GL_SHORT:
- *min = -32768.0;
- *max = 32767.0;
- return GL_TRUE;
- case GL_UNSIGNED_SHORT:
- *min = 0.0;
- *max = 65535.0;
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
-
-/**
- * Used to pack an array [][4] of RGBA float colors as specified
- * by the dstFormat, dstType and dstPacking. Used by glReadPixels.
- * Historically, the RGBA values were in [0,1] and rescaled to fit
- * into GLubytes, etc. But with new integer formats, the RGBA values
- * may have any value and we don't always rescale when converting to
- * integers.
- *
- * Note: the rgba values will be modified by this function when any pixel
- * transfer ops are enabled.
- */
-void
-_mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
- GLenum dstFormat, GLenum dstType,
- GLvoid *dstAddr,
- const struct gl_pixelstore_attrib *dstPacking,
- GLbitfield transferOps)
-{
- GLfloat *luminance;
- const GLint comps = _mesa_components_in_format(dstFormat);
- const GLboolean intDstFormat = _mesa_is_integer_format(dstFormat);
- GLuint i;
-
- if (dstFormat == GL_LUMINANCE ||
- dstFormat == GL_LUMINANCE_ALPHA ||
- dstFormat == GL_LUMINANCE_INTEGER_EXT ||
- dstFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT) {
- luminance = (GLfloat *) malloc(n * sizeof(GLfloat));
- if (!luminance) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
- return;
- }
- }
- else {
- luminance = NULL;
- }
-
- /* XXX
- * This test should probably go away. Have the caller set/clear the
- * IMAGE_CLAMP_BIT as needed.
- */
- if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
- if (!intDstFormat) {
- /* need to clamp to [0, 1] */
- transferOps |= IMAGE_CLAMP_BIT;
- }
- }
-
- if (transferOps) {
- _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgba);
- }
-
- /*
- * Component clamping (besides clamping to [0,1] in
- * _mesa_apply_rgba_transfer_ops()).
- */
- if (intDstFormat) {
- /* clamping to dest type's min/max values */
- GLfloat min, max;
- if (get_type_min_max(dstType, &min, &max)) {
- for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], min, max);
- rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], min, max);
- rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], min, max);
- rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], min, max);
- }
- }
- }
- else if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) {
- /* compute luminance values */
- if (transferOps & IMAGE_CLAMP_BIT) {
- for (i = 0; i < n; i++) {
- GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
- luminance[i] = CLAMP(sum, 0.0F, 1.0F);
- }
- }
- else {
- for (i = 0; i < n; i++) {
- luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
- }
- }
- }
-
- /*
- * Pack/store the pixels. Ugh! Lots of cases!!!
- */
- switch (dstType) {
- case GL_UNSIGNED_BYTE:
- {
- GLubyte *dst = (GLubyte *) dstAddr;
- switch (dstFormat) {
- case GL_RED:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
- break;
- case GL_GREEN:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
- break;
- case GL_BLUE:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_UBYTE(rgba[i][BCOMP]);
- break;
- case GL_ALPHA:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_UBYTE(rgba[i][ACOMP]);
- break;
- case GL_LUMINANCE:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_UBYTE(luminance[i]);
- break;
- case GL_LUMINANCE_ALPHA:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_UBYTE(luminance[i]);
- dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][ACOMP]);
- }
- break;
- case GL_RG:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
- }
- break;
- case GL_RGB:
- for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
- dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]);
- }
- break;
- case GL_RGBA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
- dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]);
- dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]);
- }
- break;
- case GL_BGR:
- for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]);
- dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
- }
- break;
- case GL_BGRA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]);
- dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
- dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]);
- }
- break;
- case GL_ABGR_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][ACOMP]);
- dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][BCOMP]);
- dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
- dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
- }
- break;
- case GL_RED_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLubyte) rgba[i][RCOMP];
- }
- break;
- case GL_GREEN_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLubyte) rgba[i][GCOMP];
- }
- break;
- case GL_BLUE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLubyte) rgba[i][BCOMP];
- }
- break;
- case GL_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLubyte) rgba[i][ACOMP];
- }
- break;
- case GL_RGB_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLubyte) rgba[i][RCOMP];
- dst[i*3+1] = (GLubyte) rgba[i][GCOMP];
- dst[i*3+2] = (GLubyte) rgba[i][BCOMP];
- }
- break;
- case GL_RGBA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLubyte) rgba[i][RCOMP];
- dst[i*4+1] = (GLubyte) rgba[i][GCOMP];
- dst[i*4+2] = (GLubyte) rgba[i][BCOMP];
- dst[i*4+3] = (GLubyte) rgba[i][ACOMP];
- }
- break;
- case GL_BGR_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLubyte) rgba[i][BCOMP];
- dst[i*3+1] = (GLubyte) rgba[i][GCOMP];
- dst[i*3+2] = (GLubyte) rgba[i][RCOMP];
- }
- break;
- case GL_BGRA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLubyte) rgba[i][BCOMP];
- dst[i*4+1] = (GLubyte) rgba[i][GCOMP];
- dst[i*4+2] = (GLubyte) rgba[i][RCOMP];
- dst[i*4+3] = (GLubyte) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*2+0] = (GLubyte) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- dst[i*2+1] = (GLubyte) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLubyte) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- }
- break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
- }
- break;
- default:
- _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
- }
- }
- break;
- case GL_BYTE:
- {
- GLbyte *dst = (GLbyte *) dstAddr;
- switch (dstFormat) {
- case GL_RED:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- break;
- case GL_GREEN:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- break;
- case GL_BLUE:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- break;
- case GL_ALPHA:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
- break;
- case GL_LUMINANCE:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(luminance[i]);
- break;
- case GL_LUMINANCE_ALPHA:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_BYTE(luminance[i]);
- dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
- }
- break;
- case GL_RG:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- }
- break;
- case GL_RGB:
- for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- }
- break;
- case GL_RGBA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
- }
- break;
- case GL_BGR:
- for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- }
- break;
- case GL_BGRA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
- }
- break;
- case GL_ABGR_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
- dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- }
- break;
- case GL_RED_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLbyte) rgba[i][RCOMP];
- }
- break;
- case GL_GREEN_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLbyte) rgba[i][GCOMP];
- }
- break;
- case GL_BLUE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLbyte) rgba[i][BCOMP];
- }
- break;
- case GL_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLbyte) rgba[i][ACOMP];
- }
- break;
- case GL_RGB_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLbyte) rgba[i][RCOMP];
- dst[i*3+1] = (GLbyte) rgba[i][GCOMP];
- dst[i*3+2] = (GLbyte) rgba[i][BCOMP];
- }
- break;
- case GL_RGBA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLbyte) rgba[i][RCOMP];
- dst[i*4+1] = (GLbyte) rgba[i][GCOMP];
- dst[i*4+2] = (GLbyte) rgba[i][BCOMP];
- dst[i*4+3] = (GLbyte) rgba[i][ACOMP];
- }
- break;
- case GL_BGR_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLbyte) rgba[i][BCOMP];
- dst[i*3+1] = (GLbyte) rgba[i][GCOMP];
- dst[i*3+2] = (GLbyte) rgba[i][RCOMP];
- }
- break;
- case GL_BGRA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLbyte) rgba[i][BCOMP];
- dst[i*4+1] = (GLbyte) rgba[i][GCOMP];
- dst[i*4+2] = (GLbyte) rgba[i][RCOMP];
- dst[i*4+3] = (GLbyte) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*2+0] = (GLbyte) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- dst[i*2+1] = (GLbyte) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLbyte) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- }
- break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- }
- break;
- default:
- _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
- }
- }
- break;
- case GL_UNSIGNED_SHORT:
- {
- GLushort *dst = (GLushort *) dstAddr;
- switch (dstFormat) {
- case GL_RED:
- for (i=0;i<n;i++)
- CLAMPED_FLOAT_TO_USHORT(dst[i], rgba[i][RCOMP]);
- break;
- case GL_GREEN:
- for (i=0;i<n;i++)
- CLAMPED_FLOAT_TO_USHORT(dst[i], rgba[i][GCOMP]);
- break;
- case GL_BLUE:
- for (i=0;i<n;i++)
- CLAMPED_FLOAT_TO_USHORT(dst[i], rgba[i][BCOMP]);
- break;
- case GL_ALPHA:
- for (i=0;i<n;i++)
- CLAMPED_FLOAT_TO_USHORT(dst[i], rgba[i][ACOMP]);
- break;
- case GL_LUMINANCE:
- for (i=0;i<n;i++)
- UNCLAMPED_FLOAT_TO_USHORT(dst[i], luminance[i]);
- break;
- case GL_LUMINANCE_ALPHA:
- for (i=0;i<n;i++) {
- UNCLAMPED_FLOAT_TO_USHORT(dst[i*2+0], luminance[i]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*2+1], rgba[i][ACOMP]);
- }
- break;
- case GL_RG:
- for (i=0;i<n;i++) {
- CLAMPED_FLOAT_TO_USHORT(dst[i*2+0], rgba[i][RCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*2+1], rgba[i][GCOMP]);
- }
- break;
- case GL_RGB:
- for (i=0;i<n;i++) {
- CLAMPED_FLOAT_TO_USHORT(dst[i*3+0], rgba[i][RCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*3+1], rgba[i][GCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*3+2], rgba[i][BCOMP]);
- }
- break;
- case GL_RGBA:
- for (i=0;i<n;i++) {
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+0], rgba[i][RCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+1], rgba[i][GCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+2], rgba[i][BCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+3], rgba[i][ACOMP]);
- }
- break;
- case GL_BGR:
- for (i=0;i<n;i++) {
- CLAMPED_FLOAT_TO_USHORT(dst[i*3+0], rgba[i][BCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*3+1], rgba[i][GCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*3+2], rgba[i][RCOMP]);
- }
- break;
- case GL_BGRA:
- for (i=0;i<n;i++) {
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+0], rgba[i][BCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+1], rgba[i][GCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+2], rgba[i][RCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+3], rgba[i][ACOMP]);
- }
- break;
- case GL_ABGR_EXT:
- for (i=0;i<n;i++) {
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+0], rgba[i][ACOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+1], rgba[i][BCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+2], rgba[i][GCOMP]);
- CLAMPED_FLOAT_TO_USHORT(dst[i*4+3], rgba[i][RCOMP]);
- }
- break;
- case GL_RED_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLushort) rgba[i][RCOMP];
- }
- break;
- case GL_GREEN_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLushort) rgba[i][GCOMP];
- }
- break;
- case GL_BLUE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLushort) rgba[i][BCOMP];
- }
- break;
- case GL_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLushort) rgba[i][ACOMP];
- }
- break;
- case GL_RGB_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLushort) rgba[i][RCOMP];
- dst[i*3+1] = (GLushort) rgba[i][GCOMP];
- dst[i*3+2] = (GLushort) rgba[i][BCOMP];
- }
- break;
- case GL_RGBA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLushort) rgba[i][RCOMP];
- dst[i*4+1] = (GLushort) rgba[i][GCOMP];
- dst[i*4+2] = (GLushort) rgba[i][BCOMP];
- dst[i*4+3] = (GLushort) rgba[i][ACOMP];
- }
- break;
- case GL_BGR_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLushort) rgba[i][BCOMP];
- dst[i*3+1] = (GLushort) rgba[i][GCOMP];
- dst[i*3+2] = (GLushort) rgba[i][RCOMP];
- }
- break;
- case GL_BGRA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLushort) rgba[i][BCOMP];
- dst[i*4+1] = (GLushort) rgba[i][GCOMP];
- dst[i*4+2] = (GLushort) rgba[i][RCOMP];
- dst[i*4+3] = (GLushort) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*2+0] = (GLushort) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- dst[i*2+1] = (GLushort) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLushort) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- }
- break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]);
- }
- break;
- default:
- _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
- }
- }
- break;
- case GL_SHORT:
- {
- GLshort *dst = (GLshort *) dstAddr;
- switch (dstFormat) {
- case GL_RED:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- break;
- case GL_GREEN:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- break;
- case GL_BLUE:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- break;
- case GL_ALPHA:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
- break;
- case GL_LUMINANCE:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(luminance[i]);
- break;
- case GL_LUMINANCE_ALPHA:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_SHORT(luminance[i]);
- dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
- }
- break;
- case GL_RG:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- }
- break;
- case GL_RGB:
- for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- }
- break;
- case GL_RGBA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
- }
- break;
- case GL_BGR:
- for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- }
- break;
- case GL_BGRA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
- }
- break;
- case GL_ABGR_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
- dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- }
- break;
- case GL_RED_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLshort) rgba[i][RCOMP];
- }
- break;
- case GL_GREEN_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLshort) rgba[i][GCOMP];
- }
- break;
- case GL_BLUE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLshort) rgba[i][BCOMP];
- }
- break;
- case GL_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLshort) rgba[i][ACOMP];
- }
- break;
- case GL_RGB_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLshort) rgba[i][RCOMP];
- dst[i*3+1] = (GLshort) rgba[i][GCOMP];
- dst[i*3+2] = (GLshort) rgba[i][BCOMP];
- }
- break;
- case GL_RGBA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLshort) rgba[i][RCOMP];
- dst[i*4+1] = (GLshort) rgba[i][GCOMP];
- dst[i*4+2] = (GLshort) rgba[i][BCOMP];
- dst[i*4+3] = (GLshort) rgba[i][ACOMP];
- }
- break;
- case GL_BGR_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLshort) rgba[i][BCOMP];
- dst[i*3+1] = (GLshort) rgba[i][GCOMP];
- dst[i*3+2] = (GLshort) rgba[i][RCOMP];
- }
- break;
- case GL_BGRA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLshort) rgba[i][BCOMP];
- dst[i*4+1] = (GLshort) rgba[i][GCOMP];
- dst[i*4+2] = (GLshort) rgba[i][RCOMP];
- dst[i*4+3] = (GLshort) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*2+0] = (GLshort) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- dst[i*2+1] = (GLshort) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLshort) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- }
- break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- }
- break;
- default:
- _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
- }
- }
- break;
- case GL_UNSIGNED_INT:
- {
- GLuint *dst = (GLuint *) dstAddr;
- switch (dstFormat) {
- case GL_RED:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_UINT(rgba[i][RCOMP]);
- break;
- case GL_GREEN:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_UINT(rgba[i][GCOMP]);
- break;
- case GL_BLUE:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_UINT(rgba[i][BCOMP]);
- break;
- case GL_ALPHA:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_UINT(rgba[i][ACOMP]);
- break;
- case GL_LUMINANCE:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_UINT(luminance[i]);
- break;
- case GL_LUMINANCE_ALPHA:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_UINT(luminance[i]);
- dst[i*2+1] = FLOAT_TO_UINT(rgba[i][ACOMP]);
- }
- break;
- case GL_RG:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_UINT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_UINT(rgba[i][GCOMP]);
- }
- break;
- case GL_RGB:
- for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_UINT(rgba[i][RCOMP]);
- dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_UINT(rgba[i][BCOMP]);
- }
- break;
- case GL_RGBA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_UINT(rgba[i][RCOMP]);
- dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_UINT(rgba[i][BCOMP]);
- dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]);
- }
- break;
- case GL_BGR:
- for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_UINT(rgba[i][BCOMP]);
- dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_UINT(rgba[i][RCOMP]);
- }
- break;
- case GL_BGRA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_UINT(rgba[i][BCOMP]);
- dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_UINT(rgba[i][RCOMP]);
- dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]);
- }
- break;
- case GL_ABGR_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_UINT(rgba[i][ACOMP]);
- dst[i*4+1] = FLOAT_TO_UINT(rgba[i][BCOMP]);
- dst[i*4+2] = FLOAT_TO_UINT(rgba[i][GCOMP]);
- dst[i*4+3] = FLOAT_TO_UINT(rgba[i][RCOMP]);
- }
- break;
- case GL_RED_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLuint) rgba[i][RCOMP];
- }
- break;
- case GL_GREEN_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLuint) rgba[i][GCOMP];
- }
- break;
- case GL_BLUE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLuint) rgba[i][BCOMP];
- }
- break;
- case GL_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLuint) rgba[i][ACOMP];
- }
- break;
- case GL_RGB_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLuint) rgba[i][RCOMP];
- dst[i*3+1] = (GLuint) rgba[i][GCOMP];
- dst[i*3+2] = (GLuint) rgba[i][BCOMP];
- }
- break;
- case GL_RGBA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLuint) rgba[i][RCOMP];
- dst[i*4+1] = (GLuint) rgba[i][GCOMP];
- dst[i*4+2] = (GLuint) rgba[i][BCOMP];
- dst[i*4+3] = (GLuint) rgba[i][ACOMP];
- }
- break;
- case GL_BGR_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLuint) rgba[i][BCOMP];
- dst[i*3+1] = (GLuint) rgba[i][GCOMP];
- dst[i*3+2] = (GLuint) rgba[i][RCOMP];
- }
- break;
- case GL_BGRA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLuint) rgba[i][BCOMP];
- dst[i*4+1] = (GLuint) rgba[i][GCOMP];
- dst[i*4+2] = (GLuint) rgba[i][RCOMP];
- dst[i*4+3] = (GLuint) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*2+0] = (GLuint) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- dst[i*2+1] = (GLuint) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLuint) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- }
- break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_UINT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_UINT(rgba[i][GCOMP]);
- }
- break;
- default:
- _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
- }
- }
- break;
- case GL_INT:
- {
- GLint *dst = (GLint *) dstAddr;
- switch (dstFormat) {
- case GL_RED:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_INT(rgba[i][RCOMP]);
- break;
- case GL_GREEN:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_INT(rgba[i][GCOMP]);
- break;
- case GL_BLUE:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_INT(rgba[i][BCOMP]);
- break;
- case GL_ALPHA:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_INT(rgba[i][ACOMP]);
- break;
- case GL_LUMINANCE:
- for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_INT(luminance[i]);
- break;
- case GL_LUMINANCE_ALPHA:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_INT(luminance[i]);
- dst[i*2+1] = FLOAT_TO_INT(rgba[i][ACOMP]);
- }
- break;
- case GL_RG:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_INT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_INT(rgba[i][GCOMP]);
- }
- break;
- case GL_RGB:
- for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_INT(rgba[i][RCOMP]);
- dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_INT(rgba[i][BCOMP]);
- }
- break;
- case GL_RGBA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_INT(rgba[i][RCOMP]);
- dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_INT(rgba[i][BCOMP]);
- dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]);
- }
- break;
- case GL_BGR:
- for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_INT(rgba[i][BCOMP]);
- dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_INT(rgba[i][RCOMP]);
- }
- break;
- case GL_BGRA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_INT(rgba[i][BCOMP]);
- dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_INT(rgba[i][RCOMP]);
- dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]);
- }
- break;
- case GL_ABGR_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_INT(rgba[i][ACOMP]);
- dst[i*4+1] = FLOAT_TO_INT(rgba[i][BCOMP]);
- dst[i*4+2] = FLOAT_TO_INT(rgba[i][GCOMP]);
- dst[i*4+3] = FLOAT_TO_INT(rgba[i][RCOMP]);
- }
- break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_INT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_INT(rgba[i][GCOMP]);
- }
- break;
- case GL_RED_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLint) rgba[i][RCOMP];
- }
- break;
- case GL_GREEN_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLint) rgba[i][GCOMP];
- }
- break;
- case GL_BLUE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLint) rgba[i][BCOMP];
- }
- break;
- case GL_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLint) rgba[i][ACOMP];
- }
- break;
- case GL_RGB_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLint) rgba[i][RCOMP];
- dst[i*3+1] = (GLint) rgba[i][GCOMP];
- dst[i*3+2] = (GLint) rgba[i][BCOMP];
- }
- break;
- case GL_RGBA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLint) rgba[i][RCOMP];
- dst[i*4+1] = (GLint) rgba[i][GCOMP];
- dst[i*4+2] = (GLint) rgba[i][BCOMP];
- dst[i*4+3] = (GLint) rgba[i][ACOMP];
- }
- break;
- case GL_BGR_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*3+0] = (GLint) rgba[i][BCOMP];
- dst[i*3+1] = (GLint) rgba[i][GCOMP];
- dst[i*3+2] = (GLint) rgba[i][RCOMP];
- }
- break;
- case GL_BGRA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = (GLint) rgba[i][BCOMP];
- dst[i*4+1] = (GLint) rgba[i][GCOMP];
- dst[i*4+2] = (GLint) rgba[i][RCOMP];
- dst[i*4+3] = (GLint) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i*2+0] = (GLint) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- dst[i*2+1] = (GLint) rgba[i][ACOMP];
- }
- break;
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- for (i=0;i<n;i++) {
- dst[i] = (GLint) (rgba[i][RCOMP] +
- rgba[i][GCOMP] +
- rgba[i][BCOMP]);
- }
- break;
- default:
- _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
- }
- }
- break;
- case GL_FLOAT:
- {
- GLfloat *dst = (GLfloat *) dstAddr;
- switch (dstFormat) {
- case GL_RED:
- for (i=0;i<n;i++)
- dst[i] = rgba[i][RCOMP];
- break;
- case GL_GREEN:
- for (i=0;i<n;i++)
- dst[i] = rgba[i][GCOMP];
- break;
- case GL_BLUE:
- for (i=0;i<n;i++)
- dst[i] = rgba[i][BCOMP];
- break;
- case GL_ALPHA:
- for (i=0;i<n;i++)
- dst[i] = rgba[i][ACOMP];
- break;
- case GL_LUMINANCE:
- for (i=0;i<n;i++)
- dst[i] = luminance[i];
- break;
- case GL_LUMINANCE_ALPHA:
- for (i=0;i<n;i++) {
- dst[i*2+0] = luminance[i];
- dst[i*2+1] = rgba[i][ACOMP];
- }
- break;
- case GL_RG:
- for (i=0;i<n;i++) {
- dst[i*2+0] = rgba[i][RCOMP];
- dst[i*2+1] = rgba[i][GCOMP];
- }
- break;
- case GL_RGB:
- for (i=0;i<n;i++) {
- dst[i*3+0] = rgba[i][RCOMP];
- dst[i*3+1] = rgba[i][GCOMP];
- dst[i*3+2] = rgba[i][BCOMP];
- }
- break;
- case GL_RGBA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = rgba[i][RCOMP];
- dst[i*4+1] = rgba[i][GCOMP];
- dst[i*4+2] = rgba[i][BCOMP];
- dst[i*4+3] = rgba[i][ACOMP];
- }
- break;
- case GL_BGR:
- for (i=0;i<n;i++) {
- dst[i*3+0] = rgba[i][BCOMP];
- dst[i*3+1] = rgba[i][GCOMP];
- dst[i*3+2] = rgba[i][RCOMP];
- }
- break;
- case GL_BGRA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = rgba[i][BCOMP];
- dst[i*4+1] = rgba[i][GCOMP];
- dst[i*4+2] = rgba[i][RCOMP];
- dst[i*4+3] = rgba[i][ACOMP];
- }
- break;
- case GL_ABGR_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = rgba[i][ACOMP];
- dst[i*4+1] = rgba[i][BCOMP];
- dst[i*4+2] = rgba[i][GCOMP];
- dst[i*4+3] = rgba[i][RCOMP];
- }
- break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = rgba[i][RCOMP];
- dst[i*2+1] = rgba[i][GCOMP];
- }
- break;
- default:
- _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
- }
- }
- break;
- case GL_HALF_FLOAT_ARB:
- {
- GLhalfARB *dst = (GLhalfARB *) dstAddr;
- switch (dstFormat) {
- case GL_RED:
- for (i=0;i<n;i++)
- dst[i] = _mesa_float_to_half(rgba[i][RCOMP]);
- break;
- case GL_GREEN:
- for (i=0;i<n;i++)
- dst[i] = _mesa_float_to_half(rgba[i][GCOMP]);
- break;
- case GL_BLUE:
- for (i=0;i<n;i++)
- dst[i] = _mesa_float_to_half(rgba[i][BCOMP]);
- break;
- case GL_ALPHA:
- for (i=0;i<n;i++)
- dst[i] = _mesa_float_to_half(rgba[i][ACOMP]);
- break;
- case GL_LUMINANCE:
- for (i=0;i<n;i++)
- dst[i] = _mesa_float_to_half(luminance[i]);
- break;
- case GL_LUMINANCE_ALPHA:
- for (i=0;i<n;i++) {
- dst[i*2+0] = _mesa_float_to_half(luminance[i]);
- dst[i*2+1] = _mesa_float_to_half(rgba[i][ACOMP]);
- }
- break;
- case GL_RG:
- for (i=0;i<n;i++) {
- dst[i*2+0] = _mesa_float_to_half(rgba[i][RCOMP]);
- dst[i*2+1] = _mesa_float_to_half(rgba[i][GCOMP]);
- }
- break;
- case GL_RGB:
- for (i=0;i<n;i++) {
- dst[i*3+0] = _mesa_float_to_half(rgba[i][RCOMP]);
- dst[i*3+1] = _mesa_float_to_half(rgba[i][GCOMP]);
- dst[i*3+2] = _mesa_float_to_half(rgba[i][BCOMP]);
- }
- break;
- case GL_RGBA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = _mesa_float_to_half(rgba[i][RCOMP]);
- dst[i*4+1] = _mesa_float_to_half(rgba[i][GCOMP]);
- dst[i*4+2] = _mesa_float_to_half(rgba[i][BCOMP]);
- dst[i*4+3] = _mesa_float_to_half(rgba[i][ACOMP]);
- }
- break;
- case GL_BGR:
- for (i=0;i<n;i++) {
- dst[i*3+0] = _mesa_float_to_half(rgba[i][BCOMP]);
- dst[i*3+1] = _mesa_float_to_half(rgba[i][GCOMP]);
- dst[i*3+2] = _mesa_float_to_half(rgba[i][RCOMP]);
- }
- break;
- case GL_BGRA:
- for (i=0;i<n;i++) {
- dst[i*4+0] = _mesa_float_to_half(rgba[i][BCOMP]);
- dst[i*4+1] = _mesa_float_to_half(rgba[i][GCOMP]);
- dst[i*4+2] = _mesa_float_to_half(rgba[i][RCOMP]);
- dst[i*4+3] = _mesa_float_to_half(rgba[i][ACOMP]);
- }
- break;
- case GL_ABGR_EXT:
- for (i=0;i<n;i++) {
- dst[i*4+0] = _mesa_float_to_half(rgba[i][ACOMP]);
- dst[i*4+1] = _mesa_float_to_half(rgba[i][BCOMP]);
- dst[i*4+2] = _mesa_float_to_half(rgba[i][GCOMP]);
- dst[i*4+3] = _mesa_float_to_half(rgba[i][RCOMP]);
- }
- break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = _mesa_float_to_half(rgba[i][RCOMP]);
- dst[i*2+1] = _mesa_float_to_half(rgba[i][GCOMP]);
- }
- break;
- default:
- _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
- }
- }
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- if (dstFormat == GL_RGB) {
- GLubyte *dst = (GLubyte *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 7.0F) << 5)
- | (IROUND(rgba[i][GCOMP] * 7.0F) << 2)
- | (IROUND(rgba[i][BCOMP] * 3.0F) );
- }
- }
- break;
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- if (dstFormat == GL_RGB) {
- GLubyte *dst = (GLubyte *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 7.0F) )
- | (IROUND(rgba[i][GCOMP] * 7.0F) << 3)
- | (IROUND(rgba[i][BCOMP] * 3.0F) << 6);
- }
- }
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- if (dstFormat == GL_RGB) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F) << 11)
- | (IROUND(rgba[i][GCOMP] * 63.0F) << 5)
- | (IROUND(rgba[i][BCOMP] * 31.0F) );
- }
- }
- break;
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- if (dstFormat == GL_RGB) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F) )
- | (IROUND(rgba[i][GCOMP] * 63.0F) << 5)
- | (IROUND(rgba[i][BCOMP] * 31.0F) << 11);
- }
- }
- break;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- if (dstFormat == GL_RGBA) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 15.0F) << 12)
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][BCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][ACOMP] * 15.0F) );
- }
- }
- else if (dstFormat == GL_BGRA) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 15.0F) << 12)
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][RCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][ACOMP] * 15.0F) );
- }
- }
- else if (dstFormat == GL_ABGR_EXT) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 15.0F) << 12)
- | (IROUND(rgba[i][BCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][RCOMP] * 15.0F) );
- }
- }
- break;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- if (dstFormat == GL_RGBA) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 15.0F) )
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][BCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][ACOMP] * 15.0F) << 12);
- }
- }
- else if (dstFormat == GL_BGRA) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 15.0F) )
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][RCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][ACOMP] * 15.0F) << 12);
- }
- }
- else if (dstFormat == GL_ABGR_EXT) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 15.0F) )
- | (IROUND(rgba[i][BCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][RCOMP] * 15.0F) << 12);
- }
- }
- break;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- if (dstFormat == GL_RGBA) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F) << 11)
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 6)
- | (IROUND(rgba[i][BCOMP] * 31.0F) << 1)
- | (IROUND(rgba[i][ACOMP] * 1.0F) );
- }
- }
- else if (dstFormat == GL_BGRA) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 31.0F) << 11)
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 6)
- | (IROUND(rgba[i][RCOMP] * 31.0F) << 1)
- | (IROUND(rgba[i][ACOMP] * 1.0F) );
- }
- }
- else if (dstFormat == GL_ABGR_EXT) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 31.0F) << 11)
- | (IROUND(rgba[i][BCOMP] * 31.0F) << 6)
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 1)
- | (IROUND(rgba[i][RCOMP] * 1.0F) );
- }
- }
- break;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- if (dstFormat == GL_RGBA) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F) )
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 5)
- | (IROUND(rgba[i][BCOMP] * 31.0F) << 10)
- | (IROUND(rgba[i][ACOMP] * 1.0F) << 15);
- }
- }
- else if (dstFormat == GL_BGRA) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 31.0F) )
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 5)
- | (IROUND(rgba[i][RCOMP] * 31.0F) << 10)
- | (IROUND(rgba[i][ACOMP] * 1.0F) << 15);
- }
- }
- else if (dstFormat == GL_ABGR_EXT) {
- GLushort *dst = (GLushort *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 31.0F) )
- | (IROUND(rgba[i][BCOMP] * 31.0F) << 5)
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 10)
- | (IROUND(rgba[i][RCOMP] * 1.0F) << 15);
- }
- }
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- if (dstFormat == GL_RGBA) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 255.F) << 24)
- | (IROUND(rgba[i][GCOMP] * 255.F) << 16)
- | (IROUND(rgba[i][BCOMP] * 255.F) << 8)
- | (IROUND(rgba[i][ACOMP] * 255.F) );
- }
- }
- else if (dstFormat == GL_BGRA) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 255.F) << 24)
- | (IROUND(rgba[i][GCOMP] * 255.F) << 16)
- | (IROUND(rgba[i][RCOMP] * 255.F) << 8)
- | (IROUND(rgba[i][ACOMP] * 255.F) );
- }
- }
- else if (dstFormat == GL_ABGR_EXT) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 255.F) << 24)
- | (IROUND(rgba[i][BCOMP] * 255.F) << 16)
- | (IROUND(rgba[i][GCOMP] * 255.F) << 8)
- | (IROUND(rgba[i][RCOMP] * 255.F) );
- }
- }
- break;
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- if (dstFormat == GL_RGBA) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 255.0F) )
- | (IROUND(rgba[i][GCOMP] * 255.0F) << 8)
- | (IROUND(rgba[i][BCOMP] * 255.0F) << 16)
- | (IROUND(rgba[i][ACOMP] * 255.0F) << 24);
- }
- }
- else if (dstFormat == GL_BGRA) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 255.0F) )
- | (IROUND(rgba[i][GCOMP] * 255.0F) << 8)
- | (IROUND(rgba[i][RCOMP] * 255.0F) << 16)
- | (IROUND(rgba[i][ACOMP] * 255.0F) << 24);
- }
- }
- else if (dstFormat == GL_ABGR_EXT) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 255.0F) )
- | (IROUND(rgba[i][BCOMP] * 255.0F) << 8)
- | (IROUND(rgba[i][GCOMP] * 255.0F) << 16)
- | (IROUND(rgba[i][RCOMP] * 255.0F) << 24);
- }
- }
- break;
- case GL_UNSIGNED_INT_10_10_10_2:
- if (dstFormat == GL_RGBA) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 1023.0F) << 22)
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 12)
- | (IROUND(rgba[i][BCOMP] * 1023.0F) << 2)
- | (IROUND(rgba[i][ACOMP] * 3.0F) );
- }
- }
- else if (dstFormat == GL_BGRA) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 1023.0F) << 22)
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 12)
- | (IROUND(rgba[i][RCOMP] * 1023.0F) << 2)
- | (IROUND(rgba[i][ACOMP] * 3.0F) );
- }
- }
- else if (dstFormat == GL_ABGR_EXT) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 1023.0F) << 22)
- | (IROUND(rgba[i][BCOMP] * 1023.0F) << 12)
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 2)
- | (IROUND(rgba[i][RCOMP] * 3.0F) );
- }
- }
- break;
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- if (dstFormat == GL_RGBA) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 1023.0F) )
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 10)
- | (IROUND(rgba[i][BCOMP] * 1023.0F) << 20)
- | (IROUND(rgba[i][ACOMP] * 3.0F) << 30);
- }
- }
- else if (dstFormat == GL_BGRA) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 1023.0F) )
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 10)
- | (IROUND(rgba[i][RCOMP] * 1023.0F) << 20)
- | (IROUND(rgba[i][ACOMP] * 3.0F) << 30);
- }
- }
- else if (dstFormat == GL_ABGR_EXT) {
- GLuint *dst = (GLuint *) dstAddr;
- for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 1023.0F) )
- | (IROUND(rgba[i][BCOMP] * 1023.0F) << 10)
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 20)
- | (IROUND(rgba[i][RCOMP] * 3.0F) << 30);
- }
- }
- break;
- default:
- _mesa_problem(ctx, "bad type in _mesa_pack_rgba_span_float");
- return;
- }
-
- if (dstPacking->SwapBytes) {
- GLint swapSize = _mesa_sizeof_packed_type(dstType);
- if (swapSize == 2) {
- if (dstPacking->SwapBytes) {
- _mesa_swap2((GLushort *) dstAddr, n * comps);
- }
- }
- else if (swapSize == 4) {
- if (dstPacking->SwapBytes) {
- _mesa_swap4((GLuint *) dstAddr, n * comps);
- }
- }
- }
-
- free(luminance);
-}
-
-
-
-#define SWAP2BYTE(VALUE) \
- { \
- GLubyte *bytes = (GLubyte *) &(VALUE); \
- GLubyte tmp = bytes[0]; \
- bytes[0] = bytes[1]; \
- bytes[1] = tmp; \
- }
-
-#define SWAP4BYTE(VALUE) \
- { \
- GLubyte *bytes = (GLubyte *) &(VALUE); \
- GLubyte tmp = bytes[0]; \
- bytes[0] = bytes[3]; \
- bytes[3] = tmp; \
- tmp = bytes[1]; \
- bytes[1] = bytes[2]; \
- bytes[2] = tmp; \
- }
-
-
-static void
-extract_uint_indexes(GLuint n, GLuint indexes[],
- GLenum srcFormat, GLenum srcType, const GLvoid *src,
- const struct gl_pixelstore_attrib *unpack )
-{
- ASSERT(srcFormat == GL_COLOR_INDEX || srcFormat == GL_STENCIL_INDEX);
-
- ASSERT(srcType == GL_BITMAP ||
- srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_BYTE ||
- srcType == GL_UNSIGNED_SHORT ||
- srcType == GL_SHORT ||
- srcType == GL_UNSIGNED_INT ||
- srcType == GL_INT ||
- srcType == GL_UNSIGNED_INT_24_8_EXT ||
- srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT);
-
- switch (srcType) {
- case GL_BITMAP:
- {
- GLubyte *ubsrc = (GLubyte *) src;
- if (unpack->LsbFirst) {
- GLubyte mask = 1 << (unpack->SkipPixels & 0x7);
- GLuint i;
- for (i = 0; i < n; i++) {
- indexes[i] = (*ubsrc & mask) ? 1 : 0;
- if (mask == 128) {
- mask = 1;
- ubsrc++;
- }
- else {
- mask = mask << 1;
- }
- }
- }
- else {
- GLubyte mask = 128 >> (unpack->SkipPixels & 0x7);
- GLuint i;
- for (i = 0; i < n; i++) {
- indexes[i] = (*ubsrc & mask) ? 1 : 0;
- if (mask == 1) {
- mask = 128;
- ubsrc++;
- }
- else {
- mask = mask >> 1;
- }
- }
- }
- }
- break;
- case GL_UNSIGNED_BYTE:
- {
- GLuint i;
- const GLubyte *s = (const GLubyte *) src;
- for (i = 0; i < n; i++)
- indexes[i] = s[i];
- }
- break;
- case GL_BYTE:
- {
- GLuint i;
- const GLbyte *s = (const GLbyte *) src;
- for (i = 0; i < n; i++)
- indexes[i] = s[i];
- }
- break;
- case GL_UNSIGNED_SHORT:
- {
- GLuint i;
- const GLushort *s = (const GLushort *) src;
- if (unpack->SwapBytes) {
- for (i = 0; i < n; i++) {
- GLushort value = s[i];
- SWAP2BYTE(value);
- indexes[i] = value;
- }
- }
- else {
- for (i = 0; i < n; i++)
- indexes[i] = s[i];
- }
- }
- break;
- case GL_SHORT:
- {
- GLuint i;
- const GLshort *s = (const GLshort *) src;
- if (unpack->SwapBytes) {
- for (i = 0; i < n; i++) {
- GLshort value = s[i];
- SWAP2BYTE(value);
- indexes[i] = value;
- }
- }
- else {
- for (i = 0; i < n; i++)
- indexes[i] = s[i];
- }
- }
- break;
- case GL_UNSIGNED_INT:
- {
- GLuint i;
- const GLuint *s = (const GLuint *) src;
- if (unpack->SwapBytes) {
- for (i = 0; i < n; i++) {
- GLuint value = s[i];
- SWAP4BYTE(value);
- indexes[i] = value;
- }
- }
- else {
- for (i = 0; i < n; i++)
- indexes[i] = s[i];
- }
- }
- break;
- case GL_INT:
- {
- GLuint i;
- const GLint *s = (const GLint *) src;
- if (unpack->SwapBytes) {
- for (i = 0; i < n; i++) {
- GLint value = s[i];
- SWAP4BYTE(value);
- indexes[i] = value;
- }
- }
- else {
- for (i = 0; i < n; i++)
- indexes[i] = s[i];
- }
- }
- break;
- case GL_FLOAT:
- {
- GLuint i;
- const GLfloat *s = (const GLfloat *) src;
- if (unpack->SwapBytes) {
- for (i = 0; i < n; i++) {
- GLfloat value = s[i];
- SWAP4BYTE(value);
- indexes[i] = (GLuint) value;
- }
- }
- else {
- for (i = 0; i < n; i++)
- indexes[i] = (GLuint) s[i];
- }
- }
- break;
- case GL_HALF_FLOAT_ARB:
- {
- GLuint i;
- const GLhalfARB *s = (const GLhalfARB *) src;
- if (unpack->SwapBytes) {
- for (i = 0; i < n; i++) {
- GLhalfARB value = s[i];
- SWAP2BYTE(value);
- indexes[i] = (GLuint) _mesa_half_to_float(value);
- }
- }
- else {
- for (i = 0; i < n; i++)
- indexes[i] = (GLuint) _mesa_half_to_float(s[i]);
- }
- }
- break;
- case GL_UNSIGNED_INT_24_8_EXT:
- {
- GLuint i;
- const GLuint *s = (const GLuint *) src;
- if (unpack->SwapBytes) {
- for (i = 0; i < n; i++) {
- GLuint value = s[i];
- SWAP4BYTE(value);
- indexes[i] = value & 0xff; /* lower 8 bits */
- }
- }
- else {
- for (i = 0; i < n; i++)
- indexes[i] = s[i] & 0xff; /* lower 8 bits */
- }
- }
- break;
-
- default:
- _mesa_problem(NULL, "bad srcType in extract_uint_indexes");
- return;
- }
-}
-
-
-/**
- * Return source/dest RGBA indexes for unpacking pixels.
- */
-static void
-get_component_mapping(GLenum format,
- GLint *rSrc,
- GLint *gSrc,
- GLint *bSrc,
- GLint *aSrc,
- GLint *rDst,
- GLint *gDst,
- GLint *bDst,
- GLint *aDst)
-{
- switch (format) {
- case GL_RED:
- case GL_RED_INTEGER_EXT:
- *rSrc = 0;
- *gSrc = *bSrc = *aSrc = -1;
- break;
- case GL_GREEN:
- case GL_GREEN_INTEGER_EXT:
- *gSrc = 0;
- *rSrc = *bSrc = *aSrc = -1;
- break;
- case GL_BLUE:
- case GL_BLUE_INTEGER_EXT:
- *bSrc = 0;
- *rSrc = *gSrc = *aSrc = -1;
- break;
- case GL_ALPHA:
- case GL_ALPHA_INTEGER_EXT:
- *rSrc = *gSrc = *bSrc = -1;
- *aSrc = 0;
- break;
- case GL_LUMINANCE:
- case GL_LUMINANCE_INTEGER_EXT:
- *rSrc = *gSrc = *bSrc = 0;
- *aSrc = -1;
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- *rSrc = *gSrc = *bSrc = 0;
- *aSrc = 1;
- break;
- case GL_INTENSITY:
- *rSrc = *gSrc = *bSrc = *aSrc = 0;
- break;
- case GL_RG:
- case GL_RG_INTEGER:
- *rSrc = 0;
- *gSrc = 1;
- *bSrc = -1;
- *aSrc = -1;
- *rDst = 0;
- *gDst = 1;
- *bDst = 2;
- *aDst = 3;
- break;
- case GL_RGB:
- case GL_RGB_INTEGER:
- *rSrc = 0;
- *gSrc = 1;
- *bSrc = 2;
- *aSrc = -1;
- *rDst = 0;
- *gDst = 1;
- *bDst = 2;
- *aDst = 3;
- break;
- case GL_BGR:
- *rSrc = 2;
- *gSrc = 1;
- *bSrc = 0;
- *aSrc = -1;
- *rDst = 2;
- *gDst = 1;
- *bDst = 0;
- *aDst = 3;
- break;
- case GL_RGBA:
- case GL_RGBA_INTEGER:
- *rSrc = 0;
- *gSrc = 1;
- *bSrc = 2;
- *aSrc = 3;
- *rDst = 0;
- *gDst = 1;
- *bDst = 2;
- *aDst = 3;
- break;
- case GL_BGRA:
- *rSrc = 2;
- *gSrc = 1;
- *bSrc = 0;
- *aSrc = 3;
- *rDst = 2;
- *gDst = 1;
- *bDst = 0;
- *aDst = 3;
- break;
- case GL_ABGR_EXT:
- *rSrc = 3;
- *gSrc = 2;
- *bSrc = 1;
- *aSrc = 0;
- *rDst = 3;
- *gDst = 2;
- *bDst = 1;
- *aDst = 0;
- break;
- case GL_DU8DV8_ATI:
- case GL_DUDV_ATI:
- *rSrc = 0;
- *gSrc = 1;
- *bSrc = -1;
- *aSrc = -1;
- break;
- default:
- _mesa_problem(NULL, "bad srcFormat %s in get_component_mapping",
- _mesa_lookup_enum_by_nr(format));
- return;
- }
-}
-
-
-
-/*
- * This function extracts floating point RGBA values from arbitrary
- * image data. srcFormat and srcType are the format and type parameters
- * passed to glDrawPixels, glTexImage[123]D, glTexSubImage[123]D, etc.
- *
- * Refering to section 3.6.4 of the OpenGL 1.2 spec, this function
- * implements the "Conversion to floating point", "Conversion to RGB",
- * and "Final Expansion to RGBA" operations.
- *
- * Args: n - number of pixels
- * rgba - output colors
- * srcFormat - format of incoming data
- * srcType - data type of incoming data
- * src - source data pointer
- * swapBytes - perform byteswapping of incoming data?
- */
-static void
-extract_float_rgba(GLuint n, GLfloat rgba[][4],
- GLenum srcFormat, GLenum srcType, const GLvoid *src,
- GLboolean swapBytes)
-{
- GLint rSrc, gSrc, bSrc, aSrc;
- GLint stride;
- GLint rDst, bDst, gDst, aDst;
- GLboolean intFormat;
- GLfloat rs = 1.0f, gs = 1.0f, bs = 1.0f, as = 1.0f; /* scale factors */
-
- ASSERT(srcFormat == GL_RED ||
- srcFormat == GL_GREEN ||
- srcFormat == GL_BLUE ||
- srcFormat == GL_ALPHA ||
- srcFormat == GL_LUMINANCE ||
- srcFormat == GL_LUMINANCE_ALPHA ||
- srcFormat == GL_INTENSITY ||
- srcFormat == GL_RG ||
- srcFormat == GL_RGB ||
- srcFormat == GL_BGR ||
- srcFormat == GL_RGBA ||
- srcFormat == GL_BGRA ||
- srcFormat == GL_ABGR_EXT ||
- srcFormat == GL_DU8DV8_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 ||
- srcType == GL_UNSIGNED_SHORT ||
- srcType == GL_SHORT ||
- srcType == GL_UNSIGNED_INT ||
- srcType == GL_INT ||
- srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT ||
- srcType == GL_UNSIGNED_BYTE_3_3_2 ||
- srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
- srcType == GL_UNSIGNED_SHORT_5_6_5 ||
- srcType == GL_UNSIGNED_SHORT_5_6_5_REV ||
- srcType == GL_UNSIGNED_SHORT_4_4_4_4 ||
- srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
- srcType == GL_UNSIGNED_SHORT_5_5_5_1 ||
- srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
- srcType == GL_UNSIGNED_INT_8_8_8_8 ||
- srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
- srcType == GL_UNSIGNED_INT_10_10_10_2 ||
- srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
-
- get_component_mapping(srcFormat,
- &rSrc, &gSrc, &bSrc, &aSrc,
- &rDst, &gDst, &bDst, &aDst);
-
- stride = _mesa_components_in_format(srcFormat);
-
- intFormat = _mesa_is_integer_format(srcFormat);
-
-#define PROCESS(SRC_INDEX, DST_INDEX, DEFAULT_FLT, DEFAULT_INT, TYPE, CONVERSION) \
- if ((SRC_INDEX) < 0) { \
- GLuint i; \
- if (intFormat) { \
- for (i = 0; i < n; i++) { \
- rgba[i][DST_INDEX] = DEFAULT_INT; \
- } \
- } \
- else { \
- for (i = 0; i < n; i++) { \
- rgba[i][DST_INDEX] = DEFAULT_FLT; \
- } \
- } \
- } \
- else if (swapBytes) { \
- const TYPE *s = (const TYPE *) src; \
- GLuint i; \
- for (i = 0; i < n; i++) { \
- TYPE value = s[SRC_INDEX]; \
- if (sizeof(TYPE) == 2) { \
- SWAP2BYTE(value); \
- } \
- else if (sizeof(TYPE) == 4) { \
- SWAP4BYTE(value); \
- } \
- if (intFormat) \
- rgba[i][DST_INDEX] = (GLfloat) value; \
- else \
- rgba[i][DST_INDEX] = (GLfloat) CONVERSION(value); \
- s += stride; \
- } \
- } \
- else { \
- const TYPE *s = (const TYPE *) src; \
- GLuint i; \
- if (intFormat) { \
- for (i = 0; i < n; i++) { \
- rgba[i][DST_INDEX] = (GLfloat) s[SRC_INDEX]; \
- s += stride; \
- } \
- } \
- else { \
- for (i = 0; i < n; i++) { \
- rgba[i][DST_INDEX] = (GLfloat) CONVERSION(s[SRC_INDEX]); \
- s += stride; \
- } \
- } \
- }
-
- switch (srcType) {
- case GL_UNSIGNED_BYTE:
- PROCESS(rSrc, RCOMP, 0.0F, 0, GLubyte, UBYTE_TO_FLOAT);
- PROCESS(gSrc, GCOMP, 0.0F, 0, GLubyte, UBYTE_TO_FLOAT);
- PROCESS(bSrc, BCOMP, 0.0F, 0, GLubyte, UBYTE_TO_FLOAT);
- PROCESS(aSrc, ACOMP, 1.0F, 255, GLubyte, UBYTE_TO_FLOAT);
- break;
- case GL_BYTE:
- PROCESS(rSrc, RCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOAT);
- PROCESS(gSrc, GCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOAT);
- PROCESS(bSrc, BCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOAT);
- PROCESS(aSrc, ACOMP, 1.0F, 127, GLbyte, BYTE_TO_FLOAT);
- break;
- case GL_UNSIGNED_SHORT:
- PROCESS(rSrc, RCOMP, 0.0F, 0, GLushort, USHORT_TO_FLOAT);
- PROCESS(gSrc, GCOMP, 0.0F, 0, GLushort, USHORT_TO_FLOAT);
- PROCESS(bSrc, BCOMP, 0.0F, 0, GLushort, USHORT_TO_FLOAT);
- PROCESS(aSrc, ACOMP, 1.0F, 0xffff, GLushort, USHORT_TO_FLOAT);
- break;
- case GL_SHORT:
- PROCESS(rSrc, RCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOAT);
- PROCESS(gSrc, GCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOAT);
- PROCESS(bSrc, BCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOAT);
- PROCESS(aSrc, ACOMP, 1.0F, 32767, GLshort, SHORT_TO_FLOAT);
- break;
- case GL_UNSIGNED_INT:
- PROCESS(rSrc, RCOMP, 0.0F, 0, GLuint, UINT_TO_FLOAT);
- PROCESS(gSrc, GCOMP, 0.0F, 0, GLuint, UINT_TO_FLOAT);
- PROCESS(bSrc, BCOMP, 0.0F, 0, GLuint, UINT_TO_FLOAT);
- PROCESS(aSrc, ACOMP, 1.0F, 0xffffffff, GLuint, UINT_TO_FLOAT);
- break;
- case GL_INT:
- PROCESS(rSrc, RCOMP, 0.0F, 0, GLint, INT_TO_FLOAT);
- PROCESS(gSrc, GCOMP, 0.0F, 0, GLint, INT_TO_FLOAT);
- PROCESS(bSrc, BCOMP, 0.0F, 0, GLint, INT_TO_FLOAT);
- PROCESS(aSrc, ACOMP, 1.0F, 2147483647, GLint, INT_TO_FLOAT);
- break;
- case GL_FLOAT:
- PROCESS(rSrc, RCOMP, 0.0F, 0.0F, GLfloat, (GLfloat));
- PROCESS(gSrc, GCOMP, 0.0F, 0.0F, GLfloat, (GLfloat));
- PROCESS(bSrc, BCOMP, 0.0F, 0.0F, GLfloat, (GLfloat));
- PROCESS(aSrc, ACOMP, 1.0F, 1.0F, GLfloat, (GLfloat));
- break;
- case GL_HALF_FLOAT_ARB:
- PROCESS(rSrc, RCOMP, 0.0F, 0.0F, GLhalfARB, _mesa_half_to_float);
- PROCESS(gSrc, GCOMP, 0.0F, 0.0F, GLhalfARB, _mesa_half_to_float);
- PROCESS(bSrc, BCOMP, 0.0F, 0.0F, GLhalfARB, _mesa_half_to_float);
- PROCESS(aSrc, 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][rDst] = ((p >> 5) ) * rs;
- rgba[i][gDst] = ((p >> 2) & 0x7) * gs;
- rgba[i][bDst] = ((p ) & 0x3) * bs;
- rgba[i][aDst] = 1.0F;
- }
- }
- break;
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- {
- 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][rDst] = ((p ) & 0x7) * rs;
- rgba[i][gDst] = ((p >> 3) & 0x7) * gs;
- rgba[i][bDst] = ((p >> 6) ) * bs;
- rgba[i][aDst] = 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][rDst] = ((p >> 11) ) * rs;
- rgba[i][gDst] = ((p >> 5) & 0x3f) * gs;
- rgba[i][bDst] = ((p ) & 0x1f) * bs;
- rgba[i][aDst] = 1.0F;
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p >> 11) ) * rs;
- rgba[i][gDst] = ((p >> 5) & 0x3f) * gs;
- rgba[i][bDst] = ((p ) & 0x1f) * bs;
- rgba[i][aDst] = 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][rDst] = ((p ) & 0x1f) * rs;
- rgba[i][gDst] = ((p >> 5) & 0x3f) * gs;
- rgba[i][bDst] = ((p >> 11) ) * bs;
- rgba[i][aDst] = 1.0F;
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p ) & 0x1f) * rs;
- rgba[i][gDst] = ((p >> 5) & 0x3f) * gs;
- rgba[i][bDst] = ((p >> 11) ) * bs;
- rgba[i][aDst] = 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][rDst] = ((p >> 12) ) * rs;
- rgba[i][gDst] = ((p >> 8) & 0xf) * gs;
- rgba[i][bDst] = ((p >> 4) & 0xf) * bs;
- rgba[i][aDst] = ((p ) & 0xf) * as;
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p >> 12) ) * rs;
- rgba[i][gDst] = ((p >> 8) & 0xf) * gs;
- rgba[i][bDst] = ((p >> 4) & 0xf) * bs;
- rgba[i][aDst] = ((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][rDst] = ((p ) & 0xf) * rs;
- rgba[i][gDst] = ((p >> 4) & 0xf) * gs;
- rgba[i][bDst] = ((p >> 8) & 0xf) * bs;
- rgba[i][aDst] = ((p >> 12) ) * as;
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p ) & 0xf) * rs;
- rgba[i][gDst] = ((p >> 4) & 0xf) * gs;
- rgba[i][bDst] = ((p >> 8) & 0xf) * bs;
- rgba[i][aDst] = ((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][rDst] = ((p >> 11) ) * rs;
- rgba[i][gDst] = ((p >> 6) & 0x1f) * gs;
- rgba[i][bDst] = ((p >> 1) & 0x1f) * bs;
- rgba[i][aDst] = ((p ) & 0x1) * as;
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p >> 11) ) * rs;
- rgba[i][gDst] = ((p >> 6) & 0x1f) * gs;
- rgba[i][bDst] = ((p >> 1) & 0x1f) * bs;
- rgba[i][aDst] = ((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][rDst] = ((p ) & 0x1f) * rs;
- rgba[i][gDst] = ((p >> 5) & 0x1f) * gs;
- rgba[i][bDst] = ((p >> 10) & 0x1f) * bs;
- rgba[i][aDst] = ((p >> 15) ) * as;
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p ) & 0x1f) * rs;
- rgba[i][gDst] = ((p >> 5) & 0x1f) * gs;
- rgba[i][bDst] = ((p >> 10) & 0x1f) * bs;
- rgba[i][aDst] = ((p >> 15) ) * as;
- }
- }
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- if (swapBytes) {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- if (intFormat) {
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = (GLfloat) ((p ) & 0xff);
- rgba[i][gDst] = (GLfloat) ((p >> 8) & 0xff);
- rgba[i][bDst] = (GLfloat) ((p >> 16) & 0xff);
- rgba[i][aDst] = (GLfloat) ((p >> 24) );
- }
- }
- else {
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = UBYTE_TO_FLOAT((p ) & 0xff);
- rgba[i][gDst] = UBYTE_TO_FLOAT((p >> 8) & 0xff);
- rgba[i][bDst] = UBYTE_TO_FLOAT((p >> 16) & 0xff);
- rgba[i][aDst] = UBYTE_TO_FLOAT((p >> 24) );
- }
- }
- }
- else {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- if (intFormat) {
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = (GLfloat) ((p >> 24) );
- rgba[i][gDst] = (GLfloat) ((p >> 16) & 0xff);
- rgba[i][bDst] = (GLfloat) ((p >> 8) & 0xff);
- rgba[i][aDst] = (GLfloat) ((p ) & 0xff);
- }
- }
- else {
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = UBYTE_TO_FLOAT((p >> 24) );
- rgba[i][gDst] = UBYTE_TO_FLOAT((p >> 16) & 0xff);
- rgba[i][bDst] = UBYTE_TO_FLOAT((p >> 8) & 0xff);
- rgba[i][aDst] = UBYTE_TO_FLOAT((p ) & 0xff);
- }
- }
- }
- break;
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- if (swapBytes) {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- if (intFormat) {
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = (GLfloat) ((p >> 24) );
- rgba[i][gDst] = (GLfloat) ((p >> 16) & 0xff);
- rgba[i][bDst] = (GLfloat) ((p >> 8) & 0xff);
- rgba[i][aDst] = (GLfloat) ((p ) & 0xff);
- }
- }
- else {
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = UBYTE_TO_FLOAT((p >> 24) );
- rgba[i][gDst] = UBYTE_TO_FLOAT((p >> 16) & 0xff);
- rgba[i][bDst] = UBYTE_TO_FLOAT((p >> 8) & 0xff);
- rgba[i][aDst] = UBYTE_TO_FLOAT((p ) & 0xff);
- }
- }
- }
- else {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- if (intFormat) {
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = (GLfloat) ((p ) & 0xff);
- rgba[i][gDst] = (GLfloat) ((p >> 8) & 0xff);
- rgba[i][bDst] = (GLfloat) ((p >> 16) & 0xff);
- rgba[i][aDst] = (GLfloat) ((p >> 24) );
- }
- }
- else {
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = UBYTE_TO_FLOAT((p ) & 0xff);
- rgba[i][gDst] = UBYTE_TO_FLOAT((p >> 8) & 0xff);
- rgba[i][bDst] = UBYTE_TO_FLOAT((p >> 16) & 0xff);
- rgba[i][aDst] = 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][rDst] = ((p >> 22) ) * rs;
- rgba[i][gDst] = ((p >> 12) & 0x3ff) * gs;
- rgba[i][bDst] = ((p >> 2) & 0x3ff) * bs;
- rgba[i][aDst] = ((p ) & 0x3 ) * as;
- }
- }
- else {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = ((p >> 22) ) * rs;
- rgba[i][gDst] = ((p >> 12) & 0x3ff) * gs;
- rgba[i][bDst] = ((p >> 2) & 0x3ff) * bs;
- rgba[i][aDst] = ((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][rDst] = ((p ) & 0x3ff) * rs;
- rgba[i][gDst] = ((p >> 10) & 0x3ff) * gs;
- rgba[i][bDst] = ((p >> 20) & 0x3ff) * bs;
- rgba[i][aDst] = ((p >> 30) ) * as;
- }
- }
- else {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = ((p ) & 0x3ff) * rs;
- rgba[i][gDst] = ((p >> 10) & 0x3ff) * gs;
- rgba[i][bDst] = ((p >> 20) & 0x3ff) * bs;
- rgba[i][aDst] = ((p >> 30) ) * as;
- }
- }
- break;
- default:
- _mesa_problem(NULL, "bad srcType in extract float data");
- break;
- }
-#undef PROCESS
-}
-
-
-static INLINE GLuint
-clamp_byte_to_uint(GLbyte b)
-{
- return b < 0 ? 0 : b;
-}
-
-
-static INLINE GLuint
-clamp_short_to_uint(GLshort s)
-{
- return s < 0 ? 0 : s;
-}
-
-
-static INLINE GLuint
-clamp_int_to_uint(GLint i)
-{
- return i < 0 ? 0 : i;
-}
-
-
-static INLINE GLuint
-clamp_float_to_uint(GLfloat f)
-{
- return f < 0.0F ? 0 : IROUND(f);
-}
-
-
-static INLINE GLuint
-clamp_half_to_uint(GLhalfARB h)
-{
- GLfloat f = _mesa_half_to_float(h);
- return f < 0.0F ? 0 : IROUND(f);
-}
-
-
-/**
- * \sa extract_float_rgba()
- */
-static void
-extract_uint_rgba(GLuint n, GLuint rgba[][4],
- GLenum srcFormat, GLenum srcType, const GLvoid *src,
- GLboolean swapBytes)
-{
- GLint rSrc, gSrc, bSrc, aSrc;
- GLint stride;
- GLint rDst, bDst, gDst, aDst;
- GLboolean intFormat;
-
- ASSERT(srcFormat == GL_RED ||
- srcFormat == GL_GREEN ||
- srcFormat == GL_BLUE ||
- srcFormat == GL_ALPHA ||
- srcFormat == GL_LUMINANCE ||
- srcFormat == GL_LUMINANCE_ALPHA ||
- srcFormat == GL_INTENSITY ||
- srcFormat == GL_RG ||
- srcFormat == GL_RGB ||
- srcFormat == GL_BGR ||
- srcFormat == GL_RGBA ||
- srcFormat == GL_BGRA ||
- srcFormat == GL_ABGR_EXT ||
- srcFormat == GL_DU8DV8_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 ||
- srcType == GL_UNSIGNED_SHORT ||
- srcType == GL_SHORT ||
- srcType == GL_UNSIGNED_INT ||
- srcType == GL_INT ||
- srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT ||
- srcType == GL_UNSIGNED_BYTE_3_3_2 ||
- srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
- srcType == GL_UNSIGNED_SHORT_5_6_5 ||
- srcType == GL_UNSIGNED_SHORT_5_6_5_REV ||
- srcType == GL_UNSIGNED_SHORT_4_4_4_4 ||
- srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
- srcType == GL_UNSIGNED_SHORT_5_5_5_1 ||
- srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
- srcType == GL_UNSIGNED_INT_8_8_8_8 ||
- srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
- srcType == GL_UNSIGNED_INT_10_10_10_2 ||
- srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
-
- get_component_mapping(srcFormat,
- &rSrc, &gSrc, &bSrc, &aSrc,
- &rDst, &gDst, &bDst, &aDst);
-
- stride = _mesa_components_in_format(srcFormat);
-
- intFormat = _mesa_is_integer_format(srcFormat);
-
-#define PROCESS(SRC_INDEX, DST_INDEX, DEFAULT, TYPE, CONVERSION) \
- if ((SRC_INDEX) < 0) { \
- GLuint i; \
- for (i = 0; i < n; i++) { \
- rgba[i][DST_INDEX] = DEFAULT; \
- } \
- } \
- else if (swapBytes) { \
- const TYPE *s = (const TYPE *) src; \
- GLuint i; \
- for (i = 0; i < n; i++) { \
- TYPE value = s[SRC_INDEX]; \
- if (sizeof(TYPE) == 2) { \
- SWAP2BYTE(value); \
- } \
- else if (sizeof(TYPE) == 4) { \
- SWAP4BYTE(value); \
- } \
- rgba[i][DST_INDEX] = CONVERSION(value); \
- s += stride; \
- } \
- } \
- else { \
- const TYPE *s = (const TYPE *) src; \
- GLuint i; \
- for (i = 0; i < n; i++) { \
- rgba[i][DST_INDEX] = CONVERSION(s[SRC_INDEX]); \
- s += stride; \
- } \
- }
-
- switch (srcType) {
- case GL_UNSIGNED_BYTE:
- PROCESS(rSrc, RCOMP, 0, GLubyte, (GLuint));
- PROCESS(gSrc, GCOMP, 0, GLubyte, (GLuint));
- PROCESS(bSrc, BCOMP, 0, GLubyte, (GLuint));
- PROCESS(aSrc, ACOMP, 1, GLubyte, (GLuint));
- break;
- case GL_BYTE:
- PROCESS(rSrc, RCOMP, 0, GLbyte, clamp_byte_to_uint);
- PROCESS(gSrc, GCOMP, 0, GLbyte, clamp_byte_to_uint);
- PROCESS(bSrc, BCOMP, 0, GLbyte, clamp_byte_to_uint);
- PROCESS(aSrc, ACOMP, 1, GLbyte, clamp_byte_to_uint);
- break;
- case GL_UNSIGNED_SHORT:
- PROCESS(rSrc, RCOMP, 0, GLushort, (GLuint));
- PROCESS(gSrc, GCOMP, 0, GLushort, (GLuint));
- PROCESS(bSrc, BCOMP, 0, GLushort, (GLuint));
- PROCESS(aSrc, ACOMP, 1, GLushort, (GLuint));
- break;
- case GL_SHORT:
- PROCESS(rSrc, RCOMP, 0, GLshort, clamp_short_to_uint);
- PROCESS(gSrc, GCOMP, 0, GLshort, clamp_short_to_uint);
- PROCESS(bSrc, BCOMP, 0, GLshort, clamp_short_to_uint);
- PROCESS(aSrc, ACOMP, 1, GLshort, clamp_short_to_uint);
- break;
- case GL_UNSIGNED_INT:
- PROCESS(rSrc, RCOMP, 0, GLuint, (GLuint));
- PROCESS(gSrc, GCOMP, 0, GLuint, (GLuint));
- PROCESS(bSrc, BCOMP, 0, GLuint, (GLuint));
- PROCESS(aSrc, ACOMP, 1, GLuint, (GLuint));
- break;
- case GL_INT:
- PROCESS(rSrc, RCOMP, 0, GLint, clamp_int_to_uint);
- PROCESS(gSrc, GCOMP, 0, GLint, clamp_int_to_uint);
- PROCESS(bSrc, BCOMP, 0, GLint, clamp_int_to_uint);
- PROCESS(aSrc, ACOMP, 1, GLint, clamp_int_to_uint);
- break;
- case GL_FLOAT:
- PROCESS(rSrc, RCOMP, 0, GLfloat, clamp_float_to_uint);
- PROCESS(gSrc, GCOMP, 0, GLfloat, clamp_float_to_uint);
- PROCESS(bSrc, BCOMP, 0, GLfloat, clamp_float_to_uint);
- PROCESS(aSrc, ACOMP, 1, GLfloat, clamp_float_to_uint);
- break;
- case GL_HALF_FLOAT_ARB:
- PROCESS(rSrc, RCOMP, 0, GLhalfARB, clamp_half_to_uint);
- PROCESS(gSrc, GCOMP, 0, GLhalfARB, clamp_half_to_uint);
- PROCESS(bSrc, BCOMP, 0, GLhalfARB, clamp_half_to_uint);
- PROCESS(aSrc, ACOMP, 1, GLhalfARB, clamp_half_to_uint);
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- {
- const GLubyte *ubsrc = (const GLubyte *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLubyte p = ubsrc[i];
- rgba[i][rDst] = ((p >> 5) );
- rgba[i][gDst] = ((p >> 2) & 0x7);
- rgba[i][bDst] = ((p ) & 0x3);
- rgba[i][aDst] = 1;
- }
- }
- break;
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- {
- const GLubyte *ubsrc = (const GLubyte *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLubyte p = ubsrc[i];
- rgba[i][rDst] = ((p ) & 0x7);
- rgba[i][gDst] = ((p >> 3) & 0x7);
- rgba[i][bDst] = ((p >> 6) );
- rgba[i][aDst] = 1;
- }
- }
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- if (swapBytes) {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- SWAP2BYTE(p);
- rgba[i][rDst] = ((p >> 11) );
- rgba[i][gDst] = ((p >> 5) & 0x3f);
- rgba[i][bDst] = ((p ) & 0x1f);
- rgba[i][aDst] = 1;
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p >> 11) );
- rgba[i][gDst] = ((p >> 5) & 0x3f);
- rgba[i][bDst] = ((p ) & 0x1f);
- rgba[i][aDst] = 1;
- }
- }
- break;
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- if (swapBytes) {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- SWAP2BYTE(p);
- rgba[i][rDst] = ((p ) & 0x1f);
- rgba[i][gDst] = ((p >> 5) & 0x3f);
- rgba[i][bDst] = ((p >> 11) );
- rgba[i][aDst] = 1;
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p ) & 0x1f);
- rgba[i][gDst] = ((p >> 5) & 0x3f);
- rgba[i][bDst] = ((p >> 11) );
- rgba[i][aDst] = 1;
- }
- }
- break;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- if (swapBytes) {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- SWAP2BYTE(p);
- rgba[i][rDst] = ((p >> 12) );
- rgba[i][gDst] = ((p >> 8) & 0xf);
- rgba[i][bDst] = ((p >> 4) & 0xf);
- rgba[i][aDst] = ((p ) & 0xf);
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p >> 12) );
- rgba[i][gDst] = ((p >> 8) & 0xf);
- rgba[i][bDst] = ((p >> 4) & 0xf);
- rgba[i][aDst] = ((p ) & 0xf);
- }
- }
- break;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- if (swapBytes) {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- SWAP2BYTE(p);
- rgba[i][rDst] = ((p ) & 0xf);
- rgba[i][gDst] = ((p >> 4) & 0xf);
- rgba[i][bDst] = ((p >> 8) & 0xf);
- rgba[i][aDst] = ((p >> 12) );
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p ) & 0xf);
- rgba[i][gDst] = ((p >> 4) & 0xf);
- rgba[i][bDst] = ((p >> 8) & 0xf);
- rgba[i][aDst] = ((p >> 12) );
- }
- }
- break;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- if (swapBytes) {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- SWAP2BYTE(p);
- rgba[i][rDst] = ((p >> 11) );
- rgba[i][gDst] = ((p >> 6) & 0x1f);
- rgba[i][bDst] = ((p >> 1) & 0x1f);
- rgba[i][aDst] = ((p ) & 0x1 );
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p >> 11) );
- rgba[i][gDst] = ((p >> 6) & 0x1f);
- rgba[i][bDst] = ((p >> 1) & 0x1f);
- rgba[i][aDst] = ((p ) & 0x1 );
- }
- }
- break;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- if (swapBytes) {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- SWAP2BYTE(p);
- rgba[i][rDst] = ((p ) & 0x1f);
- rgba[i][gDst] = ((p >> 5) & 0x1f);
- rgba[i][bDst] = ((p >> 10) & 0x1f);
- rgba[i][aDst] = ((p >> 15) );
- }
- }
- else {
- const GLushort *ussrc = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLushort p = ussrc[i];
- rgba[i][rDst] = ((p ) & 0x1f);
- rgba[i][gDst] = ((p >> 5) & 0x1f);
- rgba[i][bDst] = ((p >> 10) & 0x1f);
- rgba[i][aDst] = ((p >> 15) );
- }
- }
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- if (swapBytes) {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = ((p ) & 0xff);
- rgba[i][gDst] = ((p >> 8) & 0xff);
- rgba[i][bDst] = ((p >> 16) & 0xff);
- rgba[i][aDst] = ((p >> 24) );
- }
- }
- else {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = ((p >> 24) );
- rgba[i][gDst] = ((p >> 16) & 0xff);
- rgba[i][bDst] = ((p >> 8) & 0xff);
- rgba[i][aDst] = ((p ) & 0xff);
- }
- }
- break;
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- if (swapBytes) {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = ((p >> 24) );
- rgba[i][gDst] = ((p >> 16) & 0xff);
- rgba[i][bDst] = ((p >> 8) & 0xff);
- rgba[i][aDst] = ((p ) & 0xff);
- }
- }
- else {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = ((p ) & 0xff);
- rgba[i][gDst] = ((p >> 8) & 0xff);
- rgba[i][bDst] = ((p >> 16) & 0xff);
- rgba[i][aDst] = ((p >> 24) );
- }
- }
- break;
- case GL_UNSIGNED_INT_10_10_10_2:
- if (swapBytes) {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- SWAP4BYTE(p);
- rgba[i][rDst] = ((p >> 22) );
- rgba[i][gDst] = ((p >> 12) & 0x3ff);
- rgba[i][bDst] = ((p >> 2) & 0x3ff);
- rgba[i][aDst] = ((p ) & 0x3 );
- }
- }
- else {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = ((p >> 22) );
- rgba[i][gDst] = ((p >> 12) & 0x3ff);
- rgba[i][bDst] = ((p >> 2) & 0x3ff);
- rgba[i][aDst] = ((p ) & 0x3 );
- }
- }
- break;
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- if (swapBytes) {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- SWAP4BYTE(p);
- rgba[i][rDst] = ((p ) & 0x3ff);
- rgba[i][gDst] = ((p >> 10) & 0x3ff);
- rgba[i][bDst] = ((p >> 20) & 0x3ff);
- rgba[i][aDst] = ((p >> 30) );
- }
- }
- else {
- const GLuint *uisrc = (const GLuint *) src;
- GLuint i;
- for (i = 0; i < n; i ++) {
- GLuint p = uisrc[i];
- rgba[i][rDst] = ((p ) & 0x3ff);
- rgba[i][gDst] = ((p >> 10) & 0x3ff);
- rgba[i][bDst] = ((p >> 20) & 0x3ff);
- rgba[i][aDst] = ((p >> 30) );
- }
- }
- break;
- default:
- _mesa_problem(NULL, "bad srcType in extract uint data");
- break;
- }
-#undef PROCESS
-}
-
-
-
-/*
- * Unpack a row of color image data from a client buffer according to
- * the pixel unpacking parameters.
- * Return GLchan values in the specified dest image format.
- * This is used by glDrawPixels and glTexImage?D().
- * \param ctx - the context
- * n - number of pixels in the span
- * dstFormat - format of destination color array
- * dest - the destination color array
- * srcFormat - source image format
- * srcType - source image data type
- * source - source image pointer
- * srcPacking - pixel unpacking parameters
- * transferOps - bitmask of IMAGE_*_BIT values of operations to apply
- *
- * XXX perhaps expand this to process whole images someday.
- */
-void
-_mesa_unpack_color_span_chan( struct gl_context *ctx,
- GLuint n, GLenum dstFormat, GLchan dest[],
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps )
-{
- ASSERT(dstFormat == GL_ALPHA ||
- dstFormat == GL_LUMINANCE ||
- dstFormat == GL_LUMINANCE_ALPHA ||
- dstFormat == GL_INTENSITY ||
- dstFormat == GL_RED ||
- dstFormat == GL_RG ||
- dstFormat == GL_RGB ||
- dstFormat == GL_RGBA ||
- dstFormat == GL_COLOR_INDEX);
-
- ASSERT(srcFormat == GL_RED ||
- srcFormat == GL_GREEN ||
- srcFormat == GL_BLUE ||
- srcFormat == GL_ALPHA ||
- srcFormat == GL_LUMINANCE ||
- srcFormat == GL_LUMINANCE_ALPHA ||
- srcFormat == GL_INTENSITY ||
- srcFormat == GL_RG ||
- srcFormat == GL_RGB ||
- srcFormat == GL_BGR ||
- srcFormat == GL_RGBA ||
- srcFormat == GL_BGRA ||
- srcFormat == GL_ABGR_EXT ||
- srcFormat == GL_COLOR_INDEX);
-
- ASSERT(srcType == GL_BITMAP ||
- srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_BYTE ||
- srcType == GL_UNSIGNED_SHORT ||
- srcType == GL_SHORT ||
- srcType == GL_UNSIGNED_INT ||
- srcType == GL_INT ||
- srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT ||
- srcType == GL_UNSIGNED_BYTE_3_3_2 ||
- srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
- srcType == GL_UNSIGNED_SHORT_5_6_5 ||
- srcType == GL_UNSIGNED_SHORT_5_6_5_REV ||
- srcType == GL_UNSIGNED_SHORT_4_4_4_4 ||
- srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
- srcType == GL_UNSIGNED_SHORT_5_5_5_1 ||
- srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
- srcType == GL_UNSIGNED_INT_8_8_8_8 ||
- srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
- srcType == GL_UNSIGNED_INT_10_10_10_2 ||
- srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
-
- /* Try simple cases first */
- if (transferOps == 0) {
- if (srcType == CHAN_TYPE) {
- if (dstFormat == GL_RGBA) {
- if (srcFormat == GL_RGBA) {
- memcpy( dest, source, n * 4 * sizeof(GLchan) );
- return;
- }
- else if (srcFormat == GL_RGB) {
- GLuint i;
- const GLchan *src = (const GLchan *) source;
- GLchan *dst = dest;
- for (i = 0; i < n; i++) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = CHAN_MAX;
- src += 3;
- dst += 4;
- }
- return;
- }
- }
- else if (dstFormat == GL_RGB) {
- if (srcFormat == GL_RGB) {
- memcpy( dest, source, n * 3 * sizeof(GLchan) );
- return;
- }
- else if (srcFormat == GL_RGBA) {
- GLuint i;
- const GLchan *src = (const GLchan *) source;
- GLchan *dst = dest;
- for (i = 0; i < n; i++) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- src += 4;
- dst += 3;
- }
- return;
- }
- }
- else if (dstFormat == srcFormat) {
- GLint comps = _mesa_components_in_format(srcFormat);
- assert(comps > 0);
- memcpy( dest, source, n * comps * sizeof(GLchan) );
- return;
- }
- }
- /*
- * Common situation, loading 8bit RGBA/RGB source images
- * into 16/32 bit destination. (OSMesa16/32)
- */
- else if (srcType == GL_UNSIGNED_BYTE) {
- if (dstFormat == GL_RGBA) {
- if (srcFormat == GL_RGB) {
- GLuint i;
- const GLubyte *src = (const GLubyte *) source;
- GLchan *dst = dest;
- for (i = 0; i < n; i++) {
- dst[0] = UBYTE_TO_CHAN(src[0]);
- dst[1] = UBYTE_TO_CHAN(src[1]);
- dst[2] = UBYTE_TO_CHAN(src[2]);
- dst[3] = CHAN_MAX;
- src += 3;
- dst += 4;
- }
- return;
- }
- else if (srcFormat == GL_RGBA) {
- GLuint i;
- const GLubyte *src = (const GLubyte *) source;
- GLchan *dst = dest;
- for (i = 0; i < n; i++) {
- dst[0] = UBYTE_TO_CHAN(src[0]);
- dst[1] = UBYTE_TO_CHAN(src[1]);
- dst[2] = UBYTE_TO_CHAN(src[2]);
- dst[3] = UBYTE_TO_CHAN(src[3]);
- src += 4;
- dst += 4;
- }
- return;
- }
- }
- else if (dstFormat == GL_RGB) {
- if (srcFormat == GL_RGB) {
- GLuint i;
- const GLubyte *src = (const GLubyte *) source;
- GLchan *dst = dest;
- for (i = 0; i < n; i++) {
- dst[0] = UBYTE_TO_CHAN(src[0]);
- dst[1] = UBYTE_TO_CHAN(src[1]);
- dst[2] = UBYTE_TO_CHAN(src[2]);
- src += 3;
- dst += 3;
- }
- return;
- }
- else if (srcFormat == GL_RGBA) {
- GLuint i;
- const GLubyte *src = (const GLubyte *) source;
- GLchan *dst = dest;
- for (i = 0; i < n; i++) {
- dst[0] = UBYTE_TO_CHAN(src[0]);
- dst[1] = UBYTE_TO_CHAN(src[1]);
- dst[2] = UBYTE_TO_CHAN(src[2]);
- src += 4;
- dst += 3;
- }
- return;
- }
- }
- }
- }
-
-
- /* general solution begins here */
- {
- GLint dstComponents;
- GLint rDst, gDst, bDst, aDst, lDst, iDst;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
-
- if (!rgba) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
- return;
- }
-
- dstComponents = _mesa_components_in_format( dstFormat );
- /* source & dest image formats should have been error checked by now */
- assert(dstComponents > 0);
-
- /*
- * Extract image data and convert to RGBA floats
- */
- if (srcFormat == GL_COLOR_INDEX) {
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
-
- if (!indexes) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
- return;
- }
-
- extract_uint_indexes(n, indexes, srcFormat, srcType, source,
- srcPacking);
-
- if (dstFormat == GL_COLOR_INDEX) {
- GLuint i;
- _mesa_apply_ci_transfer_ops(ctx, transferOps, n, indexes);
- /* convert to GLchan and return */
- for (i = 0; i < n; i++) {
- dest[i] = (GLchan) (indexes[i] & 0xff);
- }
- free(indexes);
- free(rgba);
- return;
- }
- else {
- /* Convert indexes to RGBA */
- if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
- _mesa_shift_and_offset_ci(ctx, n, indexes);
- }
- _mesa_map_ci_to_rgba(ctx, n, indexes, rgba);
- }
-
- /* Don't do RGBA scale/bias or RGBA->RGBA mapping if starting
- * with color indexes.
- */
- transferOps &= ~(IMAGE_SCALE_BIAS_BIT | IMAGE_MAP_COLOR_BIT);
-
- free(indexes);
- }
- else {
- /* non-color index data */
- extract_float_rgba(n, rgba, srcFormat, srcType, source,
- srcPacking->SwapBytes);
- }
-
- /* Need to clamp if returning GLubytes or GLushorts */
-#if CHAN_TYPE != GL_FLOAT
- transferOps |= IMAGE_CLAMP_BIT;
-#endif
-
- if (transferOps) {
- _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgba);
- }
-
- get_component_indexes(dstFormat,
- &rDst, &gDst, &bDst, &aDst, &lDst, &iDst);
-
- /* Now return the GLchan data in the requested dstFormat */
- if (rDst >= 0) {
- GLchan *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- CLAMPED_FLOAT_TO_CHAN(dst[rDst], rgba[i][RCOMP]);
- dst += dstComponents;
- }
- }
-
- if (gDst >= 0) {
- GLchan *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- CLAMPED_FLOAT_TO_CHAN(dst[gDst], rgba[i][GCOMP]);
- dst += dstComponents;
- }
- }
-
- if (bDst >= 0) {
- GLchan *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- CLAMPED_FLOAT_TO_CHAN(dst[bDst], rgba[i][BCOMP]);
- dst += dstComponents;
- }
- }
-
- if (aDst >= 0) {
- GLchan *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- CLAMPED_FLOAT_TO_CHAN(dst[aDst], rgba[i][ACOMP]);
- dst += dstComponents;
- }
- }
-
- if (iDst >= 0) {
- GLchan *dst = dest;
- GLuint i;
- assert(iDst == 0);
- assert(dstComponents == 1);
- for (i = 0; i < n; i++) {
- /* Intensity comes from red channel */
- CLAMPED_FLOAT_TO_CHAN(dst[i], rgba[i][RCOMP]);
- }
- }
-
- if (lDst >= 0) {
- GLchan *dst = dest;
- GLuint i;
- assert(lDst == 0);
- for (i = 0; i < n; i++) {
- /* Luminance comes from red channel */
- CLAMPED_FLOAT_TO_CHAN(dst[0], rgba[i][RCOMP]);
- dst += dstComponents;
- }
- }
-
- free(rgba);
- }
-}
-
-
-/**
- * Same as _mesa_unpack_color_span_chan(), but return GLfloat data
- * instead of GLchan.
- */
-void
-_mesa_unpack_color_span_float( struct gl_context *ctx,
- GLuint n, GLenum dstFormat, GLfloat dest[],
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps )
-{
- ASSERT(dstFormat == GL_ALPHA ||
- dstFormat == GL_LUMINANCE ||
- dstFormat == GL_LUMINANCE_ALPHA ||
- dstFormat == GL_INTENSITY ||
- dstFormat == GL_RED ||
- dstFormat == GL_RG ||
- dstFormat == GL_RGB ||
- dstFormat == GL_RGBA ||
- dstFormat == GL_COLOR_INDEX);
-
- ASSERT(srcFormat == GL_RED ||
- srcFormat == GL_GREEN ||
- srcFormat == GL_BLUE ||
- srcFormat == GL_ALPHA ||
- srcFormat == GL_LUMINANCE ||
- srcFormat == GL_LUMINANCE_ALPHA ||
- srcFormat == GL_INTENSITY ||
- srcFormat == GL_RG ||
- srcFormat == GL_RGB ||
- srcFormat == GL_BGR ||
- 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 ||
- srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_BYTE ||
- srcType == GL_UNSIGNED_SHORT ||
- srcType == GL_SHORT ||
- srcType == GL_UNSIGNED_INT ||
- srcType == GL_INT ||
- srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT ||
- srcType == GL_UNSIGNED_BYTE_3_3_2 ||
- srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
- srcType == GL_UNSIGNED_SHORT_5_6_5 ||
- srcType == GL_UNSIGNED_SHORT_5_6_5_REV ||
- srcType == GL_UNSIGNED_SHORT_4_4_4_4 ||
- srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
- srcType == GL_UNSIGNED_SHORT_5_5_5_1 ||
- srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
- srcType == GL_UNSIGNED_INT_8_8_8_8 ||
- srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
- srcType == GL_UNSIGNED_INT_10_10_10_2 ||
- srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
-
- /* general solution, no special cases, yet */
- {
- GLint dstComponents;
- GLint rDst, gDst, bDst, aDst, lDst, iDst;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
-
- if (!rgba) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
- return;
- }
-
- dstComponents = _mesa_components_in_format( dstFormat );
- /* source & dest image formats should have been error checked by now */
- assert(dstComponents > 0);
-
- /*
- * Extract image data and convert to RGBA floats
- */
- if (srcFormat == GL_COLOR_INDEX) {
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
-
- if (!indexes) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
- free(rgba);
- return;
- }
-
- extract_uint_indexes(n, indexes, srcFormat, srcType, source,
- srcPacking);
-
- if (dstFormat == GL_COLOR_INDEX) {
- GLuint i;
- _mesa_apply_ci_transfer_ops(ctx, transferOps, n, indexes);
- /* convert to GLchan and return */
- for (i = 0; i < n; i++) {
- dest[i] = (GLchan) (indexes[i] & 0xff);
- }
- free(indexes);
- free(rgba);
- return;
- }
- else {
- /* Convert indexes to RGBA */
- if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
- _mesa_shift_and_offset_ci(ctx, n, indexes);
- }
- _mesa_map_ci_to_rgba(ctx, n, indexes, rgba);
- }
-
- /* Don't do RGBA scale/bias or RGBA->RGBA mapping if starting
- * with color indexes.
- */
- transferOps &= ~(IMAGE_SCALE_BIAS_BIT | IMAGE_MAP_COLOR_BIT);
-
- free(indexes);
- }
- else {
- /* non-color index data */
- extract_float_rgba(n, rgba, srcFormat, srcType, source,
- srcPacking->SwapBytes);
- }
-
- if (transferOps) {
- _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgba);
- }
-
- get_component_indexes(dstFormat,
- &rDst, &gDst, &bDst, &aDst, &lDst, &iDst);
-
- /* Now pack results in the requested dstFormat */
- if (rDst >= 0) {
- GLfloat *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[rDst] = rgba[i][RCOMP];
- dst += dstComponents;
- }
- }
-
- if (gDst >= 0) {
- GLfloat *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[gDst] = rgba[i][GCOMP];
- dst += dstComponents;
- }
- }
-
- if (bDst >= 0) {
- GLfloat *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[bDst] = rgba[i][BCOMP];
- dst += dstComponents;
- }
- }
-
- if (aDst >= 0) {
- GLfloat *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[aDst] = rgba[i][ACOMP];
- dst += dstComponents;
- }
- }
-
- if (iDst >= 0) {
- GLfloat *dst = dest;
- GLuint i;
- assert(iDst == 0);
- assert(dstComponents == 1);
- for (i = 0; i < n; i++) {
- /* Intensity comes from red channel */
- dst[i] = rgba[i][RCOMP];
- }
- }
-
- if (lDst >= 0) {
- GLfloat *dst = dest;
- GLuint i;
- assert(lDst == 0);
- for (i = 0; i < n; i++) {
- /* Luminance comes from red channel */
- dst[0] = rgba[i][RCOMP];
- dst += dstComponents;
- }
- }
-
- free(rgba);
- }
-}
-
-
-/**
- * Same as _mesa_unpack_color_span_chan(), but return GLuint data
- * instead of GLchan.
- * No pixel transfer ops are applied.
- */
-void
-_mesa_unpack_color_span_uint(struct gl_context *ctx,
- GLuint n, GLenum dstFormat, GLuint *dest,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking)
-{
- GLuint (*rgba)[4] = (GLuint (*)[4]) malloc(n * 4 * sizeof(GLfloat));
-
- if (!rgba) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
- return;
- }
-
- ASSERT(dstFormat == GL_ALPHA ||
- dstFormat == GL_LUMINANCE ||
- dstFormat == GL_LUMINANCE_ALPHA ||
- dstFormat == GL_INTENSITY ||
- dstFormat == GL_RED ||
- dstFormat == GL_RG ||
- dstFormat == GL_RGB ||
- dstFormat == GL_RGBA);
-
- ASSERT(srcFormat == GL_RED ||
- srcFormat == GL_GREEN ||
- srcFormat == GL_BLUE ||
- srcFormat == GL_ALPHA ||
- srcFormat == GL_LUMINANCE ||
- srcFormat == GL_LUMINANCE_ALPHA ||
- srcFormat == GL_INTENSITY ||
- srcFormat == GL_RG ||
- srcFormat == GL_RGB ||
- srcFormat == GL_BGR ||
- 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);
-
- ASSERT(srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_BYTE ||
- srcType == GL_UNSIGNED_SHORT ||
- srcType == GL_SHORT ||
- srcType == GL_UNSIGNED_INT ||
- srcType == GL_INT ||
- srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT ||
- srcType == GL_UNSIGNED_BYTE_3_3_2 ||
- srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
- srcType == GL_UNSIGNED_SHORT_5_6_5 ||
- srcType == GL_UNSIGNED_SHORT_5_6_5_REV ||
- srcType == GL_UNSIGNED_SHORT_4_4_4_4 ||
- srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
- srcType == GL_UNSIGNED_SHORT_5_5_5_1 ||
- srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
- srcType == GL_UNSIGNED_INT_8_8_8_8 ||
- srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
- srcType == GL_UNSIGNED_INT_10_10_10_2 ||
- srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
-
-
- /* Extract image data as uint[4] pixels */
- extract_uint_rgba(n, rgba, srcFormat, srcType, source,
- srcPacking->SwapBytes);
-
- if (dstFormat == GL_RGBA) {
- /* simple case */
- memcpy(dest, rgba, 4 * sizeof(GLuint) * n);
- }
- else {
- /* general case */
- GLint rDst, gDst, bDst, aDst, lDst, iDst;
- GLint dstComponents = _mesa_components_in_format( dstFormat );
-
- assert(dstComponents > 0);
-
- get_component_indexes(dstFormat,
- &rDst, &gDst, &bDst, &aDst, &lDst, &iDst);
-
- /* Now pack values in the requested dest format */
- if (rDst >= 0) {
- GLuint *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[rDst] = rgba[i][RCOMP];
- dst += dstComponents;
- }
- }
-
- if (gDst >= 0) {
- GLuint *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[gDst] = rgba[i][GCOMP];
- dst += dstComponents;
- }
- }
-
- if (bDst >= 0) {
- GLuint *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[bDst] = rgba[i][BCOMP];
- dst += dstComponents;
- }
- }
-
- if (aDst >= 0) {
- GLuint *dst = dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[aDst] = rgba[i][ACOMP];
- dst += dstComponents;
- }
- }
-
- if (iDst >= 0) {
- GLuint *dst = dest;
- GLuint i;
- assert(iDst == 0);
- assert(dstComponents == 1);
- for (i = 0; i < n; i++) {
- /* Intensity comes from red channel */
- dst[i] = rgba[i][RCOMP];
- }
- }
-
- if (lDst >= 0) {
- GLuint *dst = dest;
- GLuint i;
- assert(lDst == 0);
- for (i = 0; i < n; i++) {
- /* Luminance comes from red channel */
- dst[0] = rgba[i][RCOMP];
- dst += dstComponents;
- }
- }
- }
-
- free(rgba);
-}
-
-
-
-/**
- * Similar to _mesa_unpack_color_span_float(), but for dudv data instead of rgba,
- * directly return GLbyte data, no transfer ops apply.
- */
-void
-_mesa_unpack_dudv_span_byte( struct gl_context *ctx,
- GLuint n, GLenum dstFormat, GLbyte dest[],
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps )
-{
- ASSERT(dstFormat == GL_DUDV_ATI);
- ASSERT(srcFormat == GL_DUDV_ATI);
-
- ASSERT(srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_BYTE ||
- srcType == GL_UNSIGNED_SHORT ||
- srcType == GL_SHORT ||
- srcType == GL_UNSIGNED_INT ||
- srcType == GL_INT ||
- srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT);
-
- /* general solution */
- {
- GLint dstComponents;
- GLbyte *dst = dest;
- GLuint i;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
-
- if (!rgba) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
- return;
- }
-
- dstComponents = _mesa_components_in_format( dstFormat );
- /* source & dest image formats should have been error checked by now */
- assert(dstComponents > 0);
-
- /*
- * Extract image data and convert to RGBA floats
- */
- extract_float_rgba(n, rgba, srcFormat, srcType, source,
- srcPacking->SwapBytes);
-
-
- /* Now determine which color channels we need to produce.
- * And determine the dest index (offset) within each color tuple.
- */
-
- /* Now pack results in the requested dstFormat */
- for (i = 0; i < n; i++) {
- /* not sure - need clamp[-1,1] here? */
- dst[0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst += dstComponents;
- }
-
- free(rgba);
- }
-}
-
-/*
- * Unpack a row of color index data from a client buffer according to
- * the pixel unpacking parameters.
- * This is (or will be) used by glDrawPixels, glTexImage[123]D, etc.
- *
- * Args: ctx - the context
- * n - number of pixels
- * dstType - destination data type
- * dest - destination array
- * srcType - source pixel type
- * source - source data pointer
- * srcPacking - pixel unpacking parameters
- * transferOps - the pixel transfer operations to apply
- */
-void
-_mesa_unpack_index_span( struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest,
- GLenum srcType, const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps )
-{
- ASSERT(srcType == GL_BITMAP ||
- srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_BYTE ||
- srcType == GL_UNSIGNED_SHORT ||
- srcType == GL_SHORT ||
- srcType == GL_UNSIGNED_INT ||
- srcType == GL_INT ||
- srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT);
-
- ASSERT(dstType == GL_UNSIGNED_BYTE ||
- dstType == GL_UNSIGNED_SHORT ||
- dstType == GL_UNSIGNED_INT);
-
-
- transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT);
-
- /*
- * Try simple cases first
- */
- if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE
- && dstType == GL_UNSIGNED_BYTE) {
- memcpy(dest, source, n * sizeof(GLubyte));
- }
- else if (transferOps == 0 && srcType == GL_UNSIGNED_INT
- && dstType == GL_UNSIGNED_INT && !srcPacking->SwapBytes) {
- memcpy(dest, source, n * sizeof(GLuint));
- }
- else {
- /*
- * general solution
- */
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
-
- if (!indexes) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
- return;
- }
-
- extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source,
- srcPacking);
-
- if (transferOps)
- _mesa_apply_ci_transfer_ops(ctx, transferOps, n, indexes);
-
- /* convert to dest type */
- switch (dstType) {
- case GL_UNSIGNED_BYTE:
- {
- GLubyte *dst = (GLubyte *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = (GLubyte) (indexes[i] & 0xff);
- }
- }
- break;
- case GL_UNSIGNED_SHORT:
- {
- GLuint *dst = (GLuint *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = (GLushort) (indexes[i] & 0xffff);
- }
- }
- break;
- case GL_UNSIGNED_INT:
- memcpy(dest, indexes, n * sizeof(GLuint));
- break;
- default:
- _mesa_problem(ctx, "bad dstType in _mesa_unpack_index_span");
- }
-
- free(indexes);
- }
-}
-
-
-void
-_mesa_pack_index_span( struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest, const GLuint *source,
- const struct gl_pixelstore_attrib *dstPacking,
- GLbitfield transferOps )
-{
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
-
- if (!indexes) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
- return;
- }
-
- transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT);
-
- if (transferOps & (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT)) {
- /* make a copy of input */
- memcpy(indexes, source, n * sizeof(GLuint));
- _mesa_apply_ci_transfer_ops(ctx, transferOps, n, indexes);
- source = indexes;
- }
-
- switch (dstType) {
- case GL_UNSIGNED_BYTE:
- {
- GLubyte *dst = (GLubyte *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- *dst++ = (GLubyte) source[i];
- }
- }
- break;
- case GL_BYTE:
- {
- GLbyte *dst = (GLbyte *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = (GLbyte) source[i];
- }
- }
- break;
- case GL_UNSIGNED_SHORT:
- {
- GLushort *dst = (GLushort *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = (GLushort) source[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n );
- }
- }
- break;
- case GL_SHORT:
- {
- GLshort *dst = (GLshort *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = (GLshort) source[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n );
- }
- }
- break;
- case GL_UNSIGNED_INT:
- {
- GLuint *dst = (GLuint *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = (GLuint) source[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n );
- }
- }
- break;
- case GL_INT:
- {
- GLint *dst = (GLint *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = (GLint) source[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n );
- }
- }
- break;
- case GL_FLOAT:
- {
- GLfloat *dst = (GLfloat *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = (GLfloat) source[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n );
- }
- }
- break;
- case GL_HALF_FLOAT_ARB:
- {
- GLhalfARB *dst = (GLhalfARB *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = _mesa_float_to_half((GLfloat) source[i]);
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n );
- }
- }
- break;
- default:
- _mesa_problem(ctx, "bad type in _mesa_pack_index_span");
- }
-
- free(indexes);
-}
-
-
-/*
- * Unpack a row of stencil data from a client buffer according to
- * the pixel unpacking parameters.
- * This is (or will be) used by glDrawPixels
- *
- * Args: ctx - the context
- * n - number of pixels
- * dstType - destination data type
- * dest - destination array
- * srcType - source pixel type
- * source - source data pointer
- * srcPacking - pixel unpacking parameters
- * transferOps - apply offset/bias/lookup ops?
- */
-void
-_mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest,
- GLenum srcType, const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps )
-{
- ASSERT(srcType == GL_BITMAP ||
- srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_BYTE ||
- srcType == GL_UNSIGNED_SHORT ||
- srcType == GL_SHORT ||
- srcType == GL_UNSIGNED_INT ||
- srcType == GL_INT ||
- srcType == GL_UNSIGNED_INT_24_8_EXT ||
- srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT);
-
- ASSERT(dstType == GL_UNSIGNED_BYTE ||
- dstType == GL_UNSIGNED_SHORT ||
- dstType == GL_UNSIGNED_INT);
-
- /* only shift and offset apply to stencil */
- transferOps &= IMAGE_SHIFT_OFFSET_BIT;
-
- /*
- * Try simple cases first
- */
- if (transferOps == 0 &&
- !ctx->Pixel.MapStencilFlag &&
- srcType == GL_UNSIGNED_BYTE &&
- dstType == GL_UNSIGNED_BYTE) {
- memcpy(dest, source, n * sizeof(GLubyte));
- }
- else if (transferOps == 0 &&
- !ctx->Pixel.MapStencilFlag &&
- srcType == GL_UNSIGNED_INT &&
- dstType == GL_UNSIGNED_INT &&
- !srcPacking->SwapBytes) {
- memcpy(dest, source, n * sizeof(GLuint));
- }
- else {
- /*
- * general solution
- */
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
-
- if (!indexes) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "stencil unpacking");
- return;
- }
-
- extract_uint_indexes(n, indexes, GL_STENCIL_INDEX, srcType, source,
- srcPacking);
-
- if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
- /* shift and offset indexes */
- _mesa_shift_and_offset_ci(ctx, n, indexes);
- }
-
- if (ctx->Pixel.MapStencilFlag) {
- /* Apply stencil lookup table */
- const GLuint mask = ctx->PixelMaps.StoS.Size - 1;
- GLuint i;
- for (i = 0; i < n; i++) {
- indexes[i] = (GLuint)ctx->PixelMaps.StoS.Map[ indexes[i] & mask ];
- }
- }
-
- /* convert to dest type */
- switch (dstType) {
- case GL_UNSIGNED_BYTE:
- {
- GLubyte *dst = (GLubyte *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = (GLubyte) (indexes[i] & 0xff);
- }
- }
- break;
- case GL_UNSIGNED_SHORT:
- {
- GLuint *dst = (GLuint *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = (GLushort) (indexes[i] & 0xffff);
- }
- }
- break;
- case GL_UNSIGNED_INT:
- memcpy(dest, indexes, n * sizeof(GLuint));
- break;
- default:
- _mesa_problem(ctx, "bad dstType in _mesa_unpack_stencil_span");
- }
-
- free(indexes);
- }
-}
-
-
-void
-_mesa_pack_stencil_span( struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest, const GLstencil *source,
- const struct gl_pixelstore_attrib *dstPacking )
-{
- GLstencil *stencil = (GLstencil *) malloc(n * sizeof(GLstencil));
-
- if (!stencil) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "stencil packing");
- return;
- }
-
- if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset ||
- ctx->Pixel.MapStencilFlag) {
- /* make a copy of input */
- memcpy(stencil, source, n * sizeof(GLstencil));
- _mesa_apply_stencil_transfer_ops(ctx, n, stencil);
- source = stencil;
- }
-
- switch (dstType) {
- case GL_UNSIGNED_BYTE:
- if (sizeof(GLstencil) == 1) {
- memcpy( dest, source, n );
- }
- else {
- GLubyte *dst = (GLubyte *) dest;
- GLuint i;
- for (i=0;i<n;i++) {
- dst[i] = (GLubyte) source[i];
- }
- }
- break;
- case GL_BYTE:
- {
- GLbyte *dst = (GLbyte *) dest;
- GLuint i;
- for (i=0;i<n;i++) {
- dst[i] = (GLbyte) (source[i] & 0x7f);
- }
- }
- break;
- case GL_UNSIGNED_SHORT:
- {
- GLushort *dst = (GLushort *) dest;
- GLuint i;
- for (i=0;i<n;i++) {
- dst[i] = (GLushort) source[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n );
- }
- }
- break;
- case GL_SHORT:
- {
- GLshort *dst = (GLshort *) dest;
- GLuint i;
- for (i=0;i<n;i++) {
- dst[i] = (GLshort) source[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n );
- }
- }
- break;
- case GL_UNSIGNED_INT:
- {
- GLuint *dst = (GLuint *) dest;
- GLuint i;
- for (i=0;i<n;i++) {
- dst[i] = (GLuint) source[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n );
- }
- }
- break;
- case GL_INT:
- {
- GLint *dst = (GLint *) dest;
- GLuint i;
- for (i=0;i<n;i++) {
- dst[i] = (GLint) source[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n );
- }
- }
- break;
- case GL_FLOAT:
- {
- GLfloat *dst = (GLfloat *) dest;
- GLuint i;
- for (i=0;i<n;i++) {
- dst[i] = (GLfloat) source[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n );
- }
- }
- break;
- case GL_HALF_FLOAT_ARB:
- {
- GLhalfARB *dst = (GLhalfARB *) dest;
- GLuint i;
- for (i=0;i<n;i++) {
- dst[i] = _mesa_float_to_half( (float) source[i] );
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n );
- }
- }
- break;
- case GL_BITMAP:
- if (dstPacking->LsbFirst) {
- GLubyte *dst = (GLubyte *) dest;
- GLint shift = 0;
- GLuint i;
- for (i = 0; i < n; i++) {
- if (shift == 0)
- *dst = 0;
- *dst |= ((source[i] != 0) << shift);
- shift++;
- if (shift == 8) {
- shift = 0;
- dst++;
- }
- }
- }
- else {
- GLubyte *dst = (GLubyte *) dest;
- GLint shift = 7;
- GLuint i;
- for (i = 0; i < n; i++) {
- if (shift == 7)
- *dst = 0;
- *dst |= ((source[i] != 0) << shift);
- shift--;
- if (shift < 0) {
- shift = 7;
- dst++;
- }
- }
- }
- break;
- default:
- _mesa_problem(ctx, "bad type in _mesa_pack_index_span");
- }
-
- free(stencil);
-}
-
-#define DEPTH_VALUES(GLTYPE, GLTYPE2FLOAT) \
- do { \
- GLuint i; \
- const GLTYPE *src = (const GLTYPE *)source; \
- for (i = 0; i < n; i++) { \
- GLTYPE value = src[i]; \
- if (srcPacking->SwapBytes) { \
- if (sizeof(GLTYPE) == 2) { \
- SWAP2BYTE(value); \
- } else if (sizeof(GLTYPE) == 4) { \
- SWAP4BYTE(value); \
- } \
- } \
- depthValues[i] = GLTYPE2FLOAT(value); \
- } \
- } while (0)
-
-
-/**
- * Unpack a row of depth/z values from memory, returning GLushort, GLuint
- * or GLfloat values.
- * The glPixelTransfer (scale/bias) params will be applied.
- *
- * \param dstType one of GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, GL_FLOAT
- * \param depthMax max value for returned GLushort or GLuint values
- * (ignored for GLfloat).
- */
-void
-_mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest, GLuint depthMax,
- GLenum srcType, const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking )
-{
- GLfloat *depthTemp, *depthValues;
- GLboolean needClamp = GL_FALSE;
-
- /* Look for special cases first.
- * Not only are these faster, they're less prone to numeric conversion
- * problems. Otherwise, converting from an int type to a float then
- * back to an int type can introduce errors that will show up as
- * artifacts in things like depth peeling which uses glCopyTexImage.
- */
- if (ctx->Pixel.DepthScale == 1.0 && ctx->Pixel.DepthBias == 0.0) {
- if (srcType == GL_UNSIGNED_INT && dstType == GL_UNSIGNED_SHORT) {
- const GLuint *src = (const GLuint *) source;
- GLushort *dst = (GLushort *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = src[i] >> 16;
- }
- return;
- }
- if (srcType == GL_UNSIGNED_SHORT
- && dstType == GL_UNSIGNED_INT
- && depthMax == 0xffffffff) {
- const GLushort *src = (const GLushort *) source;
- GLuint *dst = (GLuint *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = src[i] | (src[i] << 16);
- }
- return;
- }
- if (srcType == GL_UNSIGNED_INT_24_8
- && dstType == GL_UNSIGNED_INT
- && depthMax == 0xffffff) {
- const GLuint *src = (const GLuint *) source;
- GLuint *dst = (GLuint *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = src[i] >> 8;
- }
- return;
- }
- /* XXX may want to add additional cases here someday */
- }
-
- /* general case path follows */
-
- depthTemp = (GLfloat *) malloc(n * sizeof(GLfloat));
- if (!depthTemp) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
- return;
- }
-
- if (dstType == GL_FLOAT) {
- depthValues = (GLfloat *) dest;
- }
- else {
- depthValues = depthTemp;
- }
-
- /* Convert incoming values to GLfloat. Some conversions will require
- * clamping, below.
- */
- switch (srcType) {
- case GL_BYTE:
- DEPTH_VALUES(GLbyte, BYTE_TO_FLOAT);
- needClamp = GL_TRUE;
- break;
- case GL_UNSIGNED_BYTE:
- DEPTH_VALUES(GLubyte, UBYTE_TO_FLOAT);
- break;
- case GL_SHORT:
- DEPTH_VALUES(GLshort, SHORT_TO_FLOAT);
- needClamp = GL_TRUE;
- break;
- case GL_UNSIGNED_SHORT:
- DEPTH_VALUES(GLushort, USHORT_TO_FLOAT);
- break;
- case GL_INT:
- DEPTH_VALUES(GLint, INT_TO_FLOAT);
- needClamp = GL_TRUE;
- break;
- case GL_UNSIGNED_INT:
- DEPTH_VALUES(GLuint, UINT_TO_FLOAT);
- break;
- case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */
- if (dstType == GL_UNSIGNED_INT_24_8_EXT &&
- depthMax == 0xffffff &&
- ctx->Pixel.DepthScale == 1.0 &&
- ctx->Pixel.DepthBias == 0.0) {
- const GLuint *src = (const GLuint *) source;
- GLuint *zValues = (GLuint *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- GLuint value = src[i];
- if (srcPacking->SwapBytes) {
- SWAP4BYTE(value);
- }
- zValues[i] = value & 0xffffff00;
- }
- return;
- }
- else {
- const GLuint *src = (const GLuint *) source;
- const GLfloat scale = 1.0f / 0xffffff;
- GLuint i;
- for (i = 0; i < n; i++) {
- GLuint value = src[i];
- if (srcPacking->SwapBytes) {
- SWAP4BYTE(value);
- }
- depthValues[i] = (value >> 8) * scale;
- }
- }
- break;
- case GL_FLOAT:
- DEPTH_VALUES(GLfloat, 1*);
- needClamp = GL_TRUE;
- break;
- case GL_HALF_FLOAT_ARB:
- {
- GLuint i;
- const GLhalfARB *src = (const GLhalfARB *) source;
- for (i = 0; i < n; i++) {
- GLhalfARB value = src[i];
- if (srcPacking->SwapBytes) {
- SWAP2BYTE(value);
- }
- depthValues[i] = _mesa_half_to_float(value);
- }
- needClamp = GL_TRUE;
- }
- break;
- default:
- _mesa_problem(NULL, "bad type in _mesa_unpack_depth_span()");
- free(depthTemp);
- return;
- }
-
- /* apply depth scale and bias */
- {
- const GLfloat scale = ctx->Pixel.DepthScale;
- const GLfloat bias = ctx->Pixel.DepthBias;
- if (scale != 1.0 || bias != 0.0) {
- GLuint i;
- for (i = 0; i < n; i++) {
- depthValues[i] = depthValues[i] * scale + bias;
- }
- needClamp = GL_TRUE;
- }
- }
-
- /* clamp to [0, 1] */
- if (needClamp) {
- GLuint i;
- for (i = 0; i < n; i++) {
- depthValues[i] = (GLfloat)CLAMP(depthValues[i], 0.0, 1.0);
- }
- }
-
- /*
- * Convert values to dstType
- */
- if (dstType == GL_UNSIGNED_INT) {
- GLuint *zValues = (GLuint *) dest;
- GLuint i;
- if (depthMax <= 0xffffff) {
- /* no overflow worries */
- for (i = 0; i < n; i++) {
- zValues[i] = (GLuint) (depthValues[i] * (GLfloat) depthMax);
- }
- }
- else {
- /* need to use double precision to prevent overflow problems */
- for (i = 0; i < n; i++) {
- GLdouble z = depthValues[i] * (GLfloat) depthMax;
- if (z >= (GLdouble) 0xffffffff)
- zValues[i] = 0xffffffff;
- else
- zValues[i] = (GLuint) z;
- }
- }
- }
- else if (dstType == GL_UNSIGNED_SHORT) {
- GLushort *zValues = (GLushort *) dest;
- GLuint i;
- ASSERT(depthMax <= 0xffff);
- for (i = 0; i < n; i++) {
- zValues[i] = (GLushort) (depthValues[i] * (GLfloat) depthMax);
- }
- }
- else {
- ASSERT(dstType == GL_FLOAT);
- /*ASSERT(depthMax == 1.0F);*/
- }
-
- free(depthTemp);
-}
-
-
-/*
- * Pack an array of depth values. The values are floats in [0,1].
- */
-void
-_mesa_pack_depth_span( struct gl_context *ctx, GLuint n, GLvoid *dest,
- GLenum dstType, const GLfloat *depthSpan,
- const struct gl_pixelstore_attrib *dstPacking )
-{
- GLfloat *depthCopy = (GLfloat *) malloc(n * sizeof(GLfloat));
- if (!depthCopy) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
- return;
- }
-
- if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
- memcpy(depthCopy, depthSpan, n * sizeof(GLfloat));
- _mesa_scale_and_bias_depth(ctx, n, depthCopy);
- depthSpan = depthCopy;
- }
-
- switch (dstType) {
- case GL_UNSIGNED_BYTE:
- {
- GLubyte *dst = (GLubyte *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = FLOAT_TO_UBYTE( depthSpan[i] );
- }
- }
- break;
- case GL_BYTE:
- {
- GLbyte *dst = (GLbyte *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = FLOAT_TO_BYTE( depthSpan[i] );
- }
- }
- break;
- case GL_UNSIGNED_SHORT:
- {
- GLushort *dst = (GLushort *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- CLAMPED_FLOAT_TO_USHORT(dst[i], depthSpan[i]);
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n );
- }
- }
- break;
- case GL_SHORT:
- {
- GLshort *dst = (GLshort *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = FLOAT_TO_SHORT( depthSpan[i] );
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n );
- }
- }
- break;
- case GL_UNSIGNED_INT:
- {
- GLuint *dst = (GLuint *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = FLOAT_TO_UINT( depthSpan[i] );
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n );
- }
- }
- break;
- case GL_INT:
- {
- GLint *dst = (GLint *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = FLOAT_TO_INT( depthSpan[i] );
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n );
- }
- }
- break;
- case GL_FLOAT:
- {
- GLfloat *dst = (GLfloat *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = depthSpan[i];
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n );
- }
- }
- break;
- case GL_HALF_FLOAT_ARB:
- {
- GLhalfARB *dst = (GLhalfARB *) dest;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i] = _mesa_float_to_half(depthSpan[i]);
- }
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n );
- }
- }
- break;
- default:
- _mesa_problem(ctx, "bad type in _mesa_pack_depth_span");
- }
-
- free(depthCopy);
-}
-
-
-
-/**
- * Pack depth and stencil values as GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8.
- */
-void
-_mesa_pack_depth_stencil_span(struct gl_context *ctx, GLuint n, GLuint *dest,
- const GLfloat *depthVals,
- const GLstencil *stencilVals,
- const struct gl_pixelstore_attrib *dstPacking)
-{
- GLfloat *depthCopy = (GLfloat *) malloc(n * sizeof(GLfloat));
- GLstencil *stencilCopy = (GLstencil *) malloc(n * sizeof(GLstencil));
- GLuint i;
-
- if (!depthCopy || !stencilCopy) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
- free(depthCopy);
- free(stencilCopy);
- return;
- }
-
- if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
- memcpy(depthCopy, depthVals, n * sizeof(GLfloat));
- _mesa_scale_and_bias_depth(ctx, n, depthCopy);
- depthVals = depthCopy;
- }
-
- if (ctx->Pixel.IndexShift ||
- ctx->Pixel.IndexOffset ||
- ctx->Pixel.MapStencilFlag) {
- memcpy(stencilCopy, stencilVals, n * sizeof(GLstencil));
- _mesa_apply_stencil_transfer_ops(ctx, n, stencilCopy);
- stencilVals = stencilCopy;
- }
-
- for (i = 0; i < n; i++) {
- GLuint z = (GLuint) (depthVals[i] * 0xffffff);
- dest[i] = (z << 8) | (stencilVals[i] & 0xff);
- }
-
- if (dstPacking->SwapBytes) {
- _mesa_swap4(dest, n);
- }
-
- free(depthCopy);
- free(stencilCopy);
-}
-
-
-
-
-/**
- * Unpack image data. Apply byte swapping, byte flipping (bitmap).
- * Return all image data in a contiguous block. This is used when we
- * compile glDrawPixels, glTexImage, etc into a display list. We
- * need a copy of the data in a standard format.
- */
-void *
-_mesa_unpack_image( GLuint dimensions,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *unpack )
-{
- GLint bytesPerRow, compsPerRow;
- GLboolean flipBytes, swap2, swap4;
-
- if (!pixels)
- return NULL; /* not necessarily an error */
-
- if (width <= 0 || height <= 0 || depth <= 0)
- return NULL; /* generate error later */
-
- if (type == GL_BITMAP) {
- bytesPerRow = (width + 7) >> 3;
- flipBytes = unpack->LsbFirst;
- swap2 = swap4 = GL_FALSE;
- compsPerRow = 0;
- }
- else {
- const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
- GLint components = _mesa_components_in_format(format);
- GLint bytesPerComp;
-
- if (_mesa_type_is_packed(type))
- components = 1;
-
- if (bytesPerPixel <= 0 || components <= 0)
- return NULL; /* bad format or type. generate error later */
- bytesPerRow = bytesPerPixel * width;
- bytesPerComp = bytesPerPixel / components;
- flipBytes = GL_FALSE;
- swap2 = (bytesPerComp == 2) && unpack->SwapBytes;
- swap4 = (bytesPerComp == 4) && unpack->SwapBytes;
- compsPerRow = components * width;
- assert(compsPerRow >= width);
- }
-
- {
- GLubyte *destBuffer
- = (GLubyte *) malloc(bytesPerRow * height * depth);
- GLubyte *dst;
- GLint img, row;
- if (!destBuffer)
- return NULL; /* generate GL_OUT_OF_MEMORY later */
-
- dst = destBuffer;
- for (img = 0; img < depth; img++) {
- for (row = 0; row < height; row++) {
- const GLvoid *src = _mesa_image_address(dimensions, unpack, pixels,
- width, height, format, type, img, row, 0);
-
- if ((type == GL_BITMAP) && (unpack->SkipPixels & 0x7)) {
- GLint i;
- flipBytes = GL_FALSE;
- if (unpack->LsbFirst) {
- GLubyte srcMask = 1 << (unpack->SkipPixels & 0x7);
- GLubyte dstMask = 128;
- const GLubyte *s = src;
- GLubyte *d = dst;
- *d = 0;
- for (i = 0; i < width; i++) {
- if (*s & srcMask) {
- *d |= dstMask;
- }
- if (srcMask == 128) {
- srcMask = 1;
- s++;
- }
- else {
- srcMask = srcMask << 1;
- }
- if (dstMask == 1) {
- dstMask = 128;
- d++;
- *d = 0;
- }
- else {
- dstMask = dstMask >> 1;
- }
- }
- }
- else {
- GLubyte srcMask = 128 >> (unpack->SkipPixels & 0x7);
- GLubyte dstMask = 128;
- const GLubyte *s = src;
- GLubyte *d = dst;
- *d = 0;
- for (i = 0; i < width; i++) {
- if (*s & srcMask) {
- *d |= dstMask;
- }
- if (srcMask == 1) {
- srcMask = 128;
- s++;
- }
- else {
- srcMask = srcMask >> 1;
- }
- if (dstMask == 1) {
- dstMask = 128;
- d++;
- *d = 0;
- }
- else {
- dstMask = dstMask >> 1;
- }
- }
- }
- }
- else {
- memcpy(dst, src, bytesPerRow);
- }
-
- /* byte flipping/swapping */
- if (flipBytes) {
- flip_bytes((GLubyte *) dst, bytesPerRow);
- }
- else if (swap2) {
- _mesa_swap2((GLushort*) dst, compsPerRow);
- }
- else if (swap4) {
- _mesa_swap4((GLuint*) dst, compsPerRow);
- }
- dst += bytesPerRow;
- }
- }
- return destBuffer;
- }
-}
-
diff --git a/src/mesa/main/pack.h b/src/mesa/main/pack.h
deleted file mode 100644
index 78238ea..0000000
--- a/src/mesa/main/pack.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (C) 1999-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 PACK_H
-#define PACK_H
-
-
-#include "mtypes.h"
-
-
-extern void
-_mesa_unpack_polygon_stipple(const GLubyte *pattern, GLuint dest[32],
- const struct gl_pixelstore_attrib *unpacking);
-
-
-extern void
-_mesa_pack_polygon_stipple(const GLuint pattern[32], GLubyte *dest,
- const struct gl_pixelstore_attrib *packing);
-
-
-extern GLvoid *
-_mesa_unpack_bitmap(GLint width, GLint height, const GLubyte *pixels,
- const struct gl_pixelstore_attrib *packing);
-
-extern void
-_mesa_pack_bitmap(GLint width, GLint height, const GLubyte *source,
- GLubyte *dest, const struct gl_pixelstore_attrib *packing);
-
-
-extern void
-_mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n,
- GLfloat rgba[][4],
- GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
- const struct gl_pixelstore_attrib *dstPacking,
- GLbitfield transferOps);
-
-
-extern void
-_mesa_unpack_color_span_chan(struct gl_context *ctx,
- GLuint n, GLenum dstFormat, GLchan dest[],
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps);
-
-
-extern void
-_mesa_unpack_color_span_float(struct gl_context *ctx,
- GLuint n, GLenum dstFormat, GLfloat dest[],
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps);
-
-extern void
-_mesa_unpack_color_span_uint(struct gl_context *ctx,
- GLuint n, GLenum dstFormat, GLuint *dest,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking);
-
-extern void
-_mesa_unpack_dudv_span_byte(struct gl_context *ctx,
- GLuint n, GLenum dstFormat, GLbyte dest[],
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps);
-
-extern void
-_mesa_unpack_index_span(struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest,
- GLenum srcType, const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps);
-
-
-extern void
-_mesa_pack_index_span(struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest, const GLuint *source,
- const struct gl_pixelstore_attrib *dstPacking,
- GLbitfield transferOps);
-
-
-extern void
-_mesa_unpack_stencil_span(struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest,
- GLenum srcType, const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps);
-
-extern void
-_mesa_pack_stencil_span(struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest, const GLstencil *source,
- const struct gl_pixelstore_attrib *dstPacking);
-
-
-extern void
-_mesa_unpack_depth_span(struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest, GLuint depthMax,
- GLenum srcType, const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking);
-
-extern void
-_mesa_pack_depth_span(struct gl_context *ctx, GLuint n, GLvoid *dest,
- GLenum dstType, const GLfloat *depthSpan,
- const struct gl_pixelstore_attrib *dstPacking);
-
-
-extern void
-_mesa_pack_depth_stencil_span(struct gl_context *ctx,
- GLuint n, GLuint *dest,
- const GLfloat *depthVals,
- const GLstencil *stencilVals,
- const struct gl_pixelstore_attrib *dstPacking);
-
-
-extern void *
-_mesa_unpack_image(GLuint dimensions,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *unpack);
-
-
-#endif
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
deleted file mode 100644
index 5f824b3..0000000
--- a/src/mesa/main/pixel.c
+++ /dev/null
@@ -1,700 +0,0 @@
-/*
- * 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 pixel.c
- * Pixel transfer functions (glPixelZoom, glPixelMap, glPixelTransfer)
- */
-
-#include "glheader.h"
-#include "bufferobj.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "pixel.h"
-#include "mtypes.h"
-#include "main/dispatch.h"
-
-
-#if FEATURE_pixel_transfer
-
-
-/**********************************************************************/
-/***** glPixelZoom *****/
-/**********************************************************************/
-
-static void GLAPIENTRY
-_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
-{
- GET_CURRENT_CONTEXT(ctx);
-
- if (ctx->Pixel.ZoomX == xfactor &&
- ctx->Pixel.ZoomY == yfactor)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.ZoomX = xfactor;
- ctx->Pixel.ZoomY = yfactor;
-}
-
-
-
-/**********************************************************************/
-/***** glPixelMap *****/
-/**********************************************************************/
-
-/**
- * Return pointer to a pixelmap by name.
- */
-static struct gl_pixelmap *
-get_pixelmap(struct gl_context *ctx, GLenum map)
-{
- switch (map) {
- case GL_PIXEL_MAP_I_TO_I:
- return &ctx->PixelMaps.ItoI;
- case GL_PIXEL_MAP_S_TO_S:
- return &ctx->PixelMaps.StoS;
- case GL_PIXEL_MAP_I_TO_R:
- return &ctx->PixelMaps.ItoR;
- case GL_PIXEL_MAP_I_TO_G:
- return &ctx->PixelMaps.ItoG;
- case GL_PIXEL_MAP_I_TO_B:
- return &ctx->PixelMaps.ItoB;
- case GL_PIXEL_MAP_I_TO_A:
- return &ctx->PixelMaps.ItoA;
- case GL_PIXEL_MAP_R_TO_R:
- return &ctx->PixelMaps.RtoR;
- case GL_PIXEL_MAP_G_TO_G:
- return &ctx->PixelMaps.GtoG;
- case GL_PIXEL_MAP_B_TO_B:
- return &ctx->PixelMaps.BtoB;
- case GL_PIXEL_MAP_A_TO_A:
- return &ctx->PixelMaps.AtoA;
- default:
- return NULL;
- }
-}
-
-
-/**
- * Helper routine used by the other _mesa_PixelMap() functions.
- */
-static void
-store_pixelmap(struct gl_context *ctx, GLenum map, GLsizei mapsize,
- const GLfloat *values)
-{
- GLint i;
- struct gl_pixelmap *pm = get_pixelmap(ctx, map);
- if (!pm) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glPixelMap(map)");
- return;
- }
-
- switch (map) {
- case GL_PIXEL_MAP_S_TO_S:
- /* special case */
- ctx->PixelMaps.StoS.Size = mapsize;
- for (i = 0; i < mapsize; i++) {
- ctx->PixelMaps.StoS.Map[i] = (GLfloat)IROUND(values[i]);
- }
- break;
- case GL_PIXEL_MAP_I_TO_I:
- /* special case */
- ctx->PixelMaps.ItoI.Size = mapsize;
- for (i = 0; i < mapsize; i++) {
- ctx->PixelMaps.ItoI.Map[i] = values[i];
- }
- break;
- default:
- /* general case */
- pm->Size = mapsize;
- for (i = 0; i < mapsize; i++) {
- GLfloat val = CLAMP(values[i], 0.0F, 1.0F);
- pm->Map[i] = val;
- pm->Map8[i] = (GLint) (val * 255.0F);
- }
- }
-}
-
-
-/**
- * Convenience wrapper for _mesa_validate_pbo_access() for gl[Get]PixelMap().
- */
-static GLboolean
-validate_pbo_access(struct gl_context *ctx, struct gl_pixelstore_attrib *pack,
- GLsizei mapsize, GLenum format, GLenum type,
- const GLvoid *ptr)
-{
- GLboolean ok;
-
- /* Note, need to use DefaultPacking and Unpack's buffer object */
- _mesa_reference_buffer_object(ctx,
- &ctx->DefaultPacking.BufferObj,
- pack->BufferObj);
-
- ok = _mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1,
- format, type, ptr);
-
- /* restore */
- _mesa_reference_buffer_object(ctx,
- &ctx->DefaultPacking.BufferObj,
- ctx->Shared->NullBufferObj);
-
- if (!ok) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glPixelMap(invalid PBO access)");
- }
- return ok;
-}
-
-
-static void GLAPIENTRY
-_mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- /* XXX someday, test against ctx->Const.MaxPixelMapTableSize */
- if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" );
- return;
- }
-
- if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) {
- /* test that mapsize is a power of two */
- if (!_mesa_is_pow_two(mapsize)) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" );
- return;
- }
- }
-
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
-
- if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize,
- GL_INTENSITY, GL_FLOAT, values)) {
- return;
- }
-
- values = (const GLfloat *) _mesa_map_pbo_source(ctx, &ctx->Unpack, values);
- if (!values) {
- if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glPixelMapfv(PBO is mapped)");
- }
- return;
- }
-
- store_pixelmap(ctx, map, mapsize, values);
-
- _mesa_unmap_pbo_source(ctx, &ctx->Unpack);
-}
-
-
-static void GLAPIENTRY
-_mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )
-{
- GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" );
- return;
- }
-
- if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) {
- /* test that mapsize is a power of two */
- if (!_mesa_is_pow_two(mapsize)) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" );
- return;
- }
- }
-
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
-
- if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize,
- GL_INTENSITY, GL_UNSIGNED_INT, values)) {
- return;
- }
-
- values = (const GLuint *) _mesa_map_pbo_source(ctx, &ctx->Unpack, values);
- if (!values) {
- if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glPixelMapuiv(PBO is mapped)");
- }
- return;
- }
-
- /* convert to floats */
- if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
- GLint i;
- for (i = 0; i < mapsize; i++) {
- fvalues[i] = (GLfloat) values[i];
- }
- }
- else {
- GLint i;
- for (i = 0; i < mapsize; i++) {
- fvalues[i] = UINT_TO_FLOAT( values[i] );
- }
- }
-
- _mesa_unmap_pbo_source(ctx, &ctx->Unpack);
-
- store_pixelmap(ctx, map, mapsize, fvalues);
-}
-
-
-static void GLAPIENTRY
-_mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )
-{
- GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapusv(mapsize)" );
- return;
- }
-
- if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) {
- /* test that mapsize is a power of two */
- if (!_mesa_is_pow_two(mapsize)) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" );
- return;
- }
- }
-
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
-
- if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize,
- GL_INTENSITY, GL_UNSIGNED_SHORT, values)) {
- return;
- }
-
- values = (const GLushort *) _mesa_map_pbo_source(ctx, &ctx->Unpack, values);
- if (!values) {
- if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glPixelMapusv(PBO is mapped)");
- }
- return;
- }
-
- /* convert to floats */
- if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
- GLint i;
- for (i = 0; i < mapsize; i++) {
- fvalues[i] = (GLfloat) values[i];
- }
- }
- else {
- GLint i;
- for (i = 0; i < mapsize; i++) {
- fvalues[i] = USHORT_TO_FLOAT( values[i] );
- }
- }
-
- _mesa_unmap_pbo_source(ctx, &ctx->Unpack);
-
- store_pixelmap(ctx, map, mapsize, fvalues);
-}
-
-
-static void GLAPIENTRY
-_mesa_GetPixelMapfv( GLenum map, GLfloat *values )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint mapsize, i;
- const struct gl_pixelmap *pm;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- pm = get_pixelmap(ctx, map);
- if (!pm) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapfv(map)");
- return;
- }
-
- mapsize = pm->Size;
-
- if (!validate_pbo_access(ctx, &ctx->Pack, mapsize,
- GL_INTENSITY, GL_FLOAT, values)) {
- return;
- }
-
- values = (GLfloat *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values);
- if (!values) {
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetPixelMapfv(PBO is mapped)");
- }
- return;
- }
-
- if (map == GL_PIXEL_MAP_S_TO_S) {
- /* special case */
- for (i = 0; i < mapsize; i++) {
- values[i] = (GLfloat) ctx->PixelMaps.StoS.Map[i];
- }
- }
- else {
- memcpy(values, pm->Map, mapsize * sizeof(GLfloat));
- }
-
- _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
-}
-
-
-static void GLAPIENTRY
-_mesa_GetPixelMapuiv( GLenum map, GLuint *values )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint mapsize, i;
- const struct gl_pixelmap *pm;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- pm = get_pixelmap(ctx, map);
- if (!pm) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapuiv(map)");
- return;
- }
- mapsize = pm->Size;
-
- if (!validate_pbo_access(ctx, &ctx->Pack, mapsize,
- GL_INTENSITY, GL_UNSIGNED_INT, values)) {
- return;
- }
-
- values = (GLuint *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values);
- if (!values) {
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetPixelMapuiv(PBO is mapped)");
- }
- return;
- }
-
- if (map == GL_PIXEL_MAP_S_TO_S) {
- /* special case */
- memcpy(values, ctx->PixelMaps.StoS.Map, mapsize * sizeof(GLint));
- }
- else {
- for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( pm->Map[i] );
- }
- }
-
- _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
-}
-
-
-static void GLAPIENTRY
-_mesa_GetPixelMapusv( GLenum map, GLushort *values )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint mapsize, i;
- const struct gl_pixelmap *pm;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- pm = get_pixelmap(ctx, map);
- if (!pm) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapusv(map)");
- return;
- }
- mapsize = pm->Size;
-
- if (!validate_pbo_access(ctx, &ctx->Pack, mapsize,
- GL_INTENSITY, GL_UNSIGNED_SHORT, values)) {
- return;
- }
-
- values = (GLushort *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values);
- if (!values) {
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetPixelMapusv(PBO is mapped)");
- }
- return;
- }
-
- switch (map) {
- /* special cases */
- case GL_PIXEL_MAP_I_TO_I:
- for (i = 0; i < mapsize; i++) {
- values[i] = (GLushort) CLAMP(ctx->PixelMaps.ItoI.Map[i], 0.0, 65535.);
- }
- break;
- case GL_PIXEL_MAP_S_TO_S:
- for (i = 0; i < mapsize; i++) {
- values[i] = (GLushort) CLAMP(ctx->PixelMaps.StoS.Map[i], 0.0, 65535.);
- }
- break;
- default:
- for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i], pm->Map[i] );
- }
- }
-
- _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
-}
-
-
-
-/**********************************************************************/
-/***** glPixelTransfer *****/
-/**********************************************************************/
-
-
-/*
- * Implements glPixelTransfer[fi] whether called immediately or from a
- * display list.
- */
-static void GLAPIENTRY
-_mesa_PixelTransferf( GLenum pname, GLfloat param )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- switch (pname) {
- case GL_MAP_COLOR:
- if (ctx->Pixel.MapColorFlag == (param ? GL_TRUE : GL_FALSE))
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.MapColorFlag = param ? GL_TRUE : GL_FALSE;
- break;
- case GL_MAP_STENCIL:
- if (ctx->Pixel.MapStencilFlag == (param ? GL_TRUE : GL_FALSE))
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.MapStencilFlag = param ? GL_TRUE : GL_FALSE;
- break;
- case GL_INDEX_SHIFT:
- if (ctx->Pixel.IndexShift == (GLint) param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.IndexShift = (GLint) param;
- break;
- case GL_INDEX_OFFSET:
- if (ctx->Pixel.IndexOffset == (GLint) param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.IndexOffset = (GLint) param;
- break;
- case GL_RED_SCALE:
- if (ctx->Pixel.RedScale == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.RedScale = param;
- break;
- case GL_RED_BIAS:
- if (ctx->Pixel.RedBias == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.RedBias = param;
- break;
- case GL_GREEN_SCALE:
- if (ctx->Pixel.GreenScale == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.GreenScale = param;
- break;
- case GL_GREEN_BIAS:
- if (ctx->Pixel.GreenBias == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.GreenBias = param;
- break;
- case GL_BLUE_SCALE:
- if (ctx->Pixel.BlueScale == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.BlueScale = param;
- break;
- case GL_BLUE_BIAS:
- if (ctx->Pixel.BlueBias == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.BlueBias = param;
- break;
- case GL_ALPHA_SCALE:
- if (ctx->Pixel.AlphaScale == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.AlphaScale = param;
- break;
- case GL_ALPHA_BIAS:
- if (ctx->Pixel.AlphaBias == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.AlphaBias = param;
- break;
- case GL_DEPTH_SCALE:
- if (ctx->Pixel.DepthScale == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.DepthScale = param;
- break;
- case GL_DEPTH_BIAS:
- if (ctx->Pixel.DepthBias == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.DepthBias = param;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" );
- return;
- }
-}
-
-
-static void GLAPIENTRY
-_mesa_PixelTransferi( GLenum pname, GLint param )
-{
- _mesa_PixelTransferf( pname, (GLfloat) param );
-}
-
-
-
-/**********************************************************************/
-/***** State Management *****/
-/**********************************************************************/
-
-/*
- * Return a bitmask of IMAGE_*_BIT flags which to indicate which
- * pixel transfer operations are enabled.
- */
-static void
-update_image_transfer_state(struct gl_context *ctx)
-{
- GLuint mask = 0;
-
- if (ctx->Pixel.RedScale != 1.0F || ctx->Pixel.RedBias != 0.0F ||
- ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F ||
- ctx->Pixel.BlueScale != 1.0F || ctx->Pixel.BlueBias != 0.0F ||
- ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F)
- mask |= IMAGE_SCALE_BIAS_BIT;
-
- if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset)
- mask |= IMAGE_SHIFT_OFFSET_BIT;
-
- if (ctx->Pixel.MapColorFlag)
- mask |= IMAGE_MAP_COLOR_BIT;
-
- ctx->_ImageTransferState = mask;
-}
-
-
-/**
- * Update mesa pixel transfer derived state.
- */
-void _mesa_update_pixel( struct gl_context *ctx, GLuint new_state )
-{
- if (new_state & _MESA_NEW_TRANSFER_STATE)
- update_image_transfer_state(ctx);
-}
-
-
-void
-_mesa_init_pixel_dispatch(struct _glapi_table *disp)
-{
- SET_GetPixelMapfv(disp, _mesa_GetPixelMapfv);
- SET_GetPixelMapuiv(disp, _mesa_GetPixelMapuiv);
- SET_GetPixelMapusv(disp, _mesa_GetPixelMapusv);
- SET_PixelMapfv(disp, _mesa_PixelMapfv);
- SET_PixelMapuiv(disp, _mesa_PixelMapuiv);
- SET_PixelMapusv(disp, _mesa_PixelMapusv);
- SET_PixelTransferf(disp, _mesa_PixelTransferf);
- SET_PixelTransferi(disp, _mesa_PixelTransferi);
- SET_PixelZoom(disp, _mesa_PixelZoom);
-}
-
-
-#endif /* FEATURE_pixel_transfer */
-
-
-/**********************************************************************/
-/***** Initialization *****/
-/**********************************************************************/
-
-static void
-init_pixelmap(struct gl_pixelmap *map)
-{
- map->Size = 1;
- map->Map[0] = 0.0;
- map->Map8[0] = 0;
-}
-
-
-/**
- * Initialize the context's PIXEL attribute group.
- */
-void
-_mesa_init_pixel( struct gl_context *ctx )
-{
- /* Pixel group */
- ctx->Pixel.RedBias = 0.0;
- ctx->Pixel.RedScale = 1.0;
- ctx->Pixel.GreenBias = 0.0;
- ctx->Pixel.GreenScale = 1.0;
- ctx->Pixel.BlueBias = 0.0;
- ctx->Pixel.BlueScale = 1.0;
- ctx->Pixel.AlphaBias = 0.0;
- ctx->Pixel.AlphaScale = 1.0;
- ctx->Pixel.DepthBias = 0.0;
- ctx->Pixel.DepthScale = 1.0;
- ctx->Pixel.IndexOffset = 0;
- ctx->Pixel.IndexShift = 0;
- ctx->Pixel.ZoomX = 1.0;
- ctx->Pixel.ZoomY = 1.0;
- ctx->Pixel.MapColorFlag = GL_FALSE;
- ctx->Pixel.MapStencilFlag = GL_FALSE;
- init_pixelmap(&ctx->PixelMaps.StoS);
- init_pixelmap(&ctx->PixelMaps.ItoI);
- init_pixelmap(&ctx->PixelMaps.ItoR);
- init_pixelmap(&ctx->PixelMaps.ItoG);
- init_pixelmap(&ctx->PixelMaps.ItoB);
- init_pixelmap(&ctx->PixelMaps.ItoA);
- init_pixelmap(&ctx->PixelMaps.RtoR);
- init_pixelmap(&ctx->PixelMaps.GtoG);
- init_pixelmap(&ctx->PixelMaps.BtoB);
- init_pixelmap(&ctx->PixelMaps.AtoA);
- /* GL_SGI_texture_color_table */
- ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0);
- ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0);
-
- if (ctx->Visual.doubleBufferMode) {
- ctx->Pixel.ReadBuffer = GL_BACK;
- }
- else {
- ctx->Pixel.ReadBuffer = GL_FRONT;
- }
-
- /* Miscellaneous */
- ctx->_ImageTransferState = 0;
-}
diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h
deleted file mode 100644
index 6f04eb6..0000000
--- a/src/mesa/main/pixel.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 pixel.h
- * Pixel operations.
- */
-
-
-#ifndef PIXEL_H
-#define PIXEL_H
-
-
-#include "compiler.h"
-#include "glheader.h"
-#include "mfeatures.h"
-
-struct _glapi_table;
-struct gl_context;
-
-
-#if FEATURE_pixel_transfer
-
-extern void
-_mesa_update_pixel( struct gl_context *ctx, GLuint newstate );
-
-extern void
-_mesa_init_pixel_dispatch( struct _glapi_table * disp );
-
-#else /* FEATURE_pixel_transfer */
-
-static INLINE void
-_mesa_update_pixel(struct gl_context *ctx, GLuint newstate)
-{
-}
-
-static INLINE void
-_mesa_init_pixel_dispatch(struct _glapi_table *disp)
-{
-}
-
-#endif /* FEATURE_pixel_transfer */
-
-
-extern void
-_mesa_init_pixel( struct gl_context * ctx );
-
-/*@}*/
-
-#endif /* PIXEL_H */
diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c
deleted file mode 100644
index b16d27a..0000000
--- a/src/mesa/main/pixelstore.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * 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 pixelstore.c
- * glPixelStore functions.
- */
-
-
-#include "glheader.h"
-#include "bufferobj.h"
-#include "context.h"
-#include "pixelstore.h"
-#include "mtypes.h"
-
-
-void GLAPIENTRY
-_mesa_PixelStorei( GLenum pname, GLint param )
-{
- /* NOTE: this call can't be compiled into the display list */
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- switch (pname) {
- case GL_PACK_SWAP_BYTES:
- if (param == (GLint)ctx->Pack.SwapBytes)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
- break;
- case GL_PACK_LSB_FIRST:
- if (param == (GLint)ctx->Pack.LsbFirst)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
- break;
- case GL_PACK_ROW_LENGTH:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.RowLength == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.RowLength = param;
- break;
- case GL_PACK_IMAGE_HEIGHT:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.ImageHeight == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.ImageHeight = param;
- break;
- case GL_PACK_SKIP_PIXELS:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.SkipPixels == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.SkipPixels = param;
- break;
- case GL_PACK_SKIP_ROWS:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.SkipRows == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.SkipRows = param;
- break;
- case GL_PACK_SKIP_IMAGES:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.SkipImages == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.SkipImages = param;
- break;
- case GL_PACK_ALIGNMENT:
- if (param!=1 && param!=2 && param!=4 && param!=8) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.Alignment == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.Alignment = param;
- break;
- case GL_PACK_INVERT_MESA:
- if (!ctx->Extensions.MESA_pack_invert) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
- return;
- }
- if (ctx->Pack.Invert == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.Invert = param;
- break;
-
- case GL_UNPACK_SWAP_BYTES:
- if (param == (GLint)ctx->Unpack.SwapBytes)
- return;
- if ((GLint)ctx->Unpack.SwapBytes == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
- break;
- case GL_UNPACK_LSB_FIRST:
- if (param == (GLint)ctx->Unpack.LsbFirst)
- return;
- if ((GLint)ctx->Unpack.LsbFirst == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
- break;
- case GL_UNPACK_ROW_LENGTH:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Unpack.RowLength == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.RowLength = param;
- break;
- case GL_UNPACK_IMAGE_HEIGHT:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Unpack.ImageHeight == param)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.ImageHeight = param;
- break;
- case GL_UNPACK_SKIP_PIXELS:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Unpack.SkipPixels == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.SkipPixels = param;
- break;
- case GL_UNPACK_SKIP_ROWS:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Unpack.SkipRows == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.SkipRows = param;
- break;
- case GL_UNPACK_SKIP_IMAGES:
- if (param < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Unpack.SkipImages == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.SkipImages = param;
- break;
- case GL_UNPACK_ALIGNMENT:
- if (param!=1 && param!=2 && param!=4 && param!=8) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" );
- return;
- }
- if (ctx->Unpack.Alignment == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.Alignment = param;
- break;
- case GL_UNPACK_CLIENT_STORAGE_APPLE:
- if (param == (GLint)ctx->Unpack.ClientStorage)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_PixelStoref( GLenum pname, GLfloat param )
-{
- _mesa_PixelStorei( pname, (GLint) param );
-}
-
-
-
-/**
- * Initialize the context's pixel store state.
- */
-void
-_mesa_init_pixelstore( struct gl_context *ctx )
-{
- /* Pixel transfer */
- ctx->Pack.Alignment = 4;
- ctx->Pack.RowLength = 0;
- ctx->Pack.ImageHeight = 0;
- ctx->Pack.SkipPixels = 0;
- ctx->Pack.SkipRows = 0;
- ctx->Pack.SkipImages = 0;
- ctx->Pack.SwapBytes = GL_FALSE;
- ctx->Pack.LsbFirst = GL_FALSE;
- ctx->Pack.ClientStorage = GL_FALSE;
- ctx->Pack.Invert = GL_FALSE;
-#if FEATURE_EXT_pixel_buffer_object
- _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj,
- ctx->Shared->NullBufferObj);
-#endif
- ctx->Unpack.Alignment = 4;
- ctx->Unpack.RowLength = 0;
- ctx->Unpack.ImageHeight = 0;
- ctx->Unpack.SkipPixels = 0;
- ctx->Unpack.SkipRows = 0;
- ctx->Unpack.SkipImages = 0;
- ctx->Unpack.SwapBytes = GL_FALSE;
- ctx->Unpack.LsbFirst = GL_FALSE;
- ctx->Unpack.ClientStorage = GL_FALSE;
- ctx->Unpack.Invert = GL_FALSE;
-#if FEATURE_EXT_pixel_buffer_object
- _mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj,
- ctx->Shared->NullBufferObj);
-#endif
-
- /*
- * _mesa_unpack_image() returns image data in this format. When we
- * execute image commands (glDrawPixels(), glTexImage(), etc) from
- * within display lists we have to be sure to set the current
- * unpacking parameters to these values!
- */
- ctx->DefaultPacking.Alignment = 1;
- ctx->DefaultPacking.RowLength = 0;
- ctx->DefaultPacking.SkipPixels = 0;
- ctx->DefaultPacking.SkipRows = 0;
- ctx->DefaultPacking.ImageHeight = 0;
- ctx->DefaultPacking.SkipImages = 0;
- ctx->DefaultPacking.SwapBytes = GL_FALSE;
- ctx->DefaultPacking.LsbFirst = GL_FALSE;
- ctx->DefaultPacking.ClientStorage = GL_FALSE;
- ctx->DefaultPacking.Invert = GL_FALSE;
-#if FEATURE_EXT_pixel_buffer_object
- _mesa_reference_buffer_object(ctx, &ctx->DefaultPacking.BufferObj,
- ctx->Shared->NullBufferObj);
-#endif
-}
diff --git a/src/mesa/main/pixelstore.h b/src/mesa/main/pixelstore.h
deleted file mode 100644
index eb50819..0000000
--- a/src/mesa/main/pixelstore.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 pixelstore.h
- * glPixelStore functions.
- */
-
-
-#ifndef PIXELSTORE_H
-#define PIXELSTORE_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-
-extern void GLAPIENTRY
-_mesa_PixelStorei( GLenum pname, GLint param );
-
-
-extern void GLAPIENTRY
-_mesa_PixelStoref( GLenum pname, GLfloat param );
-
-
-extern void
-_mesa_init_pixelstore( struct gl_context *ctx );
-
-
-#endif
diff --git a/src/mesa/main/pixeltransfer.c b/src/mesa/main/pixeltransfer.c
deleted file mode 100644
index 711181f..0000000
--- a/src/mesa/main/pixeltransfer.c
+++ /dev/null
@@ -1,566 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 1999-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
- * 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.
- */
-
-
-/**
- * \file pixeltransfer.c
- * Pixel transfer operations (scale, bias, table lookups, etc)
- */
-
-
-#include "glheader.h"
-#include "colormac.h"
-#include "pixeltransfer.h"
-#include "imports.h"
-
-
-/*
- * Apply scale and bias factors to an array of RGBA pixels.
- */
-void
-_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4],
- GLfloat rScale, GLfloat gScale,
- GLfloat bScale, GLfloat aScale,
- GLfloat rBias, GLfloat gBias,
- GLfloat bBias, GLfloat aBias)
-{
- if (rScale != 1.0 || rBias != 0.0) {
- GLuint i;
- for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = rgba[i][RCOMP] * rScale + rBias;
- }
- }
- if (gScale != 1.0 || gBias != 0.0) {
- GLuint i;
- for (i = 0; i < n; i++) {
- rgba[i][GCOMP] = rgba[i][GCOMP] * gScale + gBias;
- }
- }
- if (bScale != 1.0 || bBias != 0.0) {
- GLuint i;
- for (i = 0; i < n; i++) {
- rgba[i][BCOMP] = rgba[i][BCOMP] * bScale + bBias;
- }
- }
- if (aScale != 1.0 || aBias != 0.0) {
- GLuint i;
- for (i = 0; i < n; i++) {
- rgba[i][ACOMP] = rgba[i][ACOMP] * aScale + aBias;
- }
- }
-}
-
-
-/*
- * Apply pixel mapping to an array of floating point RGBA pixels.
- */
-void
-_mesa_map_rgba( const struct gl_context *ctx, GLuint n, GLfloat rgba[][4] )
-{
- const GLfloat rscale = (GLfloat) (ctx->PixelMaps.RtoR.Size - 1);
- const GLfloat gscale = (GLfloat) (ctx->PixelMaps.GtoG.Size - 1);
- const GLfloat bscale = (GLfloat) (ctx->PixelMaps.BtoB.Size - 1);
- const GLfloat ascale = (GLfloat) (ctx->PixelMaps.AtoA.Size - 1);
- const GLfloat *rMap = ctx->PixelMaps.RtoR.Map;
- const GLfloat *gMap = ctx->PixelMaps.GtoG.Map;
- const GLfloat *bMap = ctx->PixelMaps.BtoB.Map;
- const GLfloat *aMap = ctx->PixelMaps.AtoA.Map;
- GLuint i;
- for (i=0;i<n;i++) {
- GLfloat r = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
- GLfloat g = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F);
- GLfloat b = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F);
- GLfloat a = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F);
- rgba[i][RCOMP] = rMap[IROUND(r * rscale)];
- rgba[i][GCOMP] = gMap[IROUND(g * gscale)];
- rgba[i][BCOMP] = bMap[IROUND(b * bscale)];
- rgba[i][ACOMP] = aMap[IROUND(a * ascale)];
- }
-}
-
-/**
- * Apply a color table lookup to an array of floating point RGBA colors.
- */
-void
-_mesa_lookup_rgba_float(const struct gl_color_table *table,
- GLuint n, GLfloat rgba[][4])
-{
- const GLint max = table->Size - 1;
- const GLfloat scale = (GLfloat) max;
- const GLfloat *lut = table->TableF;
- GLuint i;
-
- if (!table->TableF || table->Size == 0)
- return;
-
- switch (table->_BaseFormat) {
- case GL_INTENSITY:
- /* replace RGBA with I */
- for (i = 0; i < n; i++) {
- GLint j = IROUND(rgba[i][RCOMP] * scale);
- GLfloat c = lut[CLAMP(j, 0, max)];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] =
- rgba[i][ACOMP] = c;
- }
- break;
- case GL_LUMINANCE:
- /* replace RGB with L */
- for (i = 0; i < n; i++) {
- GLint j = IROUND(rgba[i][RCOMP] * scale);
- GLfloat c = lut[CLAMP(j, 0, max)];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = c;
- }
- break;
- case GL_ALPHA:
- /* replace A with A */
- for (i = 0; i < n; i++) {
- GLint j = IROUND(rgba[i][ACOMP] * scale);
- rgba[i][ACOMP] = lut[CLAMP(j, 0, max)];
- }
- break;
- case GL_LUMINANCE_ALPHA:
- /* replace RGBA with LLLA */
- for (i = 0; i < n; i++) {
- GLint jL = IROUND(rgba[i][RCOMP] * scale);
- GLint jA = IROUND(rgba[i][ACOMP] * scale);
- GLfloat luminance, alpha;
- jL = CLAMP(jL, 0, max);
- jA = CLAMP(jA, 0, max);
- luminance = lut[jL * 2 + 0];
- alpha = lut[jA * 2 + 1];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = luminance;
- rgba[i][ACOMP] = alpha;;
- }
- break;
- case GL_RED:
- /* replace RGB with RGB */
- for (i = 0; i < n; i++) {
- GLint jR = IROUND(rgba[i][RCOMP] * scale);
- jR = CLAMP(jR, 0, max);
- rgba[i][RCOMP] = lut[jR * 3 + 0];
- }
- break;
- case GL_RG:
- /* replace RG with RG */
- for (i = 0; i < n; i++) {
- GLint jR = IROUND(rgba[i][RCOMP] * scale);
- GLint jG = IROUND(rgba[i][GCOMP] * scale);
- jR = CLAMP(jR, 0, max);
- jG = CLAMP(jG, 0, max);
- rgba[i][RCOMP] = lut[jR * 3 + 0];
- rgba[i][GCOMP] = lut[jG * 3 + 1];
- }
- break;
- case GL_RGB:
- /* replace RGB with RGB */
- for (i = 0; i < n; i++) {
- GLint jR = IROUND(rgba[i][RCOMP] * scale);
- GLint jG = IROUND(rgba[i][GCOMP] * scale);
- GLint jB = IROUND(rgba[i][BCOMP] * scale);
- jR = CLAMP(jR, 0, max);
- jG = CLAMP(jG, 0, max);
- jB = CLAMP(jB, 0, max);
- rgba[i][RCOMP] = lut[jR * 3 + 0];
- rgba[i][GCOMP] = lut[jG * 3 + 1];
- rgba[i][BCOMP] = lut[jB * 3 + 2];
- }
- break;
- case GL_RGBA:
- /* replace RGBA with RGBA */
- for (i = 0; i < n; i++) {
- GLint jR = IROUND(rgba[i][RCOMP] * scale);
- GLint jG = IROUND(rgba[i][GCOMP] * scale);
- GLint jB = IROUND(rgba[i][BCOMP] * scale);
- GLint jA = IROUND(rgba[i][ACOMP] * scale);
- jR = CLAMP(jR, 0, max);
- jG = CLAMP(jG, 0, max);
- jB = CLAMP(jB, 0, max);
- jA = CLAMP(jA, 0, max);
- rgba[i][RCOMP] = lut[jR * 4 + 0];
- rgba[i][GCOMP] = lut[jG * 4 + 1];
- rgba[i][BCOMP] = lut[jB * 4 + 2];
- rgba[i][ACOMP] = lut[jA * 4 + 3];
- }
- break;
- default:
- _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_float");
- return;
- }
-}
-
-
-
-/**
- * Apply a color table lookup to an array of ubyte/RGBA colors.
- */
-void
-_mesa_lookup_rgba_ubyte(const struct gl_color_table *table,
- GLuint n, GLubyte rgba[][4])
-{
- const GLubyte *lut = table->TableUB;
- const GLfloat scale = (GLfloat) (table->Size - 1) / (GLfloat)255.0;
- GLuint i;
-
- if (!table->TableUB || table->Size == 0)
- return;
-
- switch (table->_BaseFormat) {
- case GL_INTENSITY:
- /* replace RGBA with I */
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- const GLubyte c = lut[rgba[i][RCOMP]];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] =
- rgba[i][ACOMP] = c;
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale);
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] =
- rgba[i][ACOMP] = lut[j];
- }
- }
- break;
- case GL_LUMINANCE:
- /* replace RGB with L */
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- const GLubyte c = lut[rgba[i][RCOMP]];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = c;
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale);
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = lut[j];
- }
- }
- break;
- case GL_ALPHA:
- /* replace A with A */
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- rgba[i][ACOMP] = lut[rgba[i][ACOMP]];
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint j = IROUND((GLfloat) rgba[i][ACOMP] * scale);
- rgba[i][ACOMP] = lut[j];
- }
- }
- break;
- case GL_LUMINANCE_ALPHA:
- /* replace RGBA with LLLA */
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- GLubyte l = lut[rgba[i][RCOMP] * 2 + 0];
- GLubyte a = lut[rgba[i][ACOMP] * 2 + 1];;
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = l;
- rgba[i][ACOMP] = a;
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale);
- GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale);
- GLubyte luminance = lut[jL * 2 + 0];
- GLubyte alpha = lut[jA * 2 + 1];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = luminance;
- rgba[i][ACOMP] = alpha;
- }
- }
- break;
- case GL_RGB:
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 3 + 0];
- rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 3 + 1];
- rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 3 + 2];
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale);
- GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale);
- GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale);
- rgba[i][RCOMP] = lut[jR * 3 + 0];
- rgba[i][GCOMP] = lut[jG * 3 + 1];
- rgba[i][BCOMP] = lut[jB * 3 + 2];
- }
- }
- break;
- case GL_RGBA:
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 4 + 0];
- rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 4 + 1];
- rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 4 + 2];
- rgba[i][ACOMP] = lut[rgba[i][ACOMP] * 4 + 3];
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale);
- GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale);
- GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale);
- GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale);
- CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]);
- CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]);
- CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]);
- CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]);
- }
- }
- break;
- default:
- _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_chan");
- return;
- }
-}
-
-
-
-/*
- * Map color indexes to float rgba values.
- */
-void
-_mesa_map_ci_to_rgba( const struct gl_context *ctx, GLuint n,
- const GLuint index[], GLfloat rgba[][4] )
-{
- GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
- GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
- GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
- GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
- const GLfloat *rMap = ctx->PixelMaps.ItoR.Map;
- const GLfloat *gMap = ctx->PixelMaps.ItoG.Map;
- const GLfloat *bMap = ctx->PixelMaps.ItoB.Map;
- const GLfloat *aMap = ctx->PixelMaps.ItoA.Map;
- GLuint i;
- for (i=0;i<n;i++) {
- rgba[i][RCOMP] = rMap[index[i] & rmask];
- rgba[i][GCOMP] = gMap[index[i] & gmask];
- rgba[i][BCOMP] = bMap[index[i] & bmask];
- rgba[i][ACOMP] = aMap[index[i] & amask];
- }
-}
-
-
-/**
- * Map ubyte color indexes to ubyte/RGBA values.
- */
-void
-_mesa_map_ci8_to_rgba8(const struct gl_context *ctx,
- GLuint n, const GLubyte index[],
- GLubyte rgba[][4])
-{
- GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
- GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
- GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
- GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
- const GLubyte *rMap = ctx->PixelMaps.ItoR.Map8;
- const GLubyte *gMap = ctx->PixelMaps.ItoG.Map8;
- const GLubyte *bMap = ctx->PixelMaps.ItoB.Map8;
- const GLubyte *aMap = ctx->PixelMaps.ItoA.Map8;
- GLuint i;
- for (i=0;i<n;i++) {
- rgba[i][RCOMP] = rMap[index[i] & rmask];
- rgba[i][GCOMP] = gMap[index[i] & gmask];
- rgba[i][BCOMP] = bMap[index[i] & bmask];
- rgba[i][ACOMP] = aMap[index[i] & amask];
- }
-}
-
-
-void
-_mesa_scale_and_bias_depth(const struct gl_context *ctx, GLuint n,
- GLfloat depthValues[])
-{
- const GLfloat scale = ctx->Pixel.DepthScale;
- const GLfloat bias = ctx->Pixel.DepthBias;
- GLuint i;
- for (i = 0; i < n; i++) {
- GLfloat d = depthValues[i] * scale + bias;
- depthValues[i] = CLAMP(d, 0.0F, 1.0F);
- }
-}
-
-
-void
-_mesa_scale_and_bias_depth_uint(const struct gl_context *ctx, GLuint n,
- GLuint depthValues[])
-{
- const GLdouble max = (double) 0xffffffff;
- const GLdouble scale = ctx->Pixel.DepthScale;
- const GLdouble bias = ctx->Pixel.DepthBias * max;
- GLuint i;
- for (i = 0; i < n; i++) {
- GLdouble d = (GLdouble) depthValues[i] * scale + bias;
- d = CLAMP(d, 0.0, max);
- depthValues[i] = (GLuint) d;
- }
-}
-
-/**
- * Apply various pixel transfer operations to an array of RGBA pixels
- * as indicated by the transferOps bitmask
- */
-void
-_mesa_apply_rgba_transfer_ops(struct gl_context *ctx, GLbitfield transferOps,
- GLuint n, GLfloat rgba[][4])
-{
- /* scale & bias */
- if (transferOps & IMAGE_SCALE_BIAS_BIT) {
- _mesa_scale_and_bias_rgba(n, rgba,
- ctx->Pixel.RedScale, ctx->Pixel.GreenScale,
- ctx->Pixel.BlueScale, ctx->Pixel.AlphaScale,
- ctx->Pixel.RedBias, ctx->Pixel.GreenBias,
- ctx->Pixel.BlueBias, ctx->Pixel.AlphaBias);
- }
- /* color map lookup */
- if (transferOps & IMAGE_MAP_COLOR_BIT) {
- _mesa_map_rgba( ctx, n, rgba );
- }
-
- /* clamping to [0,1] */
- if (transferOps & IMAGE_CLAMP_BIT) {
- GLuint i;
- for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
- rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F);
- rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F);
- rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F);
- }
- }
-}
-
-
-/*
- * Apply color index shift and offset to an array of pixels.
- */
-void
-_mesa_shift_and_offset_ci(const struct gl_context *ctx,
- GLuint n, GLuint indexes[])
-{
- GLint shift = ctx->Pixel.IndexShift;
- GLint offset = ctx->Pixel.IndexOffset;
- GLuint i;
- if (shift > 0) {
- for (i=0;i<n;i++) {
- indexes[i] = (indexes[i] << shift) + offset;
- }
- }
- else if (shift < 0) {
- shift = -shift;
- for (i=0;i<n;i++) {
- indexes[i] = (indexes[i] >> shift) + offset;
- }
- }
- else {
- for (i=0;i<n;i++) {
- indexes[i] = indexes[i] + offset;
- }
- }
-}
-
-
-
-/**
- * Apply color index shift, offset and table lookup to an array
- * of color indexes;
- */
-void
-_mesa_apply_ci_transfer_ops(const struct gl_context *ctx,
- GLbitfield transferOps,
- GLuint n, GLuint indexes[])
-{
- if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
- _mesa_shift_and_offset_ci(ctx, n, indexes);
- }
- if (transferOps & IMAGE_MAP_COLOR_BIT) {
- const GLuint mask = ctx->PixelMaps.ItoI.Size - 1;
- GLuint i;
- for (i = 0; i < n; i++) {
- const GLuint j = indexes[i] & mask;
- indexes[i] = IROUND(ctx->PixelMaps.ItoI.Map[j]);
- }
- }
-}
-
-
-/**
- * Apply stencil index shift, offset and table lookup to an array
- * of stencil values.
- */
-void
-_mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n,
- GLstencil stencil[])
-{
- if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) {
- const GLint offset = ctx->Pixel.IndexOffset;
- GLint shift = ctx->Pixel.IndexShift;
- GLuint i;
- if (shift > 0) {
- for (i = 0; i < n; i++) {
- stencil[i] = (stencil[i] << shift) + offset;
- }
- }
- else if (shift < 0) {
- shift = -shift;
- for (i = 0; i < n; i++) {
- stencil[i] = (stencil[i] >> shift) + offset;
- }
- }
- else {
- for (i = 0; i < n; i++) {
- stencil[i] = stencil[i] + offset;
- }
- }
- }
- if (ctx->Pixel.MapStencilFlag) {
- GLuint mask = ctx->PixelMaps.StoS.Size - 1;
- GLuint i;
- for (i = 0; i < n; i++) {
- stencil[i] = (GLstencil)ctx->PixelMaps.StoS.Map[ stencil[i] & mask ];
- }
- }
-}
diff --git a/src/mesa/main/pixeltransfer.h b/src/mesa/main/pixeltransfer.h
deleted file mode 100644
index 34f3e49..0000000
--- a/src/mesa/main/pixeltransfer.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 1999-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
- * 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 PIXELTRANSFER_H
-#define PIXELTRANSFER_H
-
-
-#include "mtypes.h"
-
-
-extern void
-_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4],
- GLfloat rScale, GLfloat gScale,
- GLfloat bScale, GLfloat aScale,
- GLfloat rBias, GLfloat gBias,
- GLfloat bBias, GLfloat aBias);
-
-extern void
-_mesa_map_rgba(const struct gl_context *ctx, GLuint n, GLfloat rgba[][4]);
-
-extern void
-_mesa_lookup_rgba_float(const struct gl_color_table *table,
- GLuint n, GLfloat rgba[][4]);
-
-extern void
-_mesa_lookup_rgba_ubyte(const struct gl_color_table *table,
- GLuint n, GLubyte rgba[][4]);
-
-
-extern void
-_mesa_map_ci_to_rgba(const struct gl_context *ctx,
- GLuint n, const GLuint index[], GLfloat rgba[][4]);
-
-
-extern void
-_mesa_map_ci8_to_rgba8(const struct gl_context *ctx,
- GLuint n, const GLubyte index[],
- GLubyte rgba[][4]);
-
-
-extern void
-_mesa_scale_and_bias_depth(const struct gl_context *ctx, GLuint n,
- GLfloat depthValues[]);
-
-extern void
-_mesa_scale_and_bias_depth_uint(const struct gl_context *ctx, GLuint n,
- GLuint depthValues[]);
-
-extern void
-_mesa_apply_rgba_transfer_ops(struct gl_context *ctx, GLbitfield transferOps,
- GLuint n, GLfloat rgba[][4]);
-
-extern void
-_mesa_shift_and_offset_ci(const struct gl_context *ctx,
- GLuint n, GLuint indexes[]);
-
-extern void
-_mesa_apply_ci_transfer_ops(const struct gl_context *ctx,
- GLbitfield transferOps,
- GLuint n, GLuint indexes[]);
-
-
-extern void
-_mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n,
- GLstencil stencil[]);
-
-
-#endif
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
deleted file mode 100644
index 87bfae2..0000000
--- a/src/mesa/main/points.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/**
- * \file points.c
- * Point operations.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "points.h"
-#include "mtypes.h"
-
-
-/**
- * Set current point size.
- * \param size point diameter in pixels
- * \sa glPointSize().
- */
-void GLAPIENTRY
-_mesa_PointSize( GLfloat size )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (size <= 0.0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" );
- return;
- }
-
- if (ctx->Point.Size == size)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.Size = size;
-
- if (ctx->Driver.PointSize)
- ctx->Driver.PointSize(ctx, size);
-}
-
-
-#if _HAVE_FULL_GL
-
-
-void GLAPIENTRY
-_mesa_PointParameteri( GLenum pname, GLint param )
-{
- GLfloat p[3];
- p[0] = (GLfloat) param;
- p[1] = p[2] = 0.0F;
- _mesa_PointParameterfv(pname, p);
-}
-
-
-void GLAPIENTRY
-_mesa_PointParameteriv( GLenum pname, const GLint *params )
-{
- GLfloat p[3];
- p[0] = (GLfloat) params[0];
- if (pname == GL_DISTANCE_ATTENUATION_EXT) {
- p[1] = (GLfloat) params[1];
- p[2] = (GLfloat) params[2];
- }
- _mesa_PointParameterfv(pname, p);
-}
-
-
-void GLAPIENTRY
-_mesa_PointParameterf( GLenum pname, GLfloat param)
-{
- GLfloat p[3];
- p[0] = param;
- p[1] = p[2] = 0.0F;
- _mesa_PointParameterfv(pname, p);
-}
-
-
-void GLAPIENTRY
-_mesa_PointParameterfv( GLenum pname, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- switch (pname) {
- case GL_DISTANCE_ATTENUATION_EXT:
- if (ctx->Extensions.EXT_point_parameters) {
- if (TEST_EQ_3V(ctx->Point.Params, params))
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- COPY_3V(ctx->Point.Params, params);
- ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
- ctx->Point.Params[1] != 0.0 ||
- ctx->Point.Params[2] != 0.0);
-
- if (ctx->Point._Attenuated)
- ctx->_TriangleCaps |= DD_POINT_ATTEN;
- else
- ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)");
- return;
- }
- break;
- case GL_POINT_SIZE_MIN_EXT:
- if (ctx->Extensions.EXT_point_parameters) {
- if (params[0] < 0.0F) {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glPointParameterf[v]{EXT,ARB}(param)" );
- return;
- }
- if (ctx->Point.MinSize == params[0])
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.MinSize = params[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)");
- return;
- }
- break;
- case GL_POINT_SIZE_MAX_EXT:
- if (ctx->Extensions.EXT_point_parameters) {
- if (params[0] < 0.0F) {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glPointParameterf[v]{EXT,ARB}(param)" );
- return;
- }
- if (ctx->Point.MaxSize == params[0])
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.MaxSize = params[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)");
- return;
- }
- break;
- case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
- if (ctx->Extensions.EXT_point_parameters) {
- if (params[0] < 0.0F) {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glPointParameterf[v]{EXT,ARB}(param)" );
- return;
- }
- if (ctx->Point.Threshold == params[0])
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.Threshold = params[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)");
- return;
- }
- break;
- case GL_POINT_SPRITE_R_MODE_NV:
- /* This is one area where ARB_point_sprite and NV_point_sprite
- * differ. In ARB_point_sprite the POINT_SPRITE_R_MODE is
- * always ZERO. NV_point_sprite adds the S and R modes.
- */
- if (ctx->Extensions.NV_point_sprite) {
- GLenum value = (GLenum) params[0];
- if (value != GL_ZERO && value != GL_S && value != GL_R) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glPointParameterf[v]{EXT,ARB}(param)");
- return;
- }
- if (ctx->Point.SpriteRMode == value)
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.SpriteRMode = value;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)");
- return;
- }
- break;
- case GL_POINT_SPRITE_COORD_ORIGIN:
- /* This is not completely correct. GL_POINT_SPRITE_COORD_ORIGIN was
- * added to point sprites when the extension was merged into OpenGL
- * 2.0. It is expected that an implementation supporting OpenGL 1.4
- * and GL_ARB_point_sprite will generate an error here.
- */
- if (ctx->Extensions.ARB_point_sprite) {
- GLenum value = (GLenum) params[0];
- if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glPointParameterf[v]{EXT,ARB}(param)");
- return;
- }
- if (ctx->Point.SpriteOrigin == value)
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.SpriteOrigin = value;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)");
- return;
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)" );
- return;
- }
-
- if (ctx->Driver.PointParameterfv)
- (*ctx->Driver.PointParameterfv)(ctx, pname, params);
-}
-#endif
-
-
-
-/**
- * Initialize the context point state.
- *
- * \param ctx GL context.
- *
- * Initializes __struct gl_contextRec::Point and point related constants in
- * __struct gl_contextRec::Const.
- */
-void
-_mesa_init_point(struct gl_context *ctx)
-{
- GLuint i;
-
- ctx->Point.SmoothFlag = GL_FALSE;
- ctx->Point.Size = 1.0;
- ctx->Point.Params[0] = 1.0;
- ctx->Point.Params[1] = 0.0;
- ctx->Point.Params[2] = 0.0;
- ctx->Point._Attenuated = GL_FALSE;
- ctx->Point.MinSize = 0.0;
- ctx->Point.MaxSize
- = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA);
- ctx->Point.Threshold = 1.0;
- ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */
- ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */
- ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */
- for (i = 0; i < Elements(ctx->Point.CoordReplace); i++) {
- ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */
- }
-}
diff --git a/src/mesa/main/points.h b/src/mesa/main/points.h
deleted file mode 100644
index 306a8a5..0000000
--- a/src/mesa/main/points.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * \file points.h
- * Point operations.
- */
-
-/*
- * 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.
- */
-
-
-#ifndef POINTS_H
-#define POINTS_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-
-extern void GLAPIENTRY
-_mesa_PointSize( GLfloat size );
-
-extern void GLAPIENTRY
-_mesa_PointParameteri( GLenum pname, GLint param );
-
-extern void GLAPIENTRY
-_mesa_PointParameteriv( GLenum pname, const GLint *params );
-
-extern void GLAPIENTRY
-_mesa_PointParameterf( GLenum pname, GLfloat param );
-
-extern void GLAPIENTRY
-_mesa_PointParameterfv( GLenum pname, const GLfloat *params );
-
-extern void
-_mesa_init_point( struct gl_context * ctx );
-
-
-#endif
diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
deleted file mode 100644
index 9c213b9..0000000
--- a/src/mesa/main/polygon.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/**
- * \file polygon.c
- * Polygon operations.
- */
-
-/*
- * 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 "glheader.h"
-#include "imports.h"
-#include "bufferobj.h"
-#include "context.h"
-#include "image.h"
-#include "enums.h"
-#include "pack.h"
-#include "polygon.h"
-#include "mtypes.h"
-
-
-/**
- * Specify whether to cull front- or back-facing facets.
- *
- * \param mode culling mode.
- *
- * \sa glCullFace().
- *
- * Verifies the parameter and updates gl_polygon_attrib::CullFaceMode. On
- * change, flushes the vertices and notifies the driver via
- * the dd_function_table::CullFace callback.
- */
-void GLAPIENTRY
-_mesa_CullFace( GLenum mode )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug(ctx, "glCullFace %s\n", _mesa_lookup_enum_by_nr(mode));
-
- if (mode!=GL_FRONT && mode!=GL_BACK && mode!=GL_FRONT_AND_BACK) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glCullFace" );
- return;
- }
-
- if (ctx->Polygon.CullFaceMode == mode)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.CullFaceMode = mode;
-
- if (ctx->Driver.CullFace)
- ctx->Driver.CullFace( ctx, mode );
-}
-
-
-/**
- * Define front- and back-facing
- *
- * \param mode orientation of front-facing polygons.
- *
- * \sa glFrontFace().
- *
- * Verifies the parameter and updates gl_polygon_attrib::FrontFace. On change
- * flushes the vertices and notifies the driver via
- * the dd_function_table::FrontFace callback.
- */
-void GLAPIENTRY
-_mesa_FrontFace( GLenum mode )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode));
-
- if (mode!=GL_CW && mode!=GL_CCW) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" );
- return;
- }
-
- if (ctx->Polygon.FrontFace == mode)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.FrontFace = mode;
-
- ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW);
-
- if (ctx->Driver.FrontFace)
- ctx->Driver.FrontFace( ctx, mode );
-}
-
-
-/**
- * Set the polygon rasterization mode.
- *
- * \param face the polygons which \p mode applies to.
- * \param mode how polygons should be rasterized.
- *
- * \sa glPolygonMode().
- *
- * Verifies the parameters and updates gl_polygon_attrib::FrontMode and
- * gl_polygon_attrib::BackMode. On change flushes the vertices and notifies the
- * driver via the dd_function_table::PolygonMode callback.
- */
-void GLAPIENTRY
-_mesa_PolygonMode( GLenum face, GLenum mode )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug(ctx, "glPolygonMode %s %s\n",
- _mesa_lookup_enum_by_nr(face),
- _mesa_lookup_enum_by_nr(mode));
-
- if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" );
- return;
- }
-
- switch (face) {
- case GL_FRONT:
- if (ctx->Polygon.FrontMode == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.FrontMode = mode;
- break;
- case GL_FRONT_AND_BACK:
- if (ctx->Polygon.FrontMode == mode &&
- ctx->Polygon.BackMode == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.FrontMode = mode;
- ctx->Polygon.BackMode = mode;
- break;
- case GL_BACK:
- if (ctx->Polygon.BackMode == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.BackMode = mode;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
- return;
- }
-
- if (ctx->Polygon.FrontMode == GL_FILL && ctx->Polygon.BackMode == GL_FILL)
- ctx->_TriangleCaps &= ~DD_TRI_UNFILLED;
- else
- ctx->_TriangleCaps |= DD_TRI_UNFILLED;
-
- if (ctx->Driver.PolygonMode)
- ctx->Driver.PolygonMode(ctx, face, mode);
-}
-
-#if _HAVE_FULL_GL
-
-
-/**
- * This routine updates the ctx->Polygon.Stipple state.
- * If we're getting the stipple data from a PBO, we map the buffer
- * in order to access the data.
- * In any case, we obey the current pixel unpacking parameters when fetching
- * the stipple data.
- *
- * In the future, this routine should be used as a fallback, called via
- * ctx->Driver.PolygonStipple(). We'll have to update all the DRI drivers
- * too.
- */
-void
-_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern)
-{
- pattern = _mesa_map_validate_pbo_source(ctx, 2,
- &ctx->Unpack, 32, 32, 1,
- GL_COLOR_INDEX, GL_BITMAP, pattern,
- "glPolygonStipple");
- if (!pattern)
- return;
-
- _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack);
-
- _mesa_unmap_pbo_source(ctx, &ctx->Unpack);
-}
-
-
-/**
- * Called by glPolygonStipple.
- */
-void GLAPIENTRY
-_mesa_PolygonStipple( const GLubyte *pattern )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug(ctx, "glPolygonStipple\n");
-
- FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE);
-
- _mesa_polygon_stipple(ctx, pattern);
-
- if (ctx->Driver.PolygonStipple)
- ctx->Driver.PolygonStipple(ctx, pattern);
-}
-
-
-/**
- * Called by glPolygonStipple.
- */
-void GLAPIENTRY
-_mesa_GetPolygonStipple( GLubyte *dest )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug(ctx, "glGetPolygonStipple\n");
-
- dest = _mesa_map_validate_pbo_dest(ctx, 2,
- &ctx->Pack, 32, 32, 1,
- GL_COLOR_INDEX, GL_BITMAP, dest,
- "glGetPolygonStipple");
- if (!dest)
- return;
-
- _mesa_pack_polygon_stipple(ctx->PolygonStipple, dest, &ctx->Pack);
-
- _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
-}
-
-
-void GLAPIENTRY
-_mesa_PolygonOffset( GLfloat factor, GLfloat units )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units);
-
- if (ctx->Polygon.OffsetFactor == factor &&
- ctx->Polygon.OffsetUnits == units)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_POLYGON);
- ctx->Polygon.OffsetFactor = factor;
- ctx->Polygon.OffsetUnits = units;
-
- if (ctx->Driver.PolygonOffset)
- ctx->Driver.PolygonOffset( ctx, factor, units );
-}
-
-
-void GLAPIENTRY
-_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
-{
- GET_CURRENT_CONTEXT(ctx);
- /* XXX mult by DepthMaxF here??? */
- _mesa_PolygonOffset(factor, bias * ctx->DrawBuffer->_DepthMaxF );
-}
-
-#endif
-
-
-/**********************************************************************/
-/** \name Initialization */
-/*@{*/
-
-/**
- * Initialize the context polygon state.
- *
- * \param ctx GL context.
- *
- * Initializes __struct gl_contextRec::Polygon and __struct gl_contextRec::PolygonStipple
- * attribute groups.
- */
-void _mesa_init_polygon( struct gl_context * ctx )
-{
- /* Polygon group */
- ctx->Polygon.CullFlag = GL_FALSE;
- ctx->Polygon.CullFaceMode = GL_BACK;
- ctx->Polygon.FrontFace = GL_CCW;
- ctx->Polygon._FrontBit = 0;
- ctx->Polygon.FrontMode = GL_FILL;
- ctx->Polygon.BackMode = GL_FILL;
- ctx->Polygon.SmoothFlag = GL_FALSE;
- ctx->Polygon.StippleFlag = GL_FALSE;
- ctx->Polygon.OffsetFactor = 0.0F;
- ctx->Polygon.OffsetUnits = 0.0F;
- ctx->Polygon.OffsetPoint = GL_FALSE;
- ctx->Polygon.OffsetLine = GL_FALSE;
- ctx->Polygon.OffsetFill = GL_FALSE;
-
-
- /* Polygon Stipple group */
- memset( ctx->PolygonStipple, 0xff, 32*sizeof(GLuint) );
-}
-
-/*@}*/
diff --git a/src/mesa/main/polygon.h b/src/mesa/main/polygon.h
deleted file mode 100644
index 13f7c91..0000000
--- a/src/mesa/main/polygon.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * \file polygon.h
- * Polygon operations.
- */
-
-/*
- * 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 POLYGON_H
-#define POLYGON_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-extern void
-_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern);
-
-
-extern void GLAPIENTRY
-_mesa_CullFace( GLenum mode );
-
-extern void GLAPIENTRY
-_mesa_FrontFace( GLenum mode );
-
-extern void GLAPIENTRY
-_mesa_PolygonMode( GLenum face, GLenum mode );
-
-extern void GLAPIENTRY
-_mesa_PolygonOffset( GLfloat factor, GLfloat units );
-
-extern void GLAPIENTRY
-_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias );
-
-extern void GLAPIENTRY
-_mesa_PolygonStipple( const GLubyte *mask );
-
-extern void GLAPIENTRY
-_mesa_GetPolygonStipple( GLubyte *mask );
-
-extern void
-_mesa_init_polygon( struct gl_context * ctx );
-
-#endif
diff --git a/src/mesa/main/querymatrix.c b/src/mesa/main/querymatrix.c
deleted file mode 100644
index 944ad43..0000000
--- a/src/mesa/main/querymatrix.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/**************************************************************************
- *
- * 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},
- };
-
- /* 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/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
deleted file mode 100644
index 8874397..0000000
--- a/src/mesa/main/queryobj.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#include "glheader.h"
-#include "context.h"
-#include "hash.h"
-#include "imports.h"
-#include "queryobj.h"
-#include "mtypes.h"
-#include "main/dispatch.h"
-
-
-#if FEATURE_queryobj
-
-
-/**
- * Allocate a new query object. This is a fallback routine called via
- * ctx->Driver.NewQueryObject().
- * \param ctx - rendering context
- * \param id - the new object's ID
- * \return pointer to new query_object object or NULL if out of memory.
- */
-static struct gl_query_object *
-_mesa_new_query_object(struct gl_context *ctx, GLuint id)
-{
- struct gl_query_object *q = MALLOC_STRUCT(gl_query_object);
- (void) ctx;
- if (q) {
- q->Id = id;
- q->Result = 0;
- q->Active = GL_FALSE;
- q->Ready = GL_TRUE; /* correct, see spec */
- }
- return q;
-}
-
-
-/**
- * Begin a query. Software driver fallback.
- * Called via ctx->Driver.BeginQuery().
- */
-static void
-_mesa_begin_query(struct gl_context *ctx, struct gl_query_object *q)
-{
- /* no-op */
-}
-
-
-/**
- * End a query. Software driver fallback.
- * Called via ctx->Driver.EndQuery().
- */
-static void
-_mesa_end_query(struct gl_context *ctx, struct gl_query_object *q)
-{
- q->Ready = GL_TRUE;
-}
-
-
-/**
- * Wait for query to complete. Software driver fallback.
- * Called via ctx->Driver.WaitQuery().
- */
-static void
-_mesa_wait_query(struct gl_context *ctx, struct gl_query_object *q)
-{
- /* For software drivers, _mesa_end_query() should have completed the query.
- * For real hardware, implement a proper WaitQuery() driver function,
- * which may require issuing a flush.
- */
- assert(q->Ready);
-}
-
-
-/**
- * Check if a query results are ready. Software driver fallback.
- * Called via ctx->Driver.CheckQuery().
- */
-static void
-_mesa_check_query(struct gl_context *ctx, struct gl_query_object *q)
-{
- /* No-op for sw rendering.
- * HW drivers may need to flush at this time.
- */
-}
-
-
-/**
- * Delete a query object. Called via ctx->Driver.DeleteQuery().
- * Not removed from hash table here.
- */
-static void
-_mesa_delete_query(struct gl_context *ctx, struct gl_query_object *q)
-{
- free(q);
-}
-
-
-void
-_mesa_init_query_object_functions(struct dd_function_table *driver)
-{
- driver->NewQueryObject = _mesa_new_query_object;
- driver->DeleteQuery = _mesa_delete_query;
- driver->BeginQuery = _mesa_begin_query;
- driver->EndQuery = _mesa_end_query;
- driver->WaitQuery = _mesa_wait_query;
- driver->CheckQuery = _mesa_check_query;
-}
-
-
-/**
- * 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(struct gl_context *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)
-{
- GLuint first;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGenQueriesARB(n < 0)");
- return;
- }
-
- /* No query objects can be active at this time! */
- if (ctx->Query.CurrentOcclusionObject ||
- ctx->Query.CurrentTimerObject) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGenQueriesARB");
- return;
- }
-
- first = _mesa_HashFindFreeKeyBlock(ctx->Query.QueryObjects, n);
- if (first) {
- GLsizei i;
- for (i = 0; i < n; i++) {
- struct gl_query_object *q
- = ctx->Driver.NewQueryObject(ctx, first + i);
- if (!q) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenQueriesARB");
- return;
- }
- ids[i] = first + i;
- _mesa_HashInsert(ctx->Query.QueryObjects, first + i, q);
- }
- }
-}
-
-
-void GLAPIENTRY
-_mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids)
-{
- GLint i;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteQueriesARB(n < 0)");
- return;
- }
-
- /* No query objects can be active at this time! */
- if (ctx->Query.CurrentOcclusionObject ||
- ctx->Query.CurrentTimerObject) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteQueriesARB");
- return;
- }
-
- for (i = 0; i < n; i++) {
- if (ids[i] > 0) {
- struct gl_query_object *q = _mesa_lookup_query_object(ctx, ids[i]);
- if (q) {
- ASSERT(!q->Active); /* should be caught earlier */
- _mesa_HashRemove(ctx->Query.QueryObjects, ids[i]);
- ctx->Driver.DeleteQuery(ctx, q);
- }
- }
- }
-}
-
-
-GLboolean GLAPIENTRY
-_mesa_IsQueryARB(GLuint id)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
-
- if (id && _mesa_lookup_query_object(ctx, id))
- return GL_TRUE;
- else
- return GL_FALSE;
-}
-
-
-static void GLAPIENTRY
-_mesa_BeginQueryARB(GLenum target, GLuint id)
-{
- struct gl_query_object *q, **bindpt;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
-
- bindpt = get_query_binding_point(ctx, target);
- if (!bindpt) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");
- return;
- }
-
- if (id == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB(id==0)");
- return;
- }
-
- q = _mesa_lookup_query_object(ctx, id);
- if (!q) {
- /* create new object */
- q = ctx->Driver.NewQueryObject(ctx, id);
- if (!q) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQueryARB");
- return;
- }
- _mesa_HashInsert(ctx->Query.QueryObjects, id, q);
- }
- else {
- /* pre-existing object */
- if (q->Active) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBeginQueryARB(query already active)");
- return;
- }
- }
-
- q->Target = target;
- q->Active = GL_TRUE;
- q->Result = 0;
- q->Ready = GL_FALSE;
-
- /* XXX should probably refcount query objects */
- *bindpt = q;
-
- ctx->Driver.BeginQuery(ctx, q);
-}
-
-
-static void GLAPIENTRY
-_mesa_EndQueryARB(GLenum target)
-{
- struct gl_query_object *q, **bindpt;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
-
- 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)");
- return;
- }
-
- q->Active = GL_FALSE;
- ctx->Driver.EndQuery(ctx, q);
-}
-
-
-void GLAPIENTRY
-_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params)
-{
- struct gl_query_object *q, **bindpt;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- 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);
- break;
- case GL_CURRENT_QUERY_ARB:
- *params = q ? q->Id : 0;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(pname)");
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
-{
- struct gl_query_object *q = NULL;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (id)
- q = _mesa_lookup_query_object(ctx, id);
-
- if (!q || q->Active) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetQueryObjectivARB(id=%d is invalid or active)", id);
- return;
- }
-
- switch (pname) {
- case GL_QUERY_RESULT_ARB:
- if (!q->Ready)
- ctx->Driver.WaitQuery(ctx, q);
- /* if result is too large for returned type, clamp to max value */
- if (q->Result > 0x7fffffff) {
- *params = 0x7fffffff;
- }
- else {
- *params = (GLint)q->Result;
- }
- break;
- case GL_QUERY_RESULT_AVAILABLE_ARB:
- if (!q->Ready)
- ctx->Driver.CheckQuery( ctx, q );
- *params = q->Ready;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectivARB(pname)");
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
-{
- struct gl_query_object *q = NULL;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (id)
- q = _mesa_lookup_query_object(ctx, id);
-
- if (!q || q->Active) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetQueryObjectuivARB(id=%d is invalid or active)", id);
- return;
- }
-
- switch (pname) {
- case GL_QUERY_RESULT_ARB:
- if (!q->Ready)
- ctx->Driver.WaitQuery(ctx, q);
- /* if result is too large for returned type, clamp to max value */
- if (q->Result > 0xffffffff) {
- *params = 0xffffffff;
- }
- else {
- *params = (GLuint)q->Result;
- }
- break;
- case GL_QUERY_RESULT_AVAILABLE_ARB:
- if (!q->Ready)
- ctx->Driver.CheckQuery( ctx, q );
- *params = q->Ready;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectuivARB(pname)");
- return;
- }
-}
-
-
-/**
- * New with GL_EXT_timer_query
- */
-static void GLAPIENTRY
-_mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params)
-{
- struct gl_query_object *q = NULL;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (id)
- q = _mesa_lookup_query_object(ctx, id);
-
- if (!q || q->Active) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetQueryObjectui64vARB(id=%d is invalid or active)", id);
- return;
- }
-
- switch (pname) {
- case GL_QUERY_RESULT_ARB:
- if (!q->Ready)
- ctx->Driver.WaitQuery(ctx, q);
- *params = q->Result;
- break;
- case GL_QUERY_RESULT_AVAILABLE_ARB:
- if (!q->Ready)
- ctx->Driver.CheckQuery( ctx, q );
- *params = q->Ready;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjecti64vARB(pname)");
- return;
- }
-}
-
-
-/**
- * New with GL_EXT_timer_query
- */
-static void GLAPIENTRY
-_mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params)
-{
- struct gl_query_object *q = NULL;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (id)
- q = _mesa_lookup_query_object(ctx, id);
-
- if (!q || q->Active) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetQueryObjectuui64vARB(id=%d is invalid or active)", id);
- return;
- }
-
- switch (pname) {
- case GL_QUERY_RESULT_ARB:
- if (!q->Ready)
- ctx->Driver.WaitQuery(ctx, q);
- *params = q->Result;
- break;
- case GL_QUERY_RESULT_AVAILABLE_ARB:
- if (!q->Ready)
- ctx->Driver.CheckQuery( ctx, q );
- *params = q->Ready;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectui64vARB(pname)");
- return;
- }
-}
-
-
-void
-_mesa_init_queryobj_dispatch(struct _glapi_table *disp)
-{
- SET_GenQueriesARB(disp, _mesa_GenQueriesARB);
- SET_DeleteQueriesARB(disp, _mesa_DeleteQueriesARB);
- SET_IsQueryARB(disp, _mesa_IsQueryARB);
- SET_BeginQueryARB(disp, _mesa_BeginQueryARB);
- SET_EndQueryARB(disp, _mesa_EndQueryARB);
- SET_GetQueryivARB(disp, _mesa_GetQueryivARB);
- SET_GetQueryObjectivARB(disp, _mesa_GetQueryObjectivARB);
- SET_GetQueryObjectuivARB(disp, _mesa_GetQueryObjectuivARB);
-
- SET_GetQueryObjecti64vEXT(disp, _mesa_GetQueryObjecti64vEXT);
- SET_GetQueryObjectui64vEXT(disp, _mesa_GetQueryObjectui64vEXT);
-}
-
-
-#endif /* FEATURE_queryobj */
-
-
-/**
- * Allocate/init the context state related to query objects.
- */
-void
-_mesa_init_queryobj(struct gl_context *ctx)
-{
- ctx->Query.QueryObjects = _mesa_NewHashTable();
- ctx->Query.CurrentOcclusionObject = NULL;
-}
-
-
-/**
- * Callback for deleting a query object. Called by _mesa_HashDeleteAll().
- */
-static void
-delete_queryobj_cb(GLuint id, void *data, void *userData)
-{
- struct gl_query_object *q= (struct gl_query_object *) data;
- struct gl_context *ctx = (struct gl_context *)userData;
- ctx->Driver.DeleteQuery(ctx, q);
-}
-
-
-/**
- * Free the context state related to query objects.
- */
-void
-_mesa_free_queryobj_data(struct gl_context *ctx)
-{
- _mesa_HashDeleteAll(ctx->Query.QueryObjects, delete_queryobj_cb, ctx);
- _mesa_DeleteHashTable(ctx->Query.QueryObjects);
-}
diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h
deleted file mode 100644
index e289625..0000000
--- a/src/mesa/main/queryobj.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#ifndef QUERYOBJ_H
-#define QUERYOBJ_H
-
-
-#include "main/mtypes.h"
-#include "main/hash.h"
-
-
-#if FEATURE_queryobj
-
-static INLINE struct gl_query_object *
-_mesa_lookup_query_object(struct gl_context *ctx, GLuint id)
-{
- return (struct gl_query_object *)
- _mesa_HashLookup(ctx->Query.QueryObjects, id);
-}
-
-
-extern void GLAPIENTRY
-_mesa_GenQueriesARB(GLsizei n, GLuint *ids);
-
-extern void GLAPIENTRY
-_mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids);
-
-extern GLboolean GLAPIENTRY
-_mesa_IsQueryARB(GLuint id);
-
-extern void GLAPIENTRY
-_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params);
-
-extern void
-_mesa_init_query_object_functions(struct dd_function_table *driver);
-
-extern void
-_mesa_init_queryobj_dispatch(struct _glapi_table *disp);
-
-#else /* FEATURE_queryobj */
-
-static INLINE struct gl_query_object *
-_mesa_lookup_query_object(struct gl_context *ctx, GLuint id)
-{
- return NULL;
-}
-
-static INLINE void
-_mesa_init_query_object_functions(struct dd_function_table *driver)
-{
-}
-
-static INLINE void
-_mesa_init_queryobj_dispatch(struct _glapi_table *disp)
-{
-}
-
-#endif /* FEATURE_queryobj */
-
-extern void
-_mesa_init_queryobj(struct gl_context *ctx);
-
-extern void
-_mesa_free_queryobj_data(struct gl_context *ctx);
-
-
-#endif /* QUERYOBJ_H */
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
deleted file mode 100644
index 6f52f07..0000000
--- a/src/mesa/main/rastpos.c
+++ /dev/null
@@ -1,564 +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.
- */
-
-
-/**
- * \file rastpos.c
- * Raster position operations.
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "feedback.h"
-#include "macros.h"
-#include "rastpos.h"
-#include "state.h"
-#include "main/dispatch.h"
-
-
-#if FEATURE_rastpos
-
-
-/**
- * Helper function for all the RasterPos functions.
- */
-static void
-rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLfloat p[4];
-
- p[0] = x;
- p[1] = y;
- p[2] = z;
- p[3] = w;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT(ctx, 0);
-
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
- ctx->Driver.RasterPos(ctx, p);
-}
-
-
-static void GLAPIENTRY
-_mesa_RasterPos2d(GLdouble x, GLdouble y)
-{
- rasterpos((GLfloat)x, (GLfloat)y, (GLfloat)0.0, (GLfloat)1.0);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos2f(GLfloat x, GLfloat y)
-{
- rasterpos(x, y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos2i(GLint x, GLint y)
-{
- rasterpos((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos2s(GLshort x, GLshort y)
-{
- rasterpos(x, y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- rasterpos(x, y, z, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos3i(GLint x, GLint y, GLint z)
-{
- rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- rasterpos(x, y, z, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- rasterpos(x, y, z, w);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- rasterpos(x, y, z, w);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos2dv(const GLdouble *v)
-{
- rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos2fv(const GLfloat *v)
-{
- rasterpos(v[0], v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos2iv(const GLint *v)
-{
- rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos2sv(const GLshort *v)
-{
- rasterpos(v[0], v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos3dv(const GLdouble *v)
-{
- rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos3fv(const GLfloat *v)
-{
- rasterpos(v[0], v[1], v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos3iv(const GLint *v)
-{
- rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos3sv(const GLshort *v)
-{
- rasterpos(v[0], v[1], v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos4dv(const GLdouble *v)
-{
- rasterpos((GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos4fv(const GLfloat *v)
-{
- rasterpos(v[0], v[1], v[2], v[3]);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos4iv(const GLint *v)
-{
- rasterpos((GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
-}
-
-static void GLAPIENTRY
-_mesa_RasterPos4sv(const GLshort *v)
-{
- rasterpos(v[0], v[1], v[2], v[3]);
-}
-
-
-/**********************************************************************/
-/*** GL_ARB_window_pos / GL_MESA_window_pos ***/
-/**********************************************************************/
-
-
-/**
- * All glWindowPosMESA and glWindowPosARB commands call this function to
- * update the current raster position.
- */
-static void
-window_pos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLfloat z2;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT(ctx, 0);
-
- z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near)
- + ctx->Viewport.Near;
-
- /* set raster position */
- ctx->Current.RasterPos[0] = x;
- ctx->Current.RasterPos[1] = y;
- ctx->Current.RasterPos[2] = z2;
- ctx->Current.RasterPos[3] = 1.0F;
-
- ctx->Current.RasterPosValid = GL_TRUE;
-
- if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
- ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
- else
- ctx->Current.RasterDistance = 0.0;
-
- /* raster color = current color or index */
- ctx->Current.RasterColor[0]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F);
- ctx->Current.RasterColor[1]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F);
- ctx->Current.RasterColor[2]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F);
- ctx->Current.RasterColor[3]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F);
- ctx->Current.RasterSecondaryColor[0]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F);
- ctx->Current.RasterSecondaryColor[1]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F);
- ctx->Current.RasterSecondaryColor[2]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F);
- ctx->Current.RasterSecondaryColor[3]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F);
-
- /* raster texcoord = current texcoord */
- {
- GLuint texSet;
- for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) {
- assert(texSet < Elements(ctx->Current.RasterTexCoords));
- COPY_4FV( ctx->Current.RasterTexCoords[texSet],
- ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] );
- }
- }
-
- if (ctx->RenderMode==GL_SELECT) {
- _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
- }
-}
-
-
-/* This is just to support the GL_MESA_window_pos version */
-static void
-window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- window_pos3f(x, y, z);
- ctx->Current.RasterPos[3] = w;
-}
-
-
-static void GLAPIENTRY
-_mesa_WindowPos2dMESA(GLdouble x, GLdouble y)
-{
- window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos2fMESA(GLfloat x, GLfloat y)
-{
- window_pos4f(x, y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos2iMESA(GLint x, GLint y)
-{
- window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos2sMESA(GLshort x, GLshort y)
-{
- window_pos4f(x, y, 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
-{
- window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
-{
- window_pos4f(x, y, z, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z)
-{
- window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
-{
- window_pos4f(x, y, z, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- window_pos4f(x, y, z, w);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
-{
- window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- window_pos4f(x, y, z, w);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos2dvMESA(const GLdouble *v)
-{
- window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos2fvMESA(const GLfloat *v)
-{
- window_pos4f(v[0], v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos2ivMESA(const GLint *v)
-{
- window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos2svMESA(const GLshort *v)
-{
- window_pos4f(v[0], v[1], 0.0F, 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos3dvMESA(const GLdouble *v)
-{
- window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos3fvMESA(const GLfloat *v)
-{
- window_pos4f(v[0], v[1], v[2], 1.0);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos3ivMESA(const GLint *v)
-{
- window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos3svMESA(const GLshort *v)
-{
- window_pos4f(v[0], v[1], v[2], 1.0F);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos4dvMESA(const GLdouble *v)
-{
- window_pos4f((GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos4fvMESA(const GLfloat *v)
-{
- window_pos4f(v[0], v[1], v[2], v[3]);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos4ivMESA(const GLint *v)
-{
- window_pos4f((GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
-}
-
-static void GLAPIENTRY
-_mesa_WindowPos4svMESA(const GLshort *v)
-{
- window_pos4f(v[0], v[1], v[2], v[3]);
-}
-
-
-#if 0
-
-/*
- * OpenGL implementation of glWindowPos*MESA()
- */
-void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
-{
- GLfloat fx, fy;
-
- /* Push current matrix mode and viewport attributes */
- glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT );
-
- /* Setup projection parameters */
- glMatrixMode( GL_PROJECTION );
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode( GL_MODELVIEW );
- glPushMatrix();
- glLoadIdentity();
-
- glDepthRange( z, z );
- glViewport( (int) x - 1, (int) y - 1, 2, 2 );
-
- /* set the raster (window) position */
- fx = x - (int) x;
- fy = y - (int) y;
- glRasterPos4f( fx, fy, 0.0, w );
-
- /* restore matrices, viewport and matrix mode */
- glPopMatrix();
- glMatrixMode( GL_PROJECTION );
- glPopMatrix();
-
- glPopAttrib();
-}
-
-#endif
-
-
-void
-_mesa_init_rastpos_dispatch(struct _glapi_table *disp)
-{
- SET_RasterPos2f(disp, _mesa_RasterPos2f);
- SET_RasterPos2fv(disp, _mesa_RasterPos2fv);
- SET_RasterPos2i(disp, _mesa_RasterPos2i);
- SET_RasterPos2iv(disp, _mesa_RasterPos2iv);
- SET_RasterPos2d(disp, _mesa_RasterPos2d);
- SET_RasterPos2dv(disp, _mesa_RasterPos2dv);
- SET_RasterPos2s(disp, _mesa_RasterPos2s);
- SET_RasterPos2sv(disp, _mesa_RasterPos2sv);
- SET_RasterPos3d(disp, _mesa_RasterPos3d);
- SET_RasterPos3dv(disp, _mesa_RasterPos3dv);
- SET_RasterPos3f(disp, _mesa_RasterPos3f);
- SET_RasterPos3fv(disp, _mesa_RasterPos3fv);
- SET_RasterPos3i(disp, _mesa_RasterPos3i);
- SET_RasterPos3iv(disp, _mesa_RasterPos3iv);
- SET_RasterPos3s(disp, _mesa_RasterPos3s);
- SET_RasterPos3sv(disp, _mesa_RasterPos3sv);
- SET_RasterPos4d(disp, _mesa_RasterPos4d);
- SET_RasterPos4dv(disp, _mesa_RasterPos4dv);
- SET_RasterPos4f(disp, _mesa_RasterPos4f);
- SET_RasterPos4fv(disp, _mesa_RasterPos4fv);
- SET_RasterPos4i(disp, _mesa_RasterPos4i);
- SET_RasterPos4iv(disp, _mesa_RasterPos4iv);
- SET_RasterPos4s(disp, _mesa_RasterPos4s);
- SET_RasterPos4sv(disp, _mesa_RasterPos4sv);
-
- /* 197. GL_MESA_window_pos */
- SET_WindowPos2dMESA(disp, _mesa_WindowPos2dMESA);
- SET_WindowPos2dvMESA(disp, _mesa_WindowPos2dvMESA);
- SET_WindowPos2fMESA(disp, _mesa_WindowPos2fMESA);
- SET_WindowPos2fvMESA(disp, _mesa_WindowPos2fvMESA);
- SET_WindowPos2iMESA(disp, _mesa_WindowPos2iMESA);
- SET_WindowPos2ivMESA(disp, _mesa_WindowPos2ivMESA);
- SET_WindowPos2sMESA(disp, _mesa_WindowPos2sMESA);
- SET_WindowPos2svMESA(disp, _mesa_WindowPos2svMESA);
- SET_WindowPos3dMESA(disp, _mesa_WindowPos3dMESA);
- SET_WindowPos3dvMESA(disp, _mesa_WindowPos3dvMESA);
- SET_WindowPos3fMESA(disp, _mesa_WindowPos3fMESA);
- SET_WindowPos3fvMESA(disp, _mesa_WindowPos3fvMESA);
- SET_WindowPos3iMESA(disp, _mesa_WindowPos3iMESA);
- SET_WindowPos3ivMESA(disp, _mesa_WindowPos3ivMESA);
- SET_WindowPos3sMESA(disp, _mesa_WindowPos3sMESA);
- SET_WindowPos3svMESA(disp, _mesa_WindowPos3svMESA);
- SET_WindowPos4dMESA(disp, _mesa_WindowPos4dMESA);
- SET_WindowPos4dvMESA(disp, _mesa_WindowPos4dvMESA);
- SET_WindowPos4fMESA(disp, _mesa_WindowPos4fMESA);
- SET_WindowPos4fvMESA(disp, _mesa_WindowPos4fvMESA);
- SET_WindowPos4iMESA(disp, _mesa_WindowPos4iMESA);
- SET_WindowPos4ivMESA(disp, _mesa_WindowPos4ivMESA);
- SET_WindowPos4sMESA(disp, _mesa_WindowPos4sMESA);
- SET_WindowPos4svMESA(disp, _mesa_WindowPos4svMESA);
-}
-
-
-#endif /* FEATURE_rastpos */
-
-
-/**********************************************************************/
-/** \name Initialization */
-/**********************************************************************/
-/*@{*/
-
-/**
- * Initialize the context current raster position information.
- *
- * \param ctx GL context.
- *
- * Initialize the current raster position information in
- * __struct gl_contextRec::Current, and adds the extension entry points to the
- * dispatcher.
- */
-void _mesa_init_rastpos( struct gl_context * ctx )
-{
- int i;
-
- ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 );
- ctx->Current.RasterDistance = 0.0;
- ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 );
- ASSIGN_4V( ctx->Current.RasterSecondaryColor, 0.0, 0.0, 0.0, 1.0 );
- for (i = 0; i < Elements(ctx->Current.RasterTexCoords); i++)
- ASSIGN_4V( ctx->Current.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 );
- ctx->Current.RasterPosValid = GL_TRUE;
-}
-
-/*@}*/
diff --git a/src/mesa/main/rastpos.h b/src/mesa/main/rastpos.h
deleted file mode 100644
index d113906..0000000
--- a/src/mesa/main/rastpos.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * \file rastpos.h
- * Raster position operations.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 4.1
- *
- * Copyright (C) 1999-2002 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 RASTPOS_H
-#define RASTPOS_H
-
-
-#include "compiler.h"
-#include "mfeatures.h"
-
-struct _glapi_table;
-struct gl_context;
-
-#if FEATURE_rastpos
-
-extern void
-_mesa_init_rastpos_dispatch(struct _glapi_table *disp);
-
-#else /* FEATURE_rastpos */
-
-static INLINE void
-_mesa_init_rastpos_dispatch(struct _glapi_table *disp)
-{
-}
-
-#endif /* FEATURE_rastpos */
-
-extern void
-_mesa_init_rastpos(struct gl_context *ctx);
-
-/*@}*/
-
-#endif /* RASTPOS_H */
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
deleted file mode 100644
index a5612e3..0000000
--- a/src/mesa/main/readpix.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * 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.
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "bufferobj.h"
-#include "context.h"
-#include "readpix.h"
-#include "framebuffer.h"
-#include "formats.h"
-#include "image.h"
-#include "state.h"
-
-
-/**
- * Do error checking of the format/type parameters to glReadPixels and
- * glDrawPixels.
- * \param drawing if GL_TRUE do checking for DrawPixels, else do checking
- * for ReadPixels.
- * \return GL_TRUE if error detected, GL_FALSE if no errors
- */
-GLboolean
-_mesa_error_check_format_type(struct gl_context *ctx, GLenum format, GLenum type,
- GLboolean drawing)
-{
- const char *readDraw = drawing ? "Draw" : "Read";
- const GLboolean reading = !drawing;
-
- /* state validation should have already been done */
- ASSERT(ctx->NewState == 0x0);
-
- if (ctx->Extensions.EXT_packed_depth_stencil
- && type == GL_UNSIGNED_INT_24_8_EXT
- && format != GL_DEPTH_STENCIL_EXT) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "gl%sPixels(format is not GL_DEPTH_STENCIL_EXT)", readDraw);
- return GL_TRUE;
- }
-
- /* basic combinations test */
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "gl%sPixels(format or type)", readDraw);
- return GL_TRUE;
- }
-
- /* additional checks */
- switch (format) {
- case GL_RG:
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_RGB:
- case GL_BGR:
- case GL_RGBA:
- case GL_BGRA:
- case GL_ABGR_EXT:
- 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:
- if (!drawing) {
- /* reading */
- if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadPixels(no color buffer)");
- return GL_TRUE;
- }
- }
- break;
- case GL_COLOR_INDEX:
- if (drawing) {
- if (ctx->PixelMaps.ItoR.Size == 0 ||
- ctx->PixelMaps.ItoG.Size == 0 ||
- ctx->PixelMaps.ItoB.Size == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glDrawPixels(drawing color index pixels into RGB buffer)");
- return GL_TRUE;
- }
- }
- else {
- /* reading */
- if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "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:
- if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
- (reading && !_mesa_source_buffer_exists(ctx, format))) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "gl%sPixels(no stencil buffer)", readDraw);
- return GL_TRUE;
- }
- break;
- case GL_DEPTH_COMPONENT:
- if ((drawing && !_mesa_dest_buffer_exists(ctx, format))) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "gl%sPixels(no depth buffer)", readDraw);
- return GL_TRUE;
- }
- break;
- case GL_DEPTH_STENCIL_EXT:
- if (!ctx->Extensions.EXT_packed_depth_stencil ||
- type != GL_UNSIGNED_INT_24_8_EXT) {
- _mesa_error(ctx, GL_INVALID_ENUM, "gl%sPixels(type)", readDraw);
- return GL_TRUE;
- }
- if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
- (reading && !_mesa_source_buffer_exists(ctx, format))) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "gl%sPixels(no depth or stencil buffer)", readDraw);
- return GL_TRUE;
- }
- break;
- default:
- /* this should have been caught in _mesa_is_legal_format_type() */
- _mesa_problem(ctx, "unexpected format in _mesa_%sPixels", readDraw);
- return GL_TRUE;
- }
-
- /* no errors */
- return GL_FALSE;
-}
-
-
-
-void GLAPIENTRY
-_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid *pixels )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- FLUSH_CURRENT(ctx, 0);
-
- if (width < 0 || height < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glReadPixels(width=%d height=%d)", width, height );
- return;
- }
-
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
- if (_mesa_error_check_format_type(ctx, format, type, GL_FALSE)) {
- /* found an error */
- return;
- }
-
- /* Check that the destination format and source buffer are both
- * integer-valued or both non-integer-valued.
- */
- if (ctx->Extensions.EXT_texture_integer && _mesa_is_color_format(format)) {
- const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
- const GLboolean srcInteger = _mesa_is_format_integer_color(rb->Format);
- const GLboolean dstInteger = _mesa_is_integer_format(format);
- if (dstInteger != srcInteger) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadPixels(integer / non-integer format mismatch");
- return;
- }
- }
-
- if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
- "glReadPixels(incomplete framebuffer)" );
- return;
- }
-
- if (!_mesa_source_buffer_exists(ctx, format)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)");
- return;
- }
-
- if (width == 0 || height == 0)
- return; /* nothing to do */
-
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
- format, type, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadPixels(invalid PBO access)");
- return;
- }
-
- if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
- /* buffer is mapped - that's an error */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
- return;
- }
- }
-
- ctx->Driver.ReadPixels(ctx, x, y, width, height,
- format, type, &ctx->Pack, pixels);
-}
diff --git a/src/mesa/main/readpix.h b/src/mesa/main/readpix.h
deleted file mode 100644
index fd25e70..0000000
--- a/src/mesa/main/readpix.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 READPIXELS_H
-#define READPIXELS_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-extern GLboolean
-_mesa_error_check_format_type(struct gl_context *ctx, GLenum format, GLenum type,
- GLboolean drawing);
-
-extern void GLAPIENTRY
-_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid *pixels );
-
-
-#endif
diff --git a/src/mesa/main/remap.c b/src/mesa/main/remap.c
deleted file mode 100644
index c89fba4..0000000
--- a/src/mesa/main/remap.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * 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 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 remap.c
- * Remap table management.
- *
- * Entries in the dispatch table are either static or dynamic. The
- * dispatch table is shared by mesa core and glapi. When they are
- * built separately, it is possible that a static entry in mesa core
- * is dynamic, or assigned a different static offset, in glapi. The
- * remap table is in charge of mapping a static entry in mesa core to
- * a dynamic entry, or the corresponding static entry, in glapi.
- */
-
-#include "mfeatures.h"
-
-#if FEATURE_remap_table
-
-#include "remap.h"
-#include "imports.h"
-#include "glapi/glapi.h"
-
-#define MAX_ENTRY_POINTS 16
-
-#define need_MESA_remap_table
-#include "main/remap_helper.h"
-
-
-/* this is global for quick access */
-int driDispatchRemapTable[driDispatchRemapTable_size];
-
-
-/**
- * Return the spec string associated with the given function index.
- * The index is available from including remap_helper.h.
- *
- * \param func_index an opaque function index.
- *
- * \return the spec string associated with the function index, or NULL.
- */
-const char *
-_mesa_get_function_spec(GLint func_index)
-{
- if (func_index < Elements(_mesa_function_pool))
- return _mesa_function_pool + func_index;
- else
- return NULL;
-}
-
-
-/**
- * Map a function by its spec. The function will be added to glapi,
- * and the dispatch offset will be returned.
- *
- * \param spec a '\0'-separated string array specifying a function.
- * It begins with the parameter signature of the function,
- * followed by the names of the entry points. An empty entry
- * point name terminates the array.
- *
- * \return the offset of the (re-)mapped function in the dispatch
- * table, or -1.
- */
-GLint
-_mesa_map_function_spec(const char *spec)
-{
- const char *signature;
- const char *names[MAX_ENTRY_POINTS + 1];
- GLint num_names = 0;
-
- if (!spec)
- return -1;
-
- signature = spec;
- spec += strlen(spec) + 1;
-
- /* spec is terminated by an empty string */
- while (*spec) {
- names[num_names] = spec;
- num_names++;
- if (num_names >= MAX_ENTRY_POINTS)
- break;
- spec += strlen(spec) + 1;
- }
- if (!num_names)
- return -1;
-
- names[num_names] = NULL;
-
- /* add the entry points to the dispatch table */
- return _glapi_add_dispatch(names, signature);
-}
-
-
-/**
- * Map an array of functions. This is a convenient function for
- * use with arrays available from including remap_helper.h.
- *
- * Note that the dispatch offsets of the functions are not returned.
- * If they are needed, _mesa_map_function_spec() should be used.
- *
- * \param func_array an array of function remaps.
- */
-void
-_mesa_map_function_array(const struct gl_function_remap *func_array)
-{
- GLint i;
-
- if (!func_array)
- return;
-
- for (i = 0; func_array[i].func_index != -1; i++) {
- const char *spec;
- GLint offset;
-
- spec = _mesa_get_function_spec(func_array[i].func_index);
- if (!spec) {
- _mesa_problem(NULL, "invalid function index %d",
- func_array[i].func_index);
- continue;
- }
-
- offset = _mesa_map_function_spec(spec);
- /* error checks */
- if (offset < 0) {
- const char *name = spec + strlen(spec) + 1;
- _mesa_warning(NULL, "failed to remap %s", name);
- }
- else if (func_array[i].dispatch_offset >= 0 &&
- offset != func_array[i].dispatch_offset) {
- const char *name = spec + strlen(spec) + 1;
- _mesa_problem(NULL, "%s should be mapped to %d, not %d",
- name, func_array[i].dispatch_offset, offset);
- }
- }
-}
-
-
-/**
- * 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.
- */
-static 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;
-
- if (initialized)
- return;
- initialized = GL_TRUE;
-
- /* initialize the remap table */
- for (i = 0; i < size; i++) {
- GLint offset;
- const char *spec;
-
- /* sanity check */
- 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 */
- driDispatchRemapTable[i] = offset;
- if (offset < 0)
- _mesa_warning(NULL, "failed to remap index %d", i);
- }
-}
-
-
-void
-_mesa_init_remap_table(void)
-{
- _mesa_do_init_remap_table(_mesa_function_pool,
- driDispatchRemapTable_size,
- MESA_remap_table_functions);
-}
-
-
-#endif /* FEATURE_remap_table */
diff --git a/src/mesa/main/remap.h b/src/mesa/main/remap.h
deleted file mode 100644
index 5fee300..0000000
--- a/src/mesa/main/remap.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * 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 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 REMAP_H
-#define REMAP_H
-
-
-#include "main/compiler.h"
-#include "main/mfeatures.h"
-
-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
-
-extern int
-driDispatchRemapTable[];
-
-extern const char *
-_mesa_get_function_spec(int func_index);
-
-extern int
-_mesa_map_function_spec(const char *spec);
-
-extern void
-_mesa_map_function_array(const struct gl_function_remap *func_array);
-
-extern void
-_mesa_map_static_functions(void);
-
-extern void
-_mesa_init_remap_table(void);
-
-#else /* FEATURE_remap_table */
-
-static INLINE const char *
-_mesa_get_function_spec(int func_index)
-{
- return NULL;
-}
-
-static INLINE int
-_mesa_map_function_spec(const char *spec)
-{
- return -1;
-}
-
-static INLINE void
-_mesa_map_function_array(const struct gl_function_remap *func_array)
-{
-}
-
-static INLINE void
-_mesa_map_static_functions(void)
-{
-}
-
-
-static INLINE void
-_mesa_init_remap_table(void)
-{
-}
-
-#endif /* FEATURE_remap_table */
-
-
-#endif /* REMAP_H */
diff --git a/src/mesa/main/remap_helper.h b/src/mesa/main/remap_helper.h
deleted file mode 100644
index 7368c76..0000000
--- a/src/mesa/main/remap_helper.h
+++ /dev/null
@@ -1,6504 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by remap_helper.py (from Mesa) script */
-
-/*
- * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
- * 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
- * Chia-I Wu,
- * 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 "main/dispatch.h"
-#include "main/remap.h"
-
-/* this is internal to remap.c */
-#ifdef need_MESA_remap_table
-
-static const char _mesa_function_pool[] =
- /* _mesa_function_pool[0]: MapGrid1d (offset 224) */
- "idd\0"
- "glMapGrid1d\0"
- "\0"
- /* _mesa_function_pool[17]: UniformMatrix3fvARB (will be remapped) */
- "iiip\0"
- "glUniformMatrix3fv\0"
- "glUniformMatrix3fvARB\0"
- "\0"
- /* _mesa_function_pool[64]: MapGrid1f (offset 225) */
- "iff\0"
- "glMapGrid1f\0"
- "\0"
- /* _mesa_function_pool[81]: VertexAttribI2iEXT (will be remapped) */
- "iii\0"
- "glVertexAttribI2iEXT\0"
- "glVertexAttribI2i\0"
- "\0"
- /* _mesa_function_pool[125]: RasterPos4i (offset 82) */
- "iiii\0"
- "glRasterPos4i\0"
- "\0"
- /* _mesa_function_pool[145]: RasterPos4d (offset 78) */
- "dddd\0"
- "glRasterPos4d\0"
- "\0"
- /* _mesa_function_pool[165]: NewList (dynamic) */
- "ii\0"
- "glNewList\0"
- "\0"
- /* _mesa_function_pool[179]: RasterPos4f (offset 80) */
- "ffff\0"
- "glRasterPos4f\0"
- "\0"
- /* _mesa_function_pool[199]: LoadIdentity (offset 290) */
- "\0"
- "glLoadIdentity\0"
- "\0"
- /* _mesa_function_pool[216]: SampleCoverageARB (will be remapped) */
- "fi\0"
- "glSampleCoverage\0"
- "glSampleCoverageARB\0"
- "\0"
- /* _mesa_function_pool[257]: ConvolutionFilter1D (offset 348) */
- "iiiiip\0"
- "glConvolutionFilter1D\0"
- "glConvolutionFilter1DEXT\0"
- "\0"
- /* _mesa_function_pool[312]: BeginQueryARB (will be remapped) */
- "ii\0"
- "glBeginQuery\0"
- "glBeginQueryARB\0"
- "\0"
- /* _mesa_function_pool[345]: RasterPos3dv (offset 71) */
- "p\0"
- "glRasterPos3dv\0"
- "\0"
- /* _mesa_function_pool[363]: PointParameteriNV (will be remapped) */
- "ii\0"
- "glPointParameteri\0"
- "glPointParameteriNV\0"
- "\0"
- /* _mesa_function_pool[405]: GetProgramiv (will be remapped) */
- "iip\0"
- "glGetProgramiv\0"
- "\0"
- /* _mesa_function_pool[425]: MultiTexCoord3sARB (offset 398) */
- "iiii\0"
- "glMultiTexCoord3s\0"
- "glMultiTexCoord3sARB\0"
- "\0"
- /* _mesa_function_pool[470]: SecondaryColor3iEXT (will be remapped) */
- "iii\0"
- "glSecondaryColor3i\0"
- "glSecondaryColor3iEXT\0"
- "\0"
- /* _mesa_function_pool[516]: WindowPos3fMESA (will be remapped) */
- "fff\0"
- "glWindowPos3f\0"
- "glWindowPos3fARB\0"
- "glWindowPos3fMESA\0"
- "\0"
- /* _mesa_function_pool[570]: TexCoord1iv (offset 99) */
- "p\0"
- "glTexCoord1iv\0"
- "\0"
- /* _mesa_function_pool[587]: TexCoord4sv (offset 125) */
- "p\0"
- "glTexCoord4sv\0"
- "\0"
- /* _mesa_function_pool[604]: RasterPos4s (offset 84) */
- "iiii\0"
- "glRasterPos4s\0"
- "\0"
- /* _mesa_function_pool[624]: PixelTexGenParameterfvSGIS (will be remapped) */
- "ip\0"
- "glPixelTexGenParameterfvSGIS\0"
- "\0"
- /* _mesa_function_pool[657]: ActiveTextureARB (offset 374) */
- "i\0"
- "glActiveTexture\0"
- "glActiveTextureARB\0"
- "\0"
- /* _mesa_function_pool[695]: BlitFramebufferEXT (will be remapped) */
- "iiiiiiiiii\0"
- "glBlitFramebuffer\0"
- "glBlitFramebufferEXT\0"
- "\0"
- /* _mesa_function_pool[746]: TexCoord1f (offset 96) */
- "f\0"
- "glTexCoord1f\0"
- "\0"
- /* _mesa_function_pool[762]: TexCoord1d (offset 94) */
- "d\0"
- "glTexCoord1d\0"
- "\0"
- /* _mesa_function_pool[778]: VertexAttrib4ubvNV (will be remapped) */
- "ip\0"
- "glVertexAttrib4ubvNV\0"
- "\0"
- /* _mesa_function_pool[803]: TexCoord1i (offset 98) */
- "i\0"
- "glTexCoord1i\0"
- "\0"
- /* _mesa_function_pool[819]: GetProgramNamedParameterdvNV (will be remapped) */
- "iipp\0"
- "glGetProgramNamedParameterdvNV\0"
- "\0"
- /* _mesa_function_pool[856]: Histogram (offset 367) */
- "iiii\0"
- "glHistogram\0"
- "glHistogramEXT\0"
- "\0"
- /* _mesa_function_pool[889]: TexCoord1s (offset 100) */
- "i\0"
- "glTexCoord1s\0"
- "\0"
- /* _mesa_function_pool[905]: GetMapfv (offset 267) */
- "iip\0"
- "glGetMapfv\0"
- "\0"
- /* _mesa_function_pool[921]: EvalCoord1f (offset 230) */
- "f\0"
- "glEvalCoord1f\0"
- "\0"
- /* _mesa_function_pool[938]: FramebufferTexture (will be remapped) */
- "iiii\0"
- "glFramebufferTexture\0"
- "\0"
- /* _mesa_function_pool[965]: VertexAttribI1ivEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI1ivEXT\0"
- "glVertexAttribI1iv\0"
- "\0"
- /* _mesa_function_pool[1010]: TexImage4DSGIS (dynamic) */
- "iiiiiiiiiip\0"
- "glTexImage4DSGIS\0"
- "\0"
- /* _mesa_function_pool[1040]: PolygonStipple (offset 175) */
- "p\0"
- "glPolygonStipple\0"
- "\0"
- /* _mesa_function_pool[1060]: WindowPos2dvMESA (will be remapped) */
- "p\0"
- "glWindowPos2dv\0"
- "glWindowPos2dvARB\0"
- "glWindowPos2dvMESA\0"
- "\0"
- /* _mesa_function_pool[1115]: ReplacementCodeuiColor3fVertex3fvSUN (dynamic) */
- "ppp\0"
- "glReplacementCodeuiColor3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[1159]: BlendEquationSeparateEXT (will be remapped) */
- "ii\0"
- "glBlendEquationSeparate\0"
- "glBlendEquationSeparateEXT\0"
- "glBlendEquationSeparateATI\0"
- "\0"
- /* _mesa_function_pool[1241]: ListParameterfSGIX (dynamic) */
- "iif\0"
- "glListParameterfSGIX\0"
- "\0"
- /* _mesa_function_pool[1267]: SecondaryColor3bEXT (will be remapped) */
- "iii\0"
- "glSecondaryColor3b\0"
- "glSecondaryColor3bEXT\0"
- "\0"
- /* _mesa_function_pool[1313]: TexCoord4fColor4fNormal3fVertex4fvSUN (dynamic) */
- "pppp\0"
- "glTexCoord4fColor4fNormal3fVertex4fvSUN\0"
- "\0"
- /* _mesa_function_pool[1359]: GetPixelMapfv (offset 271) */
- "ip\0"
- "glGetPixelMapfv\0"
- "\0"
- /* _mesa_function_pool[1379]: Color3uiv (offset 22) */
- "p\0"
- "glColor3uiv\0"
- "\0"
- /* _mesa_function_pool[1394]: IsEnabled (offset 286) */
- "i\0"
- "glIsEnabled\0"
- "\0"
- /* _mesa_function_pool[1409]: VertexAttrib4svNV (will be remapped) */
- "ip\0"
- "glVertexAttrib4svNV\0"
- "\0"
- /* _mesa_function_pool[1433]: EvalCoord2fv (offset 235) */
- "p\0"
- "glEvalCoord2fv\0"
- "\0"
- /* _mesa_function_pool[1451]: GetBufferSubDataARB (will be remapped) */
- "iiip\0"
- "glGetBufferSubData\0"
- "glGetBufferSubDataARB\0"
- "\0"
- /* _mesa_function_pool[1498]: BufferSubDataARB (will be remapped) */
- "iiip\0"
- "glBufferSubData\0"
- "glBufferSubDataARB\0"
- "\0"
- /* _mesa_function_pool[1539]: TexCoord2fColor4ubVertex3fvSUN (dynamic) */
- "ppp\0"
- "glTexCoord2fColor4ubVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[1577]: AttachShader (will be remapped) */
- "ii\0"
- "glAttachShader\0"
- "\0"
- /* _mesa_function_pool[1596]: VertexAttrib2fARB (will be remapped) */
- "iff\0"
- "glVertexAttrib2f\0"
- "glVertexAttrib2fARB\0"
- "\0"
- /* _mesa_function_pool[1638]: GetDebugLogLengthMESA (dynamic) */
- "iii\0"
- "glGetDebugLogLengthMESA\0"
- "\0"
- /* _mesa_function_pool[1667]: GetMapiv (offset 268) */
- "iip\0"
- "glGetMapiv\0"
- "\0"
- /* _mesa_function_pool[1683]: VertexAttrib3fARB (will be remapped) */
- "ifff\0"
- "glVertexAttrib3f\0"
- "glVertexAttrib3fARB\0"
- "\0"
- /* _mesa_function_pool[1726]: Indexubv (offset 316) */
- "p\0"
- "glIndexubv\0"
- "\0"
- /* _mesa_function_pool[1740]: GetQueryivARB (will be remapped) */
- "iip\0"
- "glGetQueryiv\0"
- "glGetQueryivARB\0"
- "\0"
- /* _mesa_function_pool[1774]: TexImage3D (offset 371) */
- "iiiiiiiiip\0"
- "glTexImage3D\0"
- "glTexImage3DEXT\0"
- "\0"
- /* _mesa_function_pool[1815]: BindFragDataLocationEXT (will be remapped) */
- "iip\0"
- "glBindFragDataLocationEXT\0"
- "glBindFragDataLocation\0"
- "\0"
- /* _mesa_function_pool[1869]: ReplacementCodeuiVertex3fvSUN (dynamic) */
- "pp\0"
- "glReplacementCodeuiVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[1905]: EdgeFlagPointer (offset 312) */
- "ip\0"
- "glEdgeFlagPointer\0"
- "\0"
- /* _mesa_function_pool[1927]: Color3ubv (offset 20) */
- "p\0"
- "glColor3ubv\0"
- "\0"
- /* _mesa_function_pool[1942]: GetQueryObjectivARB (will be remapped) */
- "iip\0"
- "glGetQueryObjectiv\0"
- "glGetQueryObjectivARB\0"
- "\0"
- /* _mesa_function_pool[1988]: Vertex3dv (offset 135) */
- "p\0"
- "glVertex3dv\0"
- "\0"
- /* _mesa_function_pool[2003]: ReplacementCodeuiTexCoord2fVertex3fvSUN (dynamic) */
- "ppp\0"
- "glReplacementCodeuiTexCoord2fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[2050]: CompressedTexSubImage2DARB (will be remapped) */
- "iiiiiiiip\0"
- "glCompressedTexSubImage2D\0"
- "glCompressedTexSubImage2DARB\0"
- "\0"
- /* _mesa_function_pool[2116]: CombinerOutputNV (will be remapped) */
- "iiiiiiiiii\0"
- "glCombinerOutputNV\0"
- "\0"
- /* _mesa_function_pool[2147]: VertexAttribs3fvNV (will be remapped) */
- "iip\0"
- "glVertexAttribs3fvNV\0"
- "\0"
- /* _mesa_function_pool[2173]: Uniform2fARB (will be remapped) */
- "iff\0"
- "glUniform2f\0"
- "glUniform2fARB\0"
- "\0"
- /* _mesa_function_pool[2205]: LightModeliv (offset 166) */
- "ip\0"
- "glLightModeliv\0"
- "\0"
- /* _mesa_function_pool[2224]: VertexAttrib1svARB (will be remapped) */
- "ip\0"
- "glVertexAttrib1sv\0"
- "glVertexAttrib1svARB\0"
- "\0"
- /* _mesa_function_pool[2267]: VertexAttribs1dvNV (will be remapped) */
- "iip\0"
- "glVertexAttribs1dvNV\0"
- "\0"
- /* _mesa_function_pool[2293]: Uniform2ivARB (will be remapped) */
- "iip\0"
- "glUniform2iv\0"
- "glUniform2ivARB\0"
- "\0"
- /* _mesa_function_pool[2327]: GetImageTransformParameterfvHP (dynamic) */
- "iip\0"
- "glGetImageTransformParameterfvHP\0"
- "\0"
- /* _mesa_function_pool[2365]: Normal3bv (offset 53) */
- "p\0"
- "glNormal3bv\0"
- "\0"
- /* _mesa_function_pool[2380]: TexGeniv (offset 193) */
- "iip\0"
- "glTexGeniv\0"
- "\0"
- /* _mesa_function_pool[2396]: WeightubvARB (dynamic) */
- "ip\0"
- "glWeightubvARB\0"
- "\0"
- /* _mesa_function_pool[2415]: VertexAttrib1fvNV (will be remapped) */
- "ip\0"
- "glVertexAttrib1fvNV\0"
- "\0"
- /* _mesa_function_pool[2439]: Vertex3iv (offset 139) */
- "p\0"
- "glVertex3iv\0"
- "\0"
- /* _mesa_function_pool[2454]: CopyConvolutionFilter1D (offset 354) */
- "iiiii\0"
- "glCopyConvolutionFilter1D\0"
- "glCopyConvolutionFilter1DEXT\0"
- "\0"
- /* _mesa_function_pool[2516]: VertexAttribI1uiEXT (will be remapped) */
- "ii\0"
- "glVertexAttribI1uiEXT\0"
- "glVertexAttribI1ui\0"
- "\0"
- /* _mesa_function_pool[2561]: ReplacementCodeuiNormal3fVertex3fSUN (dynamic) */
- "iffffff\0"
- "glReplacementCodeuiNormal3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[2609]: DeleteSync (will be remapped) */
- "i\0"
- "glDeleteSync\0"
- "\0"
- /* _mesa_function_pool[2625]: FragmentMaterialfvSGIX (dynamic) */
- "iip\0"
- "glFragmentMaterialfvSGIX\0"
- "\0"
- /* _mesa_function_pool[2655]: BlendColor (offset 336) */
- "ffff\0"
- "glBlendColor\0"
- "glBlendColorEXT\0"
- "\0"
- /* _mesa_function_pool[2690]: UniformMatrix4fvARB (will be remapped) */
- "iiip\0"
- "glUniformMatrix4fv\0"
- "glUniformMatrix4fvARB\0"
- "\0"
- /* _mesa_function_pool[2737]: DeleteVertexArraysAPPLE (will be remapped) */
- "ip\0"
- "glDeleteVertexArrays\0"
- "glDeleteVertexArraysAPPLE\0"
- "\0"
- /* _mesa_function_pool[2788]: TexBuffer (will be remapped) */
- "iii\0"
- "glTexBuffer\0"
- "\0"
- /* _mesa_function_pool[2805]: ReadInstrumentsSGIX (dynamic) */
- "i\0"
- "glReadInstrumentsSGIX\0"
- "\0"
- /* _mesa_function_pool[2830]: CallLists (offset 3) */
- "iip\0"
- "glCallLists\0"
- "\0"
- /* _mesa_function_pool[2847]: UniformMatrix2x4fv (will be remapped) */
- "iiip\0"
- "glUniformMatrix2x4fv\0"
- "\0"
- /* _mesa_function_pool[2874]: Color4ubVertex3fvSUN (dynamic) */
- "pp\0"
- "glColor4ubVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[2901]: Normal3iv (offset 59) */
- "p\0"
- "glNormal3iv\0"
- "\0"
- /* _mesa_function_pool[2916]: PassThrough (offset 199) */
- "f\0"
- "glPassThrough\0"
- "\0"
- /* _mesa_function_pool[2933]: GetVertexAttribIivEXT (will be remapped) */
- "iip\0"
- "glGetVertexAttribIivEXT\0"
- "glGetVertexAttribIiv\0"
- "\0"
- /* _mesa_function_pool[2983]: TexParameterIivEXT (will be remapped) */
- "iip\0"
- "glTexParameterIivEXT\0"
- "glTexParameterIiv\0"
- "\0"
- /* _mesa_function_pool[3027]: FramebufferTextureLayerEXT (will be remapped) */
- "iiiii\0"
- "glFramebufferTextureLayer\0"
- "glFramebufferTextureLayerEXT\0"
- "\0"
- /* _mesa_function_pool[3089]: GetListParameterfvSGIX (dynamic) */
- "iip\0"
- "glGetListParameterfvSGIX\0"
- "\0"
- /* _mesa_function_pool[3119]: Viewport (offset 305) */
- "iiii\0"
- "glViewport\0"
- "\0"
- /* _mesa_function_pool[3136]: VertexAttrib4NusvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4Nusv\0"
- "glVertexAttrib4NusvARB\0"
- "\0"
- /* _mesa_function_pool[3183]: WindowPos4svMESA (will be remapped) */
- "p\0"
- "glWindowPos4svMESA\0"
- "\0"
- /* _mesa_function_pool[3205]: CreateProgramObjectARB (will be remapped) */
- "\0"
- "glCreateProgramObjectARB\0"
- "\0"
- /* _mesa_function_pool[3232]: DeleteTransformFeedbacks (will be remapped) */
- "ip\0"
- "glDeleteTransformFeedbacks\0"
- "\0"
- /* _mesa_function_pool[3263]: UniformMatrix4x3fv (will be remapped) */
- "iiip\0"
- "glUniformMatrix4x3fv\0"
- "\0"
- /* _mesa_function_pool[3290]: PrioritizeTextures (offset 331) */
- "ipp\0"
- "glPrioritizeTextures\0"
- "glPrioritizeTexturesEXT\0"
- "\0"
- /* _mesa_function_pool[3340]: VertexAttribI3uiEXT (will be remapped) */
- "iiii\0"
- "glVertexAttribI3uiEXT\0"
- "glVertexAttribI3ui\0"
- "\0"
- /* _mesa_function_pool[3387]: AsyncMarkerSGIX (dynamic) */
- "i\0"
- "glAsyncMarkerSGIX\0"
- "\0"
- /* _mesa_function_pool[3408]: GlobalAlphaFactorubSUN (dynamic) */
- "i\0"
- "glGlobalAlphaFactorubSUN\0"
- "\0"
- /* _mesa_function_pool[3436]: ClearColorIuiEXT (will be remapped) */
- "iiii\0"
- "glClearColorIuiEXT\0"
- "\0"
- /* _mesa_function_pool[3461]: ClearDebugLogMESA (dynamic) */
- "iii\0"
- "glClearDebugLogMESA\0"
- "\0"
- /* _mesa_function_pool[3486]: Uniform4uiEXT (will be remapped) */
- "iiiii\0"
- "glUniform4uiEXT\0"
- "glUniform4ui\0"
- "\0"
- /* _mesa_function_pool[3522]: ResetHistogram (offset 369) */
- "i\0"
- "glResetHistogram\0"
- "glResetHistogramEXT\0"
- "\0"
- /* _mesa_function_pool[3562]: GetProgramNamedParameterfvNV (will be remapped) */
- "iipp\0"
- "glGetProgramNamedParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[3599]: PointParameterfEXT (will be remapped) */
- "if\0"
- "glPointParameterf\0"
- "glPointParameterfARB\0"
- "glPointParameterfEXT\0"
- "glPointParameterfSGIS\0"
- "\0"
- /* _mesa_function_pool[3685]: LoadIdentityDeformationMapSGIX (dynamic) */
- "i\0"
- "glLoadIdentityDeformationMapSGIX\0"
- "\0"
- /* _mesa_function_pool[3721]: GenFencesNV (will be remapped) */
- "ip\0"
- "glGenFencesNV\0"
- "\0"
- /* _mesa_function_pool[3739]: ImageTransformParameterfHP (dynamic) */
- "iif\0"
- "glImageTransformParameterfHP\0"
- "\0"
- /* _mesa_function_pool[3773]: MatrixIndexusvARB (dynamic) */
- "ip\0"
- "glMatrixIndexusvARB\0"
- "\0"
- /* _mesa_function_pool[3797]: DrawElementsBaseVertex (will be remapped) */
- "iiipi\0"
- "glDrawElementsBaseVertex\0"
- "\0"
- /* _mesa_function_pool[3829]: DisableVertexAttribArrayARB (will be remapped) */
- "i\0"
- "glDisableVertexAttribArray\0"
- "glDisableVertexAttribArrayARB\0"
- "\0"
- /* _mesa_function_pool[3889]: TexCoord2sv (offset 109) */
- "p\0"
- "glTexCoord2sv\0"
- "\0"
- /* _mesa_function_pool[3906]: Vertex4dv (offset 143) */
- "p\0"
- "glVertex4dv\0"
- "\0"
- /* _mesa_function_pool[3921]: StencilMaskSeparate (will be remapped) */
- "ii\0"
- "glStencilMaskSeparate\0"
- "\0"
- /* _mesa_function_pool[3947]: ProgramLocalParameter4dARB (will be remapped) */
- "iidddd\0"
- "glProgramLocalParameter4dARB\0"
- "\0"
- /* _mesa_function_pool[3984]: CompressedTexImage3DARB (will be remapped) */
- "iiiiiiiip\0"
- "glCompressedTexImage3D\0"
- "glCompressedTexImage3DARB\0"
- "\0"
- /* _mesa_function_pool[4044]: Color3sv (offset 18) */
- "p\0"
- "glColor3sv\0"
- "\0"
- /* _mesa_function_pool[4058]: GetConvolutionParameteriv (offset 358) */
- "iip\0"
- "glGetConvolutionParameteriv\0"
- "glGetConvolutionParameterivEXT\0"
- "\0"
- /* _mesa_function_pool[4122]: VertexAttrib1fARB (will be remapped) */
- "if\0"
- "glVertexAttrib1f\0"
- "glVertexAttrib1fARB\0"
- "\0"
- /* _mesa_function_pool[4163]: Vertex2dv (offset 127) */
- "p\0"
- "glVertex2dv\0"
- "\0"
- /* _mesa_function_pool[4178]: TestFenceNV (will be remapped) */
- "i\0"
- "glTestFenceNV\0"
- "\0"
- /* _mesa_function_pool[4195]: GetVertexAttribIuivEXT (will be remapped) */
- "iip\0"
- "glGetVertexAttribIuivEXT\0"
- "glGetVertexAttribIuiv\0"
- "\0"
- /* _mesa_function_pool[4247]: MultiTexCoord1fvARB (offset 379) */
- "ip\0"
- "glMultiTexCoord1fv\0"
- "glMultiTexCoord1fvARB\0"
- "\0"
- /* _mesa_function_pool[4292]: TexCoord3iv (offset 115) */
- "p\0"
- "glTexCoord3iv\0"
- "\0"
- /* _mesa_function_pool[4309]: Uniform2uivEXT (will be remapped) */
- "iip\0"
- "glUniform2uivEXT\0"
- "glUniform2uiv\0"
- "\0"
- /* _mesa_function_pool[4345]: ColorFragmentOp2ATI (will be remapped) */
- "iiiiiiiiii\0"
- "glColorFragmentOp2ATI\0"
- "\0"
- /* _mesa_function_pool[4379]: SecondaryColorPointerListIBM (dynamic) */
- "iiipi\0"
- "glSecondaryColorPointerListIBM\0"
- "\0"
- /* _mesa_function_pool[4417]: GetPixelTexGenParameterivSGIS (will be remapped) */
- "ip\0"
- "glGetPixelTexGenParameterivSGIS\0"
- "\0"
- /* _mesa_function_pool[4453]: Color3fv (offset 14) */
- "p\0"
- "glColor3fv\0"
- "\0"
- /* _mesa_function_pool[4467]: VertexAttrib4fNV (will be remapped) */
- "iffff\0"
- "glVertexAttrib4fNV\0"
- "\0"
- /* _mesa_function_pool[4493]: ReplacementCodeubSUN (dynamic) */
- "i\0"
- "glReplacementCodeubSUN\0"
- "\0"
- /* _mesa_function_pool[4519]: FinishAsyncSGIX (dynamic) */
- "p\0"
- "glFinishAsyncSGIX\0"
- "\0"
- /* _mesa_function_pool[4540]: GetDebugLogMESA (dynamic) */
- "iiiipp\0"
- "glGetDebugLogMESA\0"
- "\0"
- /* _mesa_function_pool[4566]: FogCoorddEXT (will be remapped) */
- "d\0"
- "glFogCoordd\0"
- "glFogCoorddEXT\0"
- "\0"
- /* _mesa_function_pool[4596]: BeginConditionalRenderNV (will be remapped) */
- "ii\0"
- "glBeginConditionalRenderNV\0"
- "glBeginConditionalRender\0"
- "\0"
- /* _mesa_function_pool[4652]: Color4ubVertex3fSUN (dynamic) */
- "iiiifff\0"
- "glColor4ubVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[4683]: FogCoordfEXT (will be remapped) */
- "f\0"
- "glFogCoordf\0"
- "glFogCoordfEXT\0"
- "\0"
- /* _mesa_function_pool[4713]: PointSize (offset 173) */
- "f\0"
- "glPointSize\0"
- "\0"
- /* _mesa_function_pool[4728]: VertexAttribI2uivEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI2uivEXT\0"
- "glVertexAttribI2uiv\0"
- "\0"
- /* _mesa_function_pool[4775]: TexCoord2fVertex3fSUN (dynamic) */
- "fffff\0"
- "glTexCoord2fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[4806]: PopName (offset 200) */
- "\0"
- "glPopName\0"
- "\0"
- /* _mesa_function_pool[4818]: GlobalAlphaFactoriSUN (dynamic) */
- "i\0"
- "glGlobalAlphaFactoriSUN\0"
- "\0"
- /* _mesa_function_pool[4845]: VertexAttrib2dNV (will be remapped) */
- "idd\0"
- "glVertexAttrib2dNV\0"
- "\0"
- /* _mesa_function_pool[4869]: GetProgramInfoLog (will be remapped) */
- "iipp\0"
- "glGetProgramInfoLog\0"
- "\0"
- /* _mesa_function_pool[4895]: VertexAttrib4NbvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4Nbv\0"
- "glVertexAttrib4NbvARB\0"
- "\0"
- /* _mesa_function_pool[4940]: GetActiveAttribARB (will be remapped) */
- "iiipppp\0"
- "glGetActiveAttrib\0"
- "glGetActiveAttribARB\0"
- "\0"
- /* _mesa_function_pool[4988]: Vertex4sv (offset 149) */
- "p\0"
- "glVertex4sv\0"
- "\0"
- /* _mesa_function_pool[5003]: VertexAttrib4ubNV (will be remapped) */
- "iiiii\0"
- "glVertexAttrib4ubNV\0"
- "\0"
- /* _mesa_function_pool[5030]: ClampColor (will be remapped) */
- "ii\0"
- "glClampColor\0"
- "\0"
- /* _mesa_function_pool[5047]: TextureRangeAPPLE (will be remapped) */
- "iip\0"
- "glTextureRangeAPPLE\0"
- "\0"
- /* _mesa_function_pool[5072]: GetTexEnvfv (offset 276) */
- "iip\0"
- "glGetTexEnvfv\0"
- "\0"
- /* _mesa_function_pool[5091]: BindTransformFeedback (will be remapped) */
- "ii\0"
- "glBindTransformFeedback\0"
- "\0"
- /* _mesa_function_pool[5119]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
- "ffffffffffff\0"
- "glTexCoord2fColor4fNormal3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[5172]: Indexub (offset 315) */
- "i\0"
- "glIndexub\0"
- "\0"
- /* _mesa_function_pool[5185]: TexEnvi (offset 186) */
- "iii\0"
- "glTexEnvi\0"
- "\0"
- /* _mesa_function_pool[5200]: GetClipPlane (offset 259) */
- "ip\0"
- "glGetClipPlane\0"
- "\0"
- /* _mesa_function_pool[5219]: CombinerParameterfvNV (will be remapped) */
- "ip\0"
- "glCombinerParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[5247]: VertexAttribs3dvNV (will be remapped) */
- "iip\0"
- "glVertexAttribs3dvNV\0"
- "\0"
- /* _mesa_function_pool[5273]: VertexAttribI2uiEXT (will be remapped) */
- "iii\0"
- "glVertexAttribI2uiEXT\0"
- "glVertexAttribI2ui\0"
- "\0"
- /* _mesa_function_pool[5319]: VertexAttribs4fvNV (will be remapped) */
- "iip\0"
- "glVertexAttribs4fvNV\0"
- "\0"
- /* _mesa_function_pool[5345]: VertexArrayRangeNV (will be remapped) */
- "ip\0"
- "glVertexArrayRangeNV\0"
- "\0"
- /* _mesa_function_pool[5370]: FragmentLightiSGIX (dynamic) */
- "iii\0"
- "glFragmentLightiSGIX\0"
- "\0"
- /* _mesa_function_pool[5396]: PolygonOffsetEXT (will be remapped) */
- "ff\0"
- "glPolygonOffsetEXT\0"
- "\0"
- /* _mesa_function_pool[5419]: VertexAttribI4uivEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI4uivEXT\0"
- "glVertexAttribI4uiv\0"
- "\0"
- /* _mesa_function_pool[5466]: PollAsyncSGIX (dynamic) */
- "p\0"
- "glPollAsyncSGIX\0"
- "\0"
- /* _mesa_function_pool[5485]: DeleteFragmentShaderATI (will be remapped) */
- "i\0"
- "glDeleteFragmentShaderATI\0"
- "\0"
- /* _mesa_function_pool[5514]: Scaled (offset 301) */
- "ddd\0"
- "glScaled\0"
- "\0"
- /* _mesa_function_pool[5528]: ResumeTransformFeedback (will be remapped) */
- "\0"
- "glResumeTransformFeedback\0"
- "\0"
- /* _mesa_function_pool[5556]: Scalef (offset 302) */
- "fff\0"
- "glScalef\0"
- "\0"
- /* _mesa_function_pool[5570]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */
- "ppp\0"
- "glTexCoord2fNormal3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[5608]: MultTransposeMatrixdARB (will be remapped) */
- "p\0"
- "glMultTransposeMatrixd\0"
- "glMultTransposeMatrixdARB\0"
- "\0"
- /* _mesa_function_pool[5660]: ColorMaskIndexedEXT (will be remapped) */
- "iiiii\0"
- "glColorMaskIndexedEXT\0"
- "glColorMaski\0"
- "\0"
- /* _mesa_function_pool[5702]: ObjectUnpurgeableAPPLE (will be remapped) */
- "iii\0"
- "glObjectUnpurgeableAPPLE\0"
- "\0"
- /* _mesa_function_pool[5732]: AlphaFunc (offset 240) */
- "if\0"
- "glAlphaFunc\0"
- "\0"
- /* _mesa_function_pool[5748]: WindowPos2svMESA (will be remapped) */
- "p\0"
- "glWindowPos2sv\0"
- "glWindowPos2svARB\0"
- "glWindowPos2svMESA\0"
- "\0"
- /* _mesa_function_pool[5803]: EdgeFlag (offset 41) */
- "i\0"
- "glEdgeFlag\0"
- "\0"
- /* _mesa_function_pool[5817]: TexCoord2iv (offset 107) */
- "p\0"
- "glTexCoord2iv\0"
- "\0"
- /* _mesa_function_pool[5834]: CompressedTexImage1DARB (will be remapped) */
- "iiiiiip\0"
- "glCompressedTexImage1D\0"
- "glCompressedTexImage1DARB\0"
- "\0"
- /* _mesa_function_pool[5892]: Rotated (offset 299) */
- "dddd\0"
- "glRotated\0"
- "\0"
- /* _mesa_function_pool[5908]: GetTexParameterIuivEXT (will be remapped) */
- "iip\0"
- "glGetTexParameterIuivEXT\0"
- "glGetTexParameterIuiv\0"
- "\0"
- /* _mesa_function_pool[5960]: VertexAttrib2sNV (will be remapped) */
- "iii\0"
- "glVertexAttrib2sNV\0"
- "\0"
- /* _mesa_function_pool[5984]: ReadPixels (offset 256) */
- "iiiiiip\0"
- "glReadPixels\0"
- "\0"
- /* _mesa_function_pool[6006]: EdgeFlagv (offset 42) */
- "p\0"
- "glEdgeFlagv\0"
- "\0"
- /* _mesa_function_pool[6021]: NormalPointerListIBM (dynamic) */
- "iipi\0"
- "glNormalPointerListIBM\0"
- "\0"
- /* _mesa_function_pool[6050]: IndexPointerEXT (will be remapped) */
- "iiip\0"
- "glIndexPointerEXT\0"
- "\0"
- /* _mesa_function_pool[6074]: Color4iv (offset 32) */
- "p\0"
- "glColor4iv\0"
- "\0"
- /* _mesa_function_pool[6088]: TexParameterf (offset 178) */
- "iif\0"
- "glTexParameterf\0"
- "\0"
- /* _mesa_function_pool[6109]: TexParameteri (offset 180) */
- "iii\0"
- "glTexParameteri\0"
- "\0"
- /* _mesa_function_pool[6130]: NormalPointerEXT (will be remapped) */
- "iiip\0"
- "glNormalPointerEXT\0"
- "\0"
- /* _mesa_function_pool[6155]: MultiTexCoord3dARB (offset 392) */
- "iddd\0"
- "glMultiTexCoord3d\0"
- "glMultiTexCoord3dARB\0"
- "\0"
- /* _mesa_function_pool[6200]: MultiTexCoord2iARB (offset 388) */
- "iii\0"
- "glMultiTexCoord2i\0"
- "glMultiTexCoord2iARB\0"
- "\0"
- /* _mesa_function_pool[6244]: DrawPixels (offset 257) */
- "iiiip\0"
- "glDrawPixels\0"
- "\0"
- /* _mesa_function_pool[6264]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */
- "iffffffff\0"
- "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[6324]: MultiTexCoord2svARB (offset 391) */
- "ip\0"
- "glMultiTexCoord2sv\0"
- "glMultiTexCoord2svARB\0"
- "\0"
- /* _mesa_function_pool[6369]: ReplacementCodeubvSUN (dynamic) */
- "p\0"
- "glReplacementCodeubvSUN\0"
- "\0"
- /* _mesa_function_pool[6396]: Uniform3iARB (will be remapped) */
- "iiii\0"
- "glUniform3i\0"
- "glUniform3iARB\0"
- "\0"
- /* _mesa_function_pool[6429]: DrawTransformFeedback (will be remapped) */
- "ii\0"
- "glDrawTransformFeedback\0"
- "\0"
- /* _mesa_function_pool[6457]: DrawElementsInstancedARB (will be remapped) */
- "iiipi\0"
- "glDrawElementsInstancedARB\0"
- "glDrawElementsInstancedEXT\0"
- "glDrawElementsInstanced\0"
- "\0"
- /* _mesa_function_pool[6542]: GetShaderInfoLog (will be remapped) */
- "iipp\0"
- "glGetShaderInfoLog\0"
- "\0"
- /* _mesa_function_pool[6567]: WeightivARB (dynamic) */
- "ip\0"
- "glWeightivARB\0"
- "\0"
- /* _mesa_function_pool[6585]: PollInstrumentsSGIX (dynamic) */
- "p\0"
- "glPollInstrumentsSGIX\0"
- "\0"
- /* _mesa_function_pool[6610]: GlobalAlphaFactordSUN (dynamic) */
- "d\0"
- "glGlobalAlphaFactordSUN\0"
- "\0"
- /* _mesa_function_pool[6637]: GetFinalCombinerInputParameterfvNV (will be remapped) */
- "iip\0"
- "glGetFinalCombinerInputParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[6679]: GenerateMipmapEXT (will be remapped) */
- "i\0"
- "glGenerateMipmap\0"
- "glGenerateMipmapEXT\0"
- "\0"
- /* _mesa_function_pool[6719]: GenLists (offset 5) */
- "i\0"
- "glGenLists\0"
- "\0"
- /* _mesa_function_pool[6733]: SetFragmentShaderConstantATI (will be remapped) */
- "ip\0"
- "glSetFragmentShaderConstantATI\0"
- "\0"
- /* _mesa_function_pool[6768]: GetMapAttribParameterivNV (dynamic) */
- "iiip\0"
- "glGetMapAttribParameterivNV\0"
- "\0"
- /* _mesa_function_pool[6802]: CreateShaderObjectARB (will be remapped) */
- "i\0"
- "glCreateShaderObjectARB\0"
- "\0"
- /* _mesa_function_pool[6829]: GetSharpenTexFuncSGIS (dynamic) */
- "ip\0"
- "glGetSharpenTexFuncSGIS\0"
- "\0"
- /* _mesa_function_pool[6857]: BufferDataARB (will be remapped) */
- "iipi\0"
- "glBufferData\0"
- "glBufferDataARB\0"
- "\0"
- /* _mesa_function_pool[6892]: FlushVertexArrayRangeNV (will be remapped) */
- "\0"
- "glFlushVertexArrayRangeNV\0"
- "\0"
- /* _mesa_function_pool[6920]: MapGrid2d (offset 226) */
- "iddidd\0"
- "glMapGrid2d\0"
- "\0"
- /* _mesa_function_pool[6940]: MapGrid2f (offset 227) */
- "iffiff\0"
- "glMapGrid2f\0"
- "\0"
- /* _mesa_function_pool[6960]: SampleMapATI (will be remapped) */
- "iii\0"
- "glSampleMapATI\0"
- "\0"
- /* _mesa_function_pool[6980]: VertexPointerEXT (will be remapped) */
- "iiiip\0"
- "glVertexPointerEXT\0"
- "\0"
- /* _mesa_function_pool[7006]: GetTexFilterFuncSGIS (dynamic) */
- "iip\0"
- "glGetTexFilterFuncSGIS\0"
- "\0"
- /* _mesa_function_pool[7034]: Scissor (offset 176) */
- "iiii\0"
- "glScissor\0"
- "\0"
- /* _mesa_function_pool[7050]: Fogf (offset 153) */
- "if\0"
- "glFogf\0"
- "\0"
- /* _mesa_function_pool[7061]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */
- "ppp\0"
- "glReplacementCodeuiColor4ubVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[7106]: TexSubImage1D (offset 332) */
- "iiiiiip\0"
- "glTexSubImage1D\0"
- "glTexSubImage1DEXT\0"
- "\0"
- /* _mesa_function_pool[7150]: VertexAttrib1sARB (will be remapped) */
- "ii\0"
- "glVertexAttrib1s\0"
- "glVertexAttrib1sARB\0"
- "\0"
- /* _mesa_function_pool[7191]: FenceSync (will be remapped) */
- "ii\0"
- "glFenceSync\0"
- "\0"
- /* _mesa_function_pool[7207]: Color4usv (offset 40) */
- "p\0"
- "glColor4usv\0"
- "\0"
- /* _mesa_function_pool[7222]: Fogi (offset 155) */
- "ii\0"
- "glFogi\0"
- "\0"
- /* _mesa_function_pool[7233]: DepthRange (offset 288) */
- "dd\0"
- "glDepthRange\0"
- "\0"
- /* _mesa_function_pool[7250]: RasterPos3iv (offset 75) */
- "p\0"
- "glRasterPos3iv\0"
- "\0"
- /* _mesa_function_pool[7268]: FinalCombinerInputNV (will be remapped) */
- "iiii\0"
- "glFinalCombinerInputNV\0"
- "\0"
- /* _mesa_function_pool[7297]: TexCoord2i (offset 106) */
- "ii\0"
- "glTexCoord2i\0"
- "\0"
- /* _mesa_function_pool[7314]: PixelMapfv (offset 251) */
- "iip\0"
- "glPixelMapfv\0"
- "\0"
- /* _mesa_function_pool[7332]: Color4ui (offset 37) */
- "iiii\0"
- "glColor4ui\0"
- "\0"
- /* _mesa_function_pool[7349]: RasterPos3s (offset 76) */
- "iii\0"
- "glRasterPos3s\0"
- "\0"
- /* _mesa_function_pool[7368]: Color3usv (offset 24) */
- "p\0"
- "glColor3usv\0"
- "\0"
- /* _mesa_function_pool[7383]: FlushRasterSGIX (dynamic) */
- "\0"
- "glFlushRasterSGIX\0"
- "\0"
- /* _mesa_function_pool[7403]: TexCoord2f (offset 104) */
- "ff\0"
- "glTexCoord2f\0"
- "\0"
- /* _mesa_function_pool[7420]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */
- "ifffff\0"
- "glReplacementCodeuiTexCoord2fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[7469]: TexCoord2d (offset 102) */
- "dd\0"
- "glTexCoord2d\0"
- "\0"
- /* _mesa_function_pool[7486]: RasterPos3d (offset 70) */
- "ddd\0"
- "glRasterPos3d\0"
- "\0"
- /* _mesa_function_pool[7505]: RasterPos3f (offset 72) */
- "fff\0"
- "glRasterPos3f\0"
- "\0"
- /* _mesa_function_pool[7524]: Uniform1fARB (will be remapped) */
- "if\0"
- "glUniform1f\0"
- "glUniform1fARB\0"
- "\0"
- /* _mesa_function_pool[7555]: AreTexturesResident (offset 322) */
- "ipp\0"
- "glAreTexturesResident\0"
- "glAreTexturesResidentEXT\0"
- "\0"
- /* _mesa_function_pool[7607]: TexCoord2s (offset 108) */
- "ii\0"
- "glTexCoord2s\0"
- "\0"
- /* _mesa_function_pool[7624]: StencilOpSeparate (will be remapped) */
- "iiii\0"
- "glStencilOpSeparate\0"
- "glStencilOpSeparateATI\0"
- "\0"
- /* _mesa_function_pool[7673]: ColorTableParameteriv (offset 341) */
- "iip\0"
- "glColorTableParameteriv\0"
- "glColorTableParameterivSGI\0"
- "\0"
- /* _mesa_function_pool[7729]: FogCoordPointerListIBM (dynamic) */
- "iipi\0"
- "glFogCoordPointerListIBM\0"
- "\0"
- /* _mesa_function_pool[7760]: WindowPos3dMESA (will be remapped) */
- "ddd\0"
- "glWindowPos3d\0"
- "glWindowPos3dARB\0"
- "glWindowPos3dMESA\0"
- "\0"
- /* _mesa_function_pool[7814]: Color4us (offset 39) */
- "iiii\0"
- "glColor4us\0"
- "\0"
- /* _mesa_function_pool[7831]: PointParameterfvEXT (will be remapped) */
- "ip\0"
- "glPointParameterfv\0"
- "glPointParameterfvARB\0"
- "glPointParameterfvEXT\0"
- "glPointParameterfvSGIS\0"
- "\0"
- /* _mesa_function_pool[7921]: Color3bv (offset 10) */
- "p\0"
- "glColor3bv\0"
- "\0"
- /* _mesa_function_pool[7935]: WindowPos2fvMESA (will be remapped) */
- "p\0"
- "glWindowPos2fv\0"
- "glWindowPos2fvARB\0"
- "glWindowPos2fvMESA\0"
- "\0"
- /* _mesa_function_pool[7990]: SecondaryColor3bvEXT (will be remapped) */
- "p\0"
- "glSecondaryColor3bv\0"
- "glSecondaryColor3bvEXT\0"
- "\0"
- /* _mesa_function_pool[8036]: VertexPointerListIBM (dynamic) */
- "iiipi\0"
- "glVertexPointerListIBM\0"
- "\0"
- /* _mesa_function_pool[8066]: GetProgramLocalParameterfvARB (will be remapped) */
- "iip\0"
- "glGetProgramLocalParameterfvARB\0"
- "\0"
- /* _mesa_function_pool[8103]: FragmentMaterialfSGIX (dynamic) */
- "iif\0"
- "glFragmentMaterialfSGIX\0"
- "\0"
- /* _mesa_function_pool[8132]: TexCoord2fNormal3fVertex3fSUN (dynamic) */
- "ffffffff\0"
- "glTexCoord2fNormal3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[8174]: RenderbufferStorageEXT (will be remapped) */
- "iiii\0"
- "glRenderbufferStorage\0"
- "glRenderbufferStorageEXT\0"
- "\0"
- /* _mesa_function_pool[8227]: IsFenceNV (will be remapped) */
- "i\0"
- "glIsFenceNV\0"
- "\0"
- /* _mesa_function_pool[8242]: AttachObjectARB (will be remapped) */
- "ii\0"
- "glAttachObjectARB\0"
- "\0"
- /* _mesa_function_pool[8264]: GetFragmentLightivSGIX (dynamic) */
- "iip\0"
- "glGetFragmentLightivSGIX\0"
- "\0"
- /* _mesa_function_pool[8294]: UniformMatrix2fvARB (will be remapped) */
- "iiip\0"
- "glUniformMatrix2fv\0"
- "glUniformMatrix2fvARB\0"
- "\0"
- /* _mesa_function_pool[8341]: MultiTexCoord2fARB (offset 386) */
- "iff\0"
- "glMultiTexCoord2f\0"
- "glMultiTexCoord2fARB\0"
- "\0"
- /* _mesa_function_pool[8385]: ColorTable (offset 339) */
- "iiiiip\0"
- "glColorTable\0"
- "glColorTableSGI\0"
- "glColorTableEXT\0"
- "\0"
- /* _mesa_function_pool[8438]: IndexPointer (offset 314) */
- "iip\0"
- "glIndexPointer\0"
- "\0"
- /* _mesa_function_pool[8458]: Accum (offset 213) */
- "if\0"
- "glAccum\0"
- "\0"
- /* _mesa_function_pool[8470]: GetTexImage (offset 281) */
- "iiiip\0"
- "glGetTexImage\0"
- "\0"
- /* _mesa_function_pool[8491]: MapControlPointsNV (dynamic) */
- "iiiiiiiip\0"
- "glMapControlPointsNV\0"
- "\0"
- /* _mesa_function_pool[8523]: ConvolutionFilter2D (offset 349) */
- "iiiiiip\0"
- "glConvolutionFilter2D\0"
- "glConvolutionFilter2DEXT\0"
- "\0"
- /* _mesa_function_pool[8579]: Finish (offset 216) */
- "\0"
- "glFinish\0"
- "\0"
- /* _mesa_function_pool[8590]: MapParameterfvNV (dynamic) */
- "iip\0"
- "glMapParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[8614]: ClearStencil (offset 207) */
- "i\0"
- "glClearStencil\0"
- "\0"
- /* _mesa_function_pool[8632]: VertexAttrib3dvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib3dv\0"
- "glVertexAttrib3dvARB\0"
- "\0"
- /* _mesa_function_pool[8675]: Uniform4uivEXT (will be remapped) */
- "iip\0"
- "glUniform4uivEXT\0"
- "glUniform4uiv\0"
- "\0"
- /* _mesa_function_pool[8711]: HintPGI (dynamic) */
- "ii\0"
- "glHintPGI\0"
- "\0"
- /* _mesa_function_pool[8725]: ConvolutionParameteriv (offset 353) */
- "iip\0"
- "glConvolutionParameteriv\0"
- "glConvolutionParameterivEXT\0"
- "\0"
- /* _mesa_function_pool[8783]: Color4s (offset 33) */
- "iiii\0"
- "glColor4s\0"
- "\0"
- /* _mesa_function_pool[8799]: InterleavedArrays (offset 317) */
- "iip\0"
- "glInterleavedArrays\0"
- "\0"
- /* _mesa_function_pool[8824]: RasterPos2fv (offset 65) */
- "p\0"
- "glRasterPos2fv\0"
- "\0"
- /* _mesa_function_pool[8842]: TexCoord1fv (offset 97) */
- "p\0"
- "glTexCoord1fv\0"
- "\0"
- /* _mesa_function_pool[8859]: Vertex2d (offset 126) */
- "dd\0"
- "glVertex2d\0"
- "\0"
- /* _mesa_function_pool[8874]: CullParameterdvEXT (dynamic) */
- "ip\0"
- "glCullParameterdvEXT\0"
- "\0"
- /* _mesa_function_pool[8899]: ProgramNamedParameter4fNV (will be remapped) */
- "iipffff\0"
- "glProgramNamedParameter4fNV\0"
- "\0"
- /* _mesa_function_pool[8936]: Color3fVertex3fSUN (dynamic) */
- "ffffff\0"
- "glColor3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[8965]: ProgramEnvParameter4fvARB (will be remapped) */
- "iip\0"
- "glProgramEnvParameter4fvARB\0"
- "glProgramParameter4fvNV\0"
- "\0"
- /* _mesa_function_pool[9022]: Color4i (offset 31) */
- "iiii\0"
- "glColor4i\0"
- "\0"
- /* _mesa_function_pool[9038]: Color4f (offset 29) */
- "ffff\0"
- "glColor4f\0"
- "\0"
- /* _mesa_function_pool[9054]: RasterPos4fv (offset 81) */
- "p\0"
- "glRasterPos4fv\0"
- "\0"
- /* _mesa_function_pool[9072]: Color4d (offset 27) */
- "dddd\0"
- "glColor4d\0"
- "\0"
- /* _mesa_function_pool[9088]: ClearIndex (offset 205) */
- "f\0"
- "glClearIndex\0"
- "\0"
- /* _mesa_function_pool[9104]: Color4b (offset 25) */
- "iiii\0"
- "glColor4b\0"
- "\0"
- /* _mesa_function_pool[9120]: LoadMatrixd (offset 292) */
- "p\0"
- "glLoadMatrixd\0"
- "\0"
- /* _mesa_function_pool[9137]: FragmentLightModeliSGIX (dynamic) */
- "ii\0"
- "glFragmentLightModeliSGIX\0"
- "\0"
- /* _mesa_function_pool[9167]: RasterPos2dv (offset 63) */
- "p\0"
- "glRasterPos2dv\0"
- "\0"
- /* _mesa_function_pool[9185]: ConvolutionParameterfv (offset 351) */
- "iip\0"
- "glConvolutionParameterfv\0"
- "glConvolutionParameterfvEXT\0"
- "\0"
- /* _mesa_function_pool[9243]: TbufferMask3DFX (dynamic) */
- "i\0"
- "glTbufferMask3DFX\0"
- "\0"
- /* _mesa_function_pool[9264]: GetTexGendv (offset 278) */
- "iip\0"
- "glGetTexGendv\0"
- "\0"
- /* _mesa_function_pool[9283]: GetVertexAttribfvNV (will be remapped) */
- "iip\0"
- "glGetVertexAttribfvNV\0"
- "\0"
- /* _mesa_function_pool[9310]: BeginTransformFeedbackEXT (will be remapped) */
- "i\0"
- "glBeginTransformFeedbackEXT\0"
- "glBeginTransformFeedback\0"
- "\0"
- /* _mesa_function_pool[9366]: LoadProgramNV (will be remapped) */
- "iiip\0"
- "glLoadProgramNV\0"
- "\0"
- /* _mesa_function_pool[9388]: WaitSync (will be remapped) */
- "iii\0"
- "glWaitSync\0"
- "\0"
- /* _mesa_function_pool[9404]: EndList (offset 1) */
- "\0"
- "glEndList\0"
- "\0"
- /* _mesa_function_pool[9416]: VertexAttrib4fvNV (will be remapped) */
- "ip\0"
- "glVertexAttrib4fvNV\0"
- "\0"
- /* _mesa_function_pool[9440]: GetAttachedObjectsARB (will be remapped) */
- "iipp\0"
- "glGetAttachedObjectsARB\0"
- "\0"
- /* _mesa_function_pool[9470]: Uniform3fvARB (will be remapped) */
- "iip\0"
- "glUniform3fv\0"
- "glUniform3fvARB\0"
- "\0"
- /* _mesa_function_pool[9504]: EvalCoord1fv (offset 231) */
- "p\0"
- "glEvalCoord1fv\0"
- "\0"
- /* _mesa_function_pool[9522]: DrawRangeElements (offset 338) */
- "iiiiip\0"
- "glDrawRangeElements\0"
- "glDrawRangeElementsEXT\0"
- "\0"
- /* _mesa_function_pool[9573]: EvalMesh2 (offset 238) */
- "iiiii\0"
- "glEvalMesh2\0"
- "\0"
- /* _mesa_function_pool[9592]: Vertex4fv (offset 145) */
- "p\0"
- "glVertex4fv\0"
- "\0"
- /* _mesa_function_pool[9607]: GenTransformFeedbacks (will be remapped) */
- "ip\0"
- "glGenTransformFeedbacks\0"
- "\0"
- /* _mesa_function_pool[9635]: SpriteParameterfvSGIX (dynamic) */
- "ip\0"
- "glSpriteParameterfvSGIX\0"
- "\0"
- /* _mesa_function_pool[9663]: CheckFramebufferStatusEXT (will be remapped) */
- "i\0"
- "glCheckFramebufferStatus\0"
- "glCheckFramebufferStatusEXT\0"
- "\0"
- /* _mesa_function_pool[9719]: GlobalAlphaFactoruiSUN (dynamic) */
- "i\0"
- "glGlobalAlphaFactoruiSUN\0"
- "\0"
- /* _mesa_function_pool[9747]: GetHandleARB (will be remapped) */
- "i\0"
- "glGetHandleARB\0"
- "\0"
- /* _mesa_function_pool[9765]: GetVertexAttribivARB (will be remapped) */
- "iip\0"
- "glGetVertexAttribiv\0"
- "glGetVertexAttribivARB\0"
- "\0"
- /* _mesa_function_pool[9813]: GetCombinerInputParameterfvNV (will be remapped) */
- "iiiip\0"
- "glGetCombinerInputParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[9852]: GetTexParameterIivEXT (will be remapped) */
- "iip\0"
- "glGetTexParameterIivEXT\0"
- "glGetTexParameterIiv\0"
- "\0"
- /* _mesa_function_pool[9902]: CreateProgram (will be remapped) */
- "\0"
- "glCreateProgram\0"
- "\0"
- /* _mesa_function_pool[9920]: LoadTransposeMatrixdARB (will be remapped) */
- "p\0"
- "glLoadTransposeMatrixd\0"
- "glLoadTransposeMatrixdARB\0"
- "\0"
- /* _mesa_function_pool[9972]: GetMinmax (offset 364) */
- "iiiip\0"
- "glGetMinmax\0"
- "glGetMinmaxEXT\0"
- "\0"
- /* _mesa_function_pool[10006]: StencilFuncSeparate (will be remapped) */
- "iiii\0"
- "glStencilFuncSeparate\0"
- "\0"
- /* _mesa_function_pool[10034]: SecondaryColor3sEXT (will be remapped) */
- "iii\0"
- "glSecondaryColor3s\0"
- "glSecondaryColor3sEXT\0"
- "\0"
- /* _mesa_function_pool[10080]: Color3fVertex3fvSUN (dynamic) */
- "pp\0"
- "glColor3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[10106]: GetInteger64i_v (will be remapped) */
- "iip\0"
- "glGetInteger64i_v\0"
- "\0"
- /* _mesa_function_pool[10129]: Normal3fv (offset 57) */
- "p\0"
- "glNormal3fv\0"
- "\0"
- /* _mesa_function_pool[10144]: GlobalAlphaFactorbSUN (dynamic) */
- "i\0"
- "glGlobalAlphaFactorbSUN\0"
- "\0"
- /* _mesa_function_pool[10171]: Color3us (offset 23) */
- "iii\0"
- "glColor3us\0"
- "\0"
- /* _mesa_function_pool[10187]: ImageTransformParameterfvHP (dynamic) */
- "iip\0"
- "glImageTransformParameterfvHP\0"
- "\0"
- /* _mesa_function_pool[10222]: VertexAttrib4ivARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4iv\0"
- "glVertexAttrib4ivARB\0"
- "\0"
- /* _mesa_function_pool[10265]: End (offset 43) */
- "\0"
- "glEnd\0"
- "\0"
- /* _mesa_function_pool[10273]: VertexAttrib3fNV (will be remapped) */
- "ifff\0"
- "glVertexAttrib3fNV\0"
- "\0"
- /* _mesa_function_pool[10298]: VertexAttribs2dvNV (will be remapped) */
- "iip\0"
- "glVertexAttribs2dvNV\0"
- "\0"
- /* _mesa_function_pool[10324]: GetQueryObjectui64vEXT (will be remapped) */
- "iip\0"
- "glGetQueryObjectui64vEXT\0"
- "\0"
- /* _mesa_function_pool[10354]: MultiTexCoord3fvARB (offset 395) */
- "ip\0"
- "glMultiTexCoord3fv\0"
- "glMultiTexCoord3fvARB\0"
- "\0"
- /* _mesa_function_pool[10399]: SecondaryColor3dEXT (will be remapped) */
- "ddd\0"
- "glSecondaryColor3d\0"
- "glSecondaryColor3dEXT\0"
- "\0"
- /* _mesa_function_pool[10445]: Color3ub (offset 19) */
- "iii\0"
- "glColor3ub\0"
- "\0"
- /* _mesa_function_pool[10461]: GetProgramParameterfvNV (will be remapped) */
- "iiip\0"
- "glGetProgramParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[10493]: TangentPointerEXT (dynamic) */
- "iip\0"
- "glTangentPointerEXT\0"
- "\0"
- /* _mesa_function_pool[10518]: Color4fNormal3fVertex3fvSUN (dynamic) */
- "ppp\0"
- "glColor4fNormal3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[10553]: GetInstrumentsSGIX (dynamic) */
- "\0"
- "glGetInstrumentsSGIX\0"
- "\0"
- /* _mesa_function_pool[10576]: GetUniformuivEXT (will be remapped) */
- "iip\0"
- "glGetUniformuivEXT\0"
- "glGetUniformuiv\0"
- "\0"
- /* _mesa_function_pool[10616]: Color3ui (offset 21) */
- "iii\0"
- "glColor3ui\0"
- "\0"
- /* _mesa_function_pool[10632]: EvalMapsNV (dynamic) */
- "ii\0"
- "glEvalMapsNV\0"
- "\0"
- /* _mesa_function_pool[10649]: TexSubImage2D (offset 333) */
- "iiiiiiiip\0"
- "glTexSubImage2D\0"
- "glTexSubImage2DEXT\0"
- "\0"
- /* _mesa_function_pool[10695]: FragmentLightivSGIX (dynamic) */
- "iip\0"
- "glFragmentLightivSGIX\0"
- "\0"
- /* _mesa_function_pool[10722]: GetTexParameterPointervAPPLE (will be remapped) */
- "iip\0"
- "glGetTexParameterPointervAPPLE\0"
- "\0"
- /* _mesa_function_pool[10758]: TexGenfv (offset 191) */
- "iip\0"
- "glTexGenfv\0"
- "\0"
- /* _mesa_function_pool[10774]: GetTransformFeedbackVaryingEXT (will be remapped) */
- "iiipppp\0"
- "glGetTransformFeedbackVaryingEXT\0"
- "glGetTransformFeedbackVarying\0"
- "\0"
- /* _mesa_function_pool[10846]: VertexAttrib4bvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4bv\0"
- "glVertexAttrib4bvARB\0"
- "\0"
- /* _mesa_function_pool[10889]: AlphaFragmentOp2ATI (will be remapped) */
- "iiiiiiiii\0"
- "glAlphaFragmentOp2ATI\0"
- "\0"
- /* _mesa_function_pool[10922]: GetIntegerIndexedvEXT (will be remapped) */
- "iip\0"
- "glGetIntegerIndexedvEXT\0"
- "glGetIntegeri_v\0"
- "\0"
- /* _mesa_function_pool[10967]: MultiTexCoord4sARB (offset 406) */
- "iiiii\0"
- "glMultiTexCoord4s\0"
- "glMultiTexCoord4sARB\0"
- "\0"
- /* _mesa_function_pool[11013]: GetFragmentMaterialivSGIX (dynamic) */
- "iip\0"
- "glGetFragmentMaterialivSGIX\0"
- "\0"
- /* _mesa_function_pool[11046]: WindowPos4dMESA (will be remapped) */
- "dddd\0"
- "glWindowPos4dMESA\0"
- "\0"
- /* _mesa_function_pool[11070]: WeightPointerARB (dynamic) */
- "iiip\0"
- "glWeightPointerARB\0"
- "\0"
- /* _mesa_function_pool[11095]: WindowPos2dMESA (will be remapped) */
- "dd\0"
- "glWindowPos2d\0"
- "glWindowPos2dARB\0"
- "glWindowPos2dMESA\0"
- "\0"
- /* _mesa_function_pool[11148]: FramebufferTexture3DEXT (will be remapped) */
- "iiiiii\0"
- "glFramebufferTexture3D\0"
- "glFramebufferTexture3DEXT\0"
- "\0"
- /* _mesa_function_pool[11205]: BlendEquation (offset 337) */
- "i\0"
- "glBlendEquation\0"
- "glBlendEquationEXT\0"
- "\0"
- /* _mesa_function_pool[11243]: VertexAttrib3dNV (will be remapped) */
- "iddd\0"
- "glVertexAttrib3dNV\0"
- "\0"
- /* _mesa_function_pool[11268]: VertexAttrib3dARB (will be remapped) */
- "iddd\0"
- "glVertexAttrib3d\0"
- "glVertexAttrib3dARB\0"
- "\0"
- /* _mesa_function_pool[11311]: VertexAttribI4usvEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI4usvEXT\0"
- "glVertexAttribI4usv\0"
- "\0"
- /* _mesa_function_pool[11358]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
- "ppppp\0"
- "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[11422]: VertexAttrib4fARB (will be remapped) */
- "iffff\0"
- "glVertexAttrib4f\0"
- "glVertexAttrib4fARB\0"
- "\0"
- /* _mesa_function_pool[11466]: GetError (offset 261) */
- "\0"
- "glGetError\0"
- "\0"
- /* _mesa_function_pool[11479]: IndexFuncEXT (dynamic) */
- "if\0"
- "glIndexFuncEXT\0"
- "\0"
- /* _mesa_function_pool[11498]: TexCoord3dv (offset 111) */
- "p\0"
- "glTexCoord3dv\0"
- "\0"
- /* _mesa_function_pool[11515]: Indexdv (offset 45) */
- "p\0"
- "glIndexdv\0"
- "\0"
- /* _mesa_function_pool[11528]: FramebufferTexture2DEXT (will be remapped) */
- "iiiii\0"
- "glFramebufferTexture2D\0"
- "glFramebufferTexture2DEXT\0"
- "\0"
- /* _mesa_function_pool[11584]: Normal3s (offset 60) */
- "iii\0"
- "glNormal3s\0"
- "\0"
- /* _mesa_function_pool[11600]: GetObjectParameterivAPPLE (will be remapped) */
- "iiip\0"
- "glGetObjectParameterivAPPLE\0"
- "\0"
- /* _mesa_function_pool[11634]: PushName (offset 201) */
- "i\0"
- "glPushName\0"
- "\0"
- /* _mesa_function_pool[11648]: MultiTexCoord2dvARB (offset 385) */
- "ip\0"
- "glMultiTexCoord2dv\0"
- "glMultiTexCoord2dvARB\0"
- "\0"
- /* _mesa_function_pool[11693]: CullParameterfvEXT (dynamic) */
- "ip\0"
- "glCullParameterfvEXT\0"
- "\0"
- /* _mesa_function_pool[11718]: Normal3i (offset 58) */
- "iii\0"
- "glNormal3i\0"
- "\0"
- /* _mesa_function_pool[11734]: ProgramNamedParameter4fvNV (will be remapped) */
- "iipp\0"
- "glProgramNamedParameter4fvNV\0"
- "\0"
- /* _mesa_function_pool[11769]: SecondaryColorPointerEXT (will be remapped) */
- "iiip\0"
- "glSecondaryColorPointer\0"
- "glSecondaryColorPointerEXT\0"
- "\0"
- /* _mesa_function_pool[11826]: VertexAttrib4fvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4fv\0"
- "glVertexAttrib4fvARB\0"
- "\0"
- /* _mesa_function_pool[11869]: ColorPointerListIBM (dynamic) */
- "iiipi\0"
- "glColorPointerListIBM\0"
- "\0"
- /* _mesa_function_pool[11898]: GetActiveUniformARB (will be remapped) */
- "iiipppp\0"
- "glGetActiveUniform\0"
- "glGetActiveUniformARB\0"
- "\0"
- /* _mesa_function_pool[11948]: ImageTransformParameteriHP (dynamic) */
- "iii\0"
- "glImageTransformParameteriHP\0"
- "\0"
- /* _mesa_function_pool[11982]: Normal3b (offset 52) */
- "iii\0"
- "glNormal3b\0"
- "\0"
- /* _mesa_function_pool[11998]: Normal3d (offset 54) */
- "ddd\0"
- "glNormal3d\0"
- "\0"
- /* _mesa_function_pool[12014]: Uniform1uiEXT (will be remapped) */
- "ii\0"
- "glUniform1uiEXT\0"
- "glUniform1ui\0"
- "\0"
- /* _mesa_function_pool[12047]: Normal3f (offset 56) */
- "fff\0"
- "glNormal3f\0"
- "\0"
- /* _mesa_function_pool[12063]: MultiTexCoord1svARB (offset 383) */
- "ip\0"
- "glMultiTexCoord1sv\0"
- "glMultiTexCoord1svARB\0"
- "\0"
- /* _mesa_function_pool[12108]: Indexi (offset 48) */
- "i\0"
- "glIndexi\0"
- "\0"
- /* _mesa_function_pool[12120]: EGLImageTargetTexture2DOES (will be remapped) */
- "ip\0"
- "glEGLImageTargetTexture2DOES\0"
- "\0"
- /* _mesa_function_pool[12153]: EndQueryARB (will be remapped) */
- "i\0"
- "glEndQuery\0"
- "glEndQueryARB\0"
- "\0"
- /* _mesa_function_pool[12181]: DeleteFencesNV (will be remapped) */
- "ip\0"
- "glDeleteFencesNV\0"
- "\0"
- /* _mesa_function_pool[12202]: BindBufferRangeEXT (will be remapped) */
- "iiiii\0"
- "glBindBufferRangeEXT\0"
- "glBindBufferRange\0"
- "\0"
- /* _mesa_function_pool[12248]: DepthMask (offset 211) */
- "i\0"
- "glDepthMask\0"
- "\0"
- /* _mesa_function_pool[12263]: IsShader (will be remapped) */
- "i\0"
- "glIsShader\0"
- "\0"
- /* _mesa_function_pool[12277]: Indexf (offset 46) */
- "f\0"
- "glIndexf\0"
- "\0"
- /* _mesa_function_pool[12289]: GetImageTransformParameterivHP (dynamic) */
- "iip\0"
- "glGetImageTransformParameterivHP\0"
- "\0"
- /* _mesa_function_pool[12327]: Indexd (offset 44) */
- "d\0"
- "glIndexd\0"
- "\0"
- /* _mesa_function_pool[12339]: GetMaterialiv (offset 270) */
- "iip\0"
- "glGetMaterialiv\0"
- "\0"
- /* _mesa_function_pool[12360]: StencilOp (offset 244) */
- "iii\0"
- "glStencilOp\0"
- "\0"
- /* _mesa_function_pool[12377]: WindowPos4ivMESA (will be remapped) */
- "p\0"
- "glWindowPos4ivMESA\0"
- "\0"
- /* _mesa_function_pool[12399]: FramebufferTextureLayer (dynamic) */
- "iiiii\0"
- "glFramebufferTextureLayerARB\0"
- "\0"
- /* _mesa_function_pool[12435]: MultiTexCoord3svARB (offset 399) */
- "ip\0"
- "glMultiTexCoord3sv\0"
- "glMultiTexCoord3svARB\0"
- "\0"
- /* _mesa_function_pool[12480]: TexEnvfv (offset 185) */
- "iip\0"
- "glTexEnvfv\0"
- "\0"
- /* _mesa_function_pool[12496]: MultiTexCoord4iARB (offset 404) */
- "iiiii\0"
- "glMultiTexCoord4i\0"
- "glMultiTexCoord4iARB\0"
- "\0"
- /* _mesa_function_pool[12542]: Indexs (offset 50) */
- "i\0"
- "glIndexs\0"
- "\0"
- /* _mesa_function_pool[12554]: Binormal3ivEXT (dynamic) */
- "p\0"
- "glBinormal3ivEXT\0"
- "\0"
- /* _mesa_function_pool[12574]: ResizeBuffersMESA (will be remapped) */
- "\0"
- "glResizeBuffersMESA\0"
- "\0"
- /* _mesa_function_pool[12596]: GetUniformivARB (will be remapped) */
- "iip\0"
- "glGetUniformiv\0"
- "glGetUniformivARB\0"
- "\0"
- /* _mesa_function_pool[12634]: PixelTexGenParameteriSGIS (will be remapped) */
- "ii\0"
- "glPixelTexGenParameteriSGIS\0"
- "\0"
- /* _mesa_function_pool[12666]: VertexPointervINTEL (dynamic) */
- "iip\0"
- "glVertexPointervINTEL\0"
- "\0"
- /* _mesa_function_pool[12693]: Vertex2i (offset 130) */
- "ii\0"
- "glVertex2i\0"
- "\0"
- /* _mesa_function_pool[12708]: LoadMatrixf (offset 291) */
- "p\0"
- "glLoadMatrixf\0"
- "\0"
- /* _mesa_function_pool[12725]: VertexAttribI1uivEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI1uivEXT\0"
- "glVertexAttribI1uiv\0"
- "\0"
- /* _mesa_function_pool[12772]: Vertex2f (offset 128) */
- "ff\0"
- "glVertex2f\0"
- "\0"
- /* _mesa_function_pool[12787]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */
- "pppp\0"
- "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[12840]: Color4bv (offset 26) */
- "p\0"
- "glColor4bv\0"
- "\0"
- /* _mesa_function_pool[12854]: VertexPointer (offset 321) */
- "iiip\0"
- "glVertexPointer\0"
- "\0"
- /* _mesa_function_pool[12876]: SecondaryColor3uiEXT (will be remapped) */
- "iii\0"
- "glSecondaryColor3ui\0"
- "glSecondaryColor3uiEXT\0"
- "\0"
- /* _mesa_function_pool[12924]: StartInstrumentsSGIX (dynamic) */
- "\0"
- "glStartInstrumentsSGIX\0"
- "\0"
- /* _mesa_function_pool[12949]: SecondaryColor3usvEXT (will be remapped) */
- "p\0"
- "glSecondaryColor3usv\0"
- "glSecondaryColor3usvEXT\0"
- "\0"
- /* _mesa_function_pool[12997]: VertexAttrib2fvNV (will be remapped) */
- "ip\0"
- "glVertexAttrib2fvNV\0"
- "\0"
- /* _mesa_function_pool[13021]: ProgramLocalParameter4dvARB (will be remapped) */
- "iip\0"
- "glProgramLocalParameter4dvARB\0"
- "\0"
- /* _mesa_function_pool[13056]: DeleteLists (offset 4) */
- "ii\0"
- "glDeleteLists\0"
- "\0"
- /* _mesa_function_pool[13074]: LogicOp (offset 242) */
- "i\0"
- "glLogicOp\0"
- "\0"
- /* _mesa_function_pool[13087]: MatrixIndexuivARB (dynamic) */
- "ip\0"
- "glMatrixIndexuivARB\0"
- "\0"
- /* _mesa_function_pool[13111]: Vertex2s (offset 132) */
- "ii\0"
- "glVertex2s\0"
- "\0"
- /* _mesa_function_pool[13126]: RenderbufferStorageMultisample (will be remapped) */
- "iiiii\0"
- "glRenderbufferStorageMultisample\0"
- "glRenderbufferStorageMultisampleEXT\0"
- "\0"
- /* _mesa_function_pool[13202]: TexCoord4fv (offset 121) */
- "p\0"
- "glTexCoord4fv\0"
- "\0"
- /* _mesa_function_pool[13219]: Tangent3sEXT (dynamic) */
- "iii\0"
- "glTangent3sEXT\0"
- "\0"
- /* _mesa_function_pool[13239]: GlobalAlphaFactorfSUN (dynamic) */
- "f\0"
- "glGlobalAlphaFactorfSUN\0"
- "\0"
- /* _mesa_function_pool[13266]: MultiTexCoord3iARB (offset 396) */
- "iiii\0"
- "glMultiTexCoord3i\0"
- "glMultiTexCoord3iARB\0"
- "\0"
- /* _mesa_function_pool[13311]: IsProgram (will be remapped) */
- "i\0"
- "glIsProgram\0"
- "\0"
- /* _mesa_function_pool[13326]: TexCoordPointerListIBM (dynamic) */
- "iiipi\0"
- "glTexCoordPointerListIBM\0"
- "\0"
- /* _mesa_function_pool[13358]: VertexAttribI4svEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI4svEXT\0"
- "glVertexAttribI4sv\0"
- "\0"
- /* _mesa_function_pool[13403]: GlobalAlphaFactorusSUN (dynamic) */
- "i\0"
- "glGlobalAlphaFactorusSUN\0"
- "\0"
- /* _mesa_function_pool[13431]: VertexAttrib2dvNV (will be remapped) */
- "ip\0"
- "glVertexAttrib2dvNV\0"
- "\0"
- /* _mesa_function_pool[13455]: FramebufferRenderbufferEXT (will be remapped) */
- "iiii\0"
- "glFramebufferRenderbuffer\0"
- "glFramebufferRenderbufferEXT\0"
- "\0"
- /* _mesa_function_pool[13516]: ClearBufferuiv (will be remapped) */
- "iip\0"
- "glClearBufferuiv\0"
- "\0"
- /* _mesa_function_pool[13538]: VertexAttrib1dvNV (will be remapped) */
- "ip\0"
- "glVertexAttrib1dvNV\0"
- "\0"
- /* _mesa_function_pool[13562]: GenTextures (offset 328) */
- "ip\0"
- "glGenTextures\0"
- "glGenTexturesEXT\0"
- "\0"
- /* _mesa_function_pool[13597]: FramebufferTextureARB (will be remapped) */
- "iiii\0"
- "glFramebufferTextureARB\0"
- "\0"
- /* _mesa_function_pool[13627]: SetFenceNV (will be remapped) */
- "ii\0"
- "glSetFenceNV\0"
- "\0"
- /* _mesa_function_pool[13644]: FramebufferTexture1DEXT (will be remapped) */
- "iiiii\0"
- "glFramebufferTexture1D\0"
- "glFramebufferTexture1DEXT\0"
- "\0"
- /* _mesa_function_pool[13700]: GetCombinerOutputParameterivNV (will be remapped) */
- "iiip\0"
- "glGetCombinerOutputParameterivNV\0"
- "\0"
- /* _mesa_function_pool[13739]: MultiModeDrawArraysIBM (will be remapped) */
- "pppii\0"
- "glMultiModeDrawArraysIBM\0"
- "\0"
- /* _mesa_function_pool[13771]: PixelTexGenParameterivSGIS (will be remapped) */
- "ip\0"
- "glPixelTexGenParameterivSGIS\0"
- "\0"
- /* _mesa_function_pool[13804]: TextureNormalEXT (dynamic) */
- "i\0"
- "glTextureNormalEXT\0"
- "\0"
- /* _mesa_function_pool[13826]: IndexPointerListIBM (dynamic) */
- "iipi\0"
- "glIndexPointerListIBM\0"
- "\0"
- /* _mesa_function_pool[13854]: WeightfvARB (dynamic) */
- "ip\0"
- "glWeightfvARB\0"
- "\0"
- /* _mesa_function_pool[13872]: GetCombinerOutputParameterfvNV (will be remapped) */
- "iiip\0"
- "glGetCombinerOutputParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[13911]: RasterPos2sv (offset 69) */
- "p\0"
- "glRasterPos2sv\0"
- "\0"
- /* _mesa_function_pool[13929]: Color4ubv (offset 36) */
- "p\0"
- "glColor4ubv\0"
- "\0"
- /* _mesa_function_pool[13944]: DrawBuffer (offset 202) */
- "i\0"
- "glDrawBuffer\0"
- "\0"
- /* _mesa_function_pool[13960]: TexCoord2fv (offset 105) */
- "p\0"
- "glTexCoord2fv\0"
- "\0"
- /* _mesa_function_pool[13977]: WindowPos4fMESA (will be remapped) */
- "ffff\0"
- "glWindowPos4fMESA\0"
- "\0"
- /* _mesa_function_pool[14001]: TexCoord1sv (offset 101) */
- "p\0"
- "glTexCoord1sv\0"
- "\0"
- /* _mesa_function_pool[14018]: WindowPos3dvMESA (will be remapped) */
- "p\0"
- "glWindowPos3dv\0"
- "glWindowPos3dvARB\0"
- "glWindowPos3dvMESA\0"
- "\0"
- /* _mesa_function_pool[14073]: DepthFunc (offset 245) */
- "i\0"
- "glDepthFunc\0"
- "\0"
- /* _mesa_function_pool[14088]: PixelMapusv (offset 253) */
- "iip\0"
- "glPixelMapusv\0"
- "\0"
- /* _mesa_function_pool[14107]: GetQueryObjecti64vEXT (will be remapped) */
- "iip\0"
- "glGetQueryObjecti64vEXT\0"
- "\0"
- /* _mesa_function_pool[14136]: MultiTexCoord1dARB (offset 376) */
- "id\0"
- "glMultiTexCoord1d\0"
- "glMultiTexCoord1dARB\0"
- "\0"
- /* _mesa_function_pool[14179]: PointParameterivNV (will be remapped) */
- "ip\0"
- "glPointParameteriv\0"
- "glPointParameterivNV\0"
- "\0"
- /* _mesa_function_pool[14223]: BlendFunc (offset 241) */
- "ii\0"
- "glBlendFunc\0"
- "\0"
- /* _mesa_function_pool[14239]: EndTransformFeedbackEXT (will be remapped) */
- "\0"
- "glEndTransformFeedbackEXT\0"
- "glEndTransformFeedback\0"
- "\0"
- /* _mesa_function_pool[14290]: Uniform2fvARB (will be remapped) */
- "iip\0"
- "glUniform2fv\0"
- "glUniform2fvARB\0"
- "\0"
- /* _mesa_function_pool[14324]: BufferParameteriAPPLE (will be remapped) */
- "iii\0"
- "glBufferParameteriAPPLE\0"
- "\0"
- /* _mesa_function_pool[14353]: MultiTexCoord3dvARB (offset 393) */
- "ip\0"
- "glMultiTexCoord3dv\0"
- "glMultiTexCoord3dvARB\0"
- "\0"
- /* _mesa_function_pool[14398]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */
- "pppp\0"
- "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[14454]: DeleteObjectARB (will be remapped) */
- "i\0"
- "glDeleteObjectARB\0"
- "\0"
- /* _mesa_function_pool[14475]: MatrixIndexPointerARB (dynamic) */
- "iiip\0"
- "glMatrixIndexPointerARB\0"
- "\0"
- /* _mesa_function_pool[14505]: ProgramNamedParameter4dvNV (will be remapped) */
- "iipp\0"
- "glProgramNamedParameter4dvNV\0"
- "\0"
- /* _mesa_function_pool[14540]: Tangent3fvEXT (dynamic) */
- "p\0"
- "glTangent3fvEXT\0"
- "\0"
- /* _mesa_function_pool[14559]: Flush (offset 217) */
- "\0"
- "glFlush\0"
- "\0"
- /* _mesa_function_pool[14569]: Color4uiv (offset 38) */
- "p\0"
- "glColor4uiv\0"
- "\0"
- /* _mesa_function_pool[14584]: VertexAttribI4iEXT (will be remapped) */
- "iiiii\0"
- "glVertexAttribI4iEXT\0"
- "glVertexAttribI4i\0"
- "\0"
- /* _mesa_function_pool[14630]: GenVertexArrays (will be remapped) */
- "ip\0"
- "glGenVertexArrays\0"
- "\0"
- /* _mesa_function_pool[14652]: Uniform3uivEXT (will be remapped) */
- "iip\0"
- "glUniform3uivEXT\0"
- "glUniform3uiv\0"
- "\0"
- /* _mesa_function_pool[14688]: RasterPos3sv (offset 77) */
- "p\0"
- "glRasterPos3sv\0"
- "\0"
- /* _mesa_function_pool[14706]: BindFramebufferEXT (will be remapped) */
- "ii\0"
- "glBindFramebuffer\0"
- "glBindFramebufferEXT\0"
- "\0"
- /* _mesa_function_pool[14749]: ReferencePlaneSGIX (dynamic) */
- "p\0"
- "glReferencePlaneSGIX\0"
- "\0"
- /* _mesa_function_pool[14773]: PushAttrib (offset 219) */
- "i\0"
- "glPushAttrib\0"
- "\0"
- /* _mesa_function_pool[14789]: RasterPos2i (offset 66) */
- "ii\0"
- "glRasterPos2i\0"
- "\0"
- /* _mesa_function_pool[14807]: ValidateProgramARB (will be remapped) */
- "i\0"
- "glValidateProgram\0"
- "glValidateProgramARB\0"
- "\0"
- /* _mesa_function_pool[14849]: TexParameteriv (offset 181) */
- "iip\0"
- "glTexParameteriv\0"
- "\0"
- /* _mesa_function_pool[14871]: UnlockArraysEXT (will be remapped) */
- "\0"
- "glUnlockArraysEXT\0"
- "\0"
- /* _mesa_function_pool[14891]: TexCoord2fColor3fVertex3fSUN (dynamic) */
- "ffffffff\0"
- "glTexCoord2fColor3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[14932]: WindowPos3fvMESA (will be remapped) */
- "p\0"
- "glWindowPos3fv\0"
- "glWindowPos3fvARB\0"
- "glWindowPos3fvMESA\0"
- "\0"
- /* _mesa_function_pool[14987]: RasterPos2f (offset 64) */
- "ff\0"
- "glRasterPos2f\0"
- "\0"
- /* _mesa_function_pool[15005]: VertexAttrib1svNV (will be remapped) */
- "ip\0"
- "glVertexAttrib1svNV\0"
- "\0"
- /* _mesa_function_pool[15029]: RasterPos2d (offset 62) */
- "dd\0"
- "glRasterPos2d\0"
- "\0"
- /* _mesa_function_pool[15047]: RasterPos3fv (offset 73) */
- "p\0"
- "glRasterPos3fv\0"
- "\0"
- /* _mesa_function_pool[15065]: CopyTexSubImage3D (offset 373) */
- "iiiiiiiii\0"
- "glCopyTexSubImage3D\0"
- "glCopyTexSubImage3DEXT\0"
- "\0"
- /* _mesa_function_pool[15119]: VertexAttrib2dARB (will be remapped) */
- "idd\0"
- "glVertexAttrib2d\0"
- "glVertexAttrib2dARB\0"
- "\0"
- /* _mesa_function_pool[15161]: Color4ub (offset 35) */
- "iiii\0"
- "glColor4ub\0"
- "\0"
- /* _mesa_function_pool[15178]: GetInteger64v (will be remapped) */
- "ip\0"
- "glGetInteger64v\0"
- "\0"
- /* _mesa_function_pool[15198]: TextureColorMaskSGIS (dynamic) */
- "iiii\0"
- "glTextureColorMaskSGIS\0"
- "\0"
- /* _mesa_function_pool[15227]: RasterPos2s (offset 68) */
- "ii\0"
- "glRasterPos2s\0"
- "\0"
- /* _mesa_function_pool[15245]: GetColorTable (offset 343) */
- "iiip\0"
- "glGetColorTable\0"
- "glGetColorTableSGI\0"
- "glGetColorTableEXT\0"
- "\0"
- /* _mesa_function_pool[15305]: SelectBuffer (offset 195) */
- "ip\0"
- "glSelectBuffer\0"
- "\0"
- /* _mesa_function_pool[15324]: Indexiv (offset 49) */
- "p\0"
- "glIndexiv\0"
- "\0"
- /* _mesa_function_pool[15337]: TexCoord3i (offset 114) */
- "iii\0"
- "glTexCoord3i\0"
- "\0"
- /* _mesa_function_pool[15355]: CopyColorTable (offset 342) */
- "iiiii\0"
- "glCopyColorTable\0"
- "glCopyColorTableSGI\0"
- "\0"
- /* _mesa_function_pool[15399]: GetHistogramParameterfv (offset 362) */
- "iip\0"
- "glGetHistogramParameterfv\0"
- "glGetHistogramParameterfvEXT\0"
- "\0"
- /* _mesa_function_pool[15459]: Frustum (offset 289) */
- "dddddd\0"
- "glFrustum\0"
- "\0"
- /* _mesa_function_pool[15477]: GetString (offset 275) */
- "i\0"
- "glGetString\0"
- "\0"
- /* _mesa_function_pool[15492]: ColorPointervINTEL (dynamic) */
- "iip\0"
- "glColorPointervINTEL\0"
- "\0"
- /* _mesa_function_pool[15518]: TexEnvf (offset 184) */
- "iif\0"
- "glTexEnvf\0"
- "\0"
- /* _mesa_function_pool[15533]: TexCoord3d (offset 110) */
- "ddd\0"
- "glTexCoord3d\0"
- "\0"
- /* _mesa_function_pool[15551]: AlphaFragmentOp1ATI (will be remapped) */
- "iiiiii\0"
- "glAlphaFragmentOp1ATI\0"
- "\0"
- /* _mesa_function_pool[15581]: TexCoord3f (offset 112) */
- "fff\0"
- "glTexCoord3f\0"
- "\0"
- /* _mesa_function_pool[15599]: MultiTexCoord3ivARB (offset 397) */
- "ip\0"
- "glMultiTexCoord3iv\0"
- "glMultiTexCoord3ivARB\0"
- "\0"
- /* _mesa_function_pool[15644]: MultiTexCoord2sARB (offset 390) */
- "iii\0"
- "glMultiTexCoord2s\0"
- "glMultiTexCoord2sARB\0"
- "\0"
- /* _mesa_function_pool[15688]: VertexAttrib1dvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib1dv\0"
- "glVertexAttrib1dvARB\0"
- "\0"
- /* _mesa_function_pool[15731]: DeleteTextures (offset 327) */
- "ip\0"
- "glDeleteTextures\0"
- "glDeleteTexturesEXT\0"
- "\0"
- /* _mesa_function_pool[15772]: TexCoordPointerEXT (will be remapped) */
- "iiiip\0"
- "glTexCoordPointerEXT\0"
- "\0"
- /* _mesa_function_pool[15800]: TexSubImage4DSGIS (dynamic) */
- "iiiiiiiiiiiip\0"
- "glTexSubImage4DSGIS\0"
- "\0"
- /* _mesa_function_pool[15835]: TexCoord3s (offset 116) */
- "iii\0"
- "glTexCoord3s\0"
- "\0"
- /* _mesa_function_pool[15853]: GetTexLevelParameteriv (offset 285) */
- "iiip\0"
- "glGetTexLevelParameteriv\0"
- "\0"
- /* _mesa_function_pool[15884]: CombinerStageParameterfvNV (dynamic) */
- "iip\0"
- "glCombinerStageParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[15918]: StopInstrumentsSGIX (dynamic) */
- "i\0"
- "glStopInstrumentsSGIX\0"
- "\0"
- /* _mesa_function_pool[15943]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */
- "fffffffffffffff\0"
- "glTexCoord4fColor4fNormal3fVertex4fSUN\0"
- "\0"
- /* _mesa_function_pool[15999]: ClearAccum (offset 204) */
- "ffff\0"
- "glClearAccum\0"
- "\0"
- /* _mesa_function_pool[16018]: DeformSGIX (dynamic) */
- "i\0"
- "glDeformSGIX\0"
- "\0"
- /* _mesa_function_pool[16034]: GetVertexAttribfvARB (will be remapped) */
- "iip\0"
- "glGetVertexAttribfv\0"
- "glGetVertexAttribfvARB\0"
- "\0"
- /* _mesa_function_pool[16082]: SecondaryColor3ivEXT (will be remapped) */
- "p\0"
- "glSecondaryColor3iv\0"
- "glSecondaryColor3ivEXT\0"
- "\0"
- /* _mesa_function_pool[16128]: TexCoord4iv (offset 123) */
- "p\0"
- "glTexCoord4iv\0"
- "\0"
- /* _mesa_function_pool[16145]: VertexAttribI4uiEXT (will be remapped) */
- "iiiii\0"
- "glVertexAttribI4uiEXT\0"
- "glVertexAttribI4ui\0"
- "\0"
- /* _mesa_function_pool[16193]: GetFragmentMaterialfvSGIX (dynamic) */
- "iip\0"
- "glGetFragmentMaterialfvSGIX\0"
- "\0"
- /* _mesa_function_pool[16226]: UniformMatrix4x2fv (will be remapped) */
- "iiip\0"
- "glUniformMatrix4x2fv\0"
- "\0"
- /* _mesa_function_pool[16253]: GetDetailTexFuncSGIS (dynamic) */
- "ip\0"
- "glGetDetailTexFuncSGIS\0"
- "\0"
- /* _mesa_function_pool[16280]: GetCombinerStageParameterfvNV (dynamic) */
- "iip\0"
- "glGetCombinerStageParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[16317]: PolygonOffset (offset 319) */
- "ff\0"
- "glPolygonOffset\0"
- "\0"
- /* _mesa_function_pool[16337]: BindVertexArray (will be remapped) */
- "i\0"
- "glBindVertexArray\0"
- "\0"
- /* _mesa_function_pool[16358]: Color4ubVertex2fvSUN (dynamic) */
- "pp\0"
- "glColor4ubVertex2fvSUN\0"
- "\0"
- /* _mesa_function_pool[16385]: Rectd (offset 86) */
- "dddd\0"
- "glRectd\0"
- "\0"
- /* _mesa_function_pool[16399]: TexFilterFuncSGIS (dynamic) */
- "iiip\0"
- "glTexFilterFuncSGIS\0"
- "\0"
- /* _mesa_function_pool[16425]: SampleMaskSGIS (will be remapped) */
- "fi\0"
- "glSampleMaskSGIS\0"
- "glSampleMaskEXT\0"
- "\0"
- /* _mesa_function_pool[16462]: VertexAttribI4ubvEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI4ubvEXT\0"
- "glVertexAttribI4ubv\0"
- "\0"
- /* _mesa_function_pool[16509]: GetAttribLocationARB (will be remapped) */
- "ip\0"
- "glGetAttribLocation\0"
- "glGetAttribLocationARB\0"
- "\0"
- /* _mesa_function_pool[16556]: RasterPos3i (offset 74) */
- "iii\0"
- "glRasterPos3i\0"
- "\0"
- /* _mesa_function_pool[16575]: VertexAttrib4ubvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4ubv\0"
- "glVertexAttrib4ubvARB\0"
- "\0"
- /* _mesa_function_pool[16620]: DetailTexFuncSGIS (dynamic) */
- "iip\0"
- "glDetailTexFuncSGIS\0"
- "\0"
- /* _mesa_function_pool[16645]: Normal3fVertex3fSUN (dynamic) */
- "ffffff\0"
- "glNormal3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[16675]: CopyTexImage2D (offset 324) */
- "iiiiiiii\0"
- "glCopyTexImage2D\0"
- "glCopyTexImage2DEXT\0"
- "\0"
- /* _mesa_function_pool[16722]: GetBufferPointervARB (will be remapped) */
- "iip\0"
- "glGetBufferPointerv\0"
- "glGetBufferPointervARB\0"
- "\0"
- /* _mesa_function_pool[16770]: ProgramEnvParameter4fARB (will be remapped) */
- "iiffff\0"
- "glProgramEnvParameter4fARB\0"
- "glProgramParameter4fNV\0"
- "\0"
- /* _mesa_function_pool[16828]: Uniform3ivARB (will be remapped) */
- "iip\0"
- "glUniform3iv\0"
- "glUniform3ivARB\0"
- "\0"
- /* _mesa_function_pool[16862]: Lightfv (offset 160) */
- "iip\0"
- "glLightfv\0"
- "\0"
- /* _mesa_function_pool[16877]: PrimitiveRestartIndexNV (will be remapped) */
- "i\0"
- "glPrimitiveRestartIndexNV\0"
- "glPrimitiveRestartIndex\0"
- "\0"
- /* _mesa_function_pool[16930]: ClearDepth (offset 208) */
- "d\0"
- "glClearDepth\0"
- "\0"
- /* _mesa_function_pool[16946]: GetFenceivNV (will be remapped) */
- "iip\0"
- "glGetFenceivNV\0"
- "\0"
- /* _mesa_function_pool[16966]: WindowPos4dvMESA (will be remapped) */
- "p\0"
- "glWindowPos4dvMESA\0"
- "\0"
- /* _mesa_function_pool[16988]: ColorSubTable (offset 346) */
- "iiiiip\0"
- "glColorSubTable\0"
- "glColorSubTableEXT\0"
- "\0"
- /* _mesa_function_pool[17031]: Color4fv (offset 30) */
- "p\0"
- "glColor4fv\0"
- "\0"
- /* _mesa_function_pool[17045]: MultiTexCoord4ivARB (offset 405) */
- "ip\0"
- "glMultiTexCoord4iv\0"
- "glMultiTexCoord4ivARB\0"
- "\0"
- /* _mesa_function_pool[17090]: ProgramLocalParameters4fvEXT (will be remapped) */
- "iiip\0"
- "glProgramLocalParameters4fvEXT\0"
- "\0"
- /* _mesa_function_pool[17127]: ColorPointer (offset 308) */
- "iiip\0"
- "glColorPointer\0"
- "\0"
- /* _mesa_function_pool[17148]: Rects (offset 92) */
- "iiii\0"
- "glRects\0"
- "\0"
- /* _mesa_function_pool[17162]: GetMapAttribParameterfvNV (dynamic) */
- "iiip\0"
- "glGetMapAttribParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[17196]: CreateShaderProgramEXT (will be remapped) */
- "ip\0"
- "glCreateShaderProgramEXT\0"
- "\0"
- /* _mesa_function_pool[17225]: ActiveProgramEXT (will be remapped) */
- "i\0"
- "glActiveProgramEXT\0"
- "\0"
- /* _mesa_function_pool[17247]: Lightiv (offset 162) */
- "iip\0"
- "glLightiv\0"
- "\0"
- /* _mesa_function_pool[17262]: VertexAttrib4sARB (will be remapped) */
- "iiiii\0"
- "glVertexAttrib4s\0"
- "glVertexAttrib4sARB\0"
- "\0"
- /* _mesa_function_pool[17306]: GetQueryObjectuivARB (will be remapped) */
- "iip\0"
- "glGetQueryObjectuiv\0"
- "glGetQueryObjectuivARB\0"
- "\0"
- /* _mesa_function_pool[17354]: GetTexParameteriv (offset 283) */
- "iip\0"
- "glGetTexParameteriv\0"
- "\0"
- /* _mesa_function_pool[17379]: MapParameterivNV (dynamic) */
- "iip\0"
- "glMapParameterivNV\0"
- "\0"
- /* _mesa_function_pool[17403]: GenRenderbuffersEXT (will be remapped) */
- "ip\0"
- "glGenRenderbuffers\0"
- "glGenRenderbuffersEXT\0"
- "\0"
- /* _mesa_function_pool[17448]: ClearBufferfv (will be remapped) */
- "iip\0"
- "glClearBufferfv\0"
- "\0"
- /* _mesa_function_pool[17469]: VertexAttrib2dvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib2dv\0"
- "glVertexAttrib2dvARB\0"
- "\0"
- /* _mesa_function_pool[17512]: EdgeFlagPointerEXT (will be remapped) */
- "iip\0"
- "glEdgeFlagPointerEXT\0"
- "\0"
- /* _mesa_function_pool[17538]: VertexAttribs2svNV (will be remapped) */
- "iip\0"
- "glVertexAttribs2svNV\0"
- "\0"
- /* _mesa_function_pool[17564]: WeightbvARB (dynamic) */
- "ip\0"
- "glWeightbvARB\0"
- "\0"
- /* _mesa_function_pool[17582]: VertexAttrib2fvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib2fv\0"
- "glVertexAttrib2fvARB\0"
- "\0"
- /* _mesa_function_pool[17625]: GetBufferParameterivARB (will be remapped) */
- "iip\0"
- "glGetBufferParameteriv\0"
- "glGetBufferParameterivARB\0"
- "\0"
- /* _mesa_function_pool[17679]: Rectdv (offset 87) */
- "pp\0"
- "glRectdv\0"
- "\0"
- /* _mesa_function_pool[17692]: ListParameteriSGIX (dynamic) */
- "iii\0"
- "glListParameteriSGIX\0"
- "\0"
- /* _mesa_function_pool[17718]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */
- "iffffffffff\0"
- "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[17777]: InstrumentsBufferSGIX (dynamic) */
- "ip\0"
- "glInstrumentsBufferSGIX\0"
- "\0"
- /* _mesa_function_pool[17805]: VertexAttrib4NivARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4Niv\0"
- "glVertexAttrib4NivARB\0"
- "\0"
- /* _mesa_function_pool[17850]: DrawArraysInstancedARB (will be remapped) */
- "iiii\0"
- "glDrawArraysInstancedARB\0"
- "glDrawArraysInstancedEXT\0"
- "glDrawArraysInstanced\0"
- "\0"
- /* _mesa_function_pool[17928]: GetAttachedShaders (will be remapped) */
- "iipp\0"
- "glGetAttachedShaders\0"
- "\0"
- /* _mesa_function_pool[17955]: GenVertexArraysAPPLE (will be remapped) */
- "ip\0"
- "glGenVertexArraysAPPLE\0"
- "\0"
- /* _mesa_function_pool[17982]: ClearBufferfi (will be remapped) */
- "iifi\0"
- "glClearBufferfi\0"
- "\0"
- /* _mesa_function_pool[18004]: Materialiv (offset 172) */
- "iip\0"
- "glMaterialiv\0"
- "\0"
- /* _mesa_function_pool[18022]: PushClientAttrib (offset 335) */
- "i\0"
- "glPushClientAttrib\0"
- "\0"
- /* _mesa_function_pool[18044]: ProgramEnvParameters4fvEXT (will be remapped) */
- "iiip\0"
- "glProgramEnvParameters4fvEXT\0"
- "\0"
- /* _mesa_function_pool[18079]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
- "pppp\0"
- "glTexCoord2fColor4fNormal3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[18125]: WindowPos2iMESA (will be remapped) */
- "ii\0"
- "glWindowPos2i\0"
- "glWindowPos2iARB\0"
- "glWindowPos2iMESA\0"
- "\0"
- /* _mesa_function_pool[18178]: SecondaryColor3fvEXT (will be remapped) */
- "p\0"
- "glSecondaryColor3fv\0"
- "glSecondaryColor3fvEXT\0"
- "\0"
- /* _mesa_function_pool[18224]: PolygonMode (offset 174) */
- "ii\0"
- "glPolygonMode\0"
- "\0"
- /* _mesa_function_pool[18242]: CompressedTexSubImage1DARB (will be remapped) */
- "iiiiiip\0"
- "glCompressedTexSubImage1D\0"
- "glCompressedTexSubImage1DARB\0"
- "\0"
- /* _mesa_function_pool[18306]: VertexAttribI1iEXT (will be remapped) */
- "ii\0"
- "glVertexAttribI1iEXT\0"
- "glVertexAttribI1i\0"
- "\0"
- /* _mesa_function_pool[18349]: GetVertexAttribivNV (will be remapped) */
- "iip\0"
- "glGetVertexAttribivNV\0"
- "\0"
- /* _mesa_function_pool[18376]: GetProgramStringARB (will be remapped) */
- "iip\0"
- "glGetProgramStringARB\0"
- "\0"
- /* _mesa_function_pool[18403]: VertexAttribIPointerEXT (will be remapped) */
- "iiiip\0"
- "glVertexAttribIPointerEXT\0"
- "glVertexAttribIPointer\0"
- "\0"
- /* _mesa_function_pool[18459]: TexBumpParameterfvATI (will be remapped) */
- "ip\0"
- "glTexBumpParameterfvATI\0"
- "\0"
- /* _mesa_function_pool[18487]: CompileShaderARB (will be remapped) */
- "i\0"
- "glCompileShader\0"
- "glCompileShaderARB\0"
- "\0"
- /* _mesa_function_pool[18525]: DeleteShader (will be remapped) */
- "i\0"
- "glDeleteShader\0"
- "\0"
- /* _mesa_function_pool[18543]: DisableClientState (offset 309) */
- "i\0"
- "glDisableClientState\0"
- "\0"
- /* _mesa_function_pool[18567]: TexGeni (offset 192) */
- "iii\0"
- "glTexGeni\0"
- "\0"
- /* _mesa_function_pool[18582]: TexGenf (offset 190) */
- "iif\0"
- "glTexGenf\0"
- "\0"
- /* _mesa_function_pool[18597]: Uniform3fARB (will be remapped) */
- "ifff\0"
- "glUniform3f\0"
- "glUniform3fARB\0"
- "\0"
- /* _mesa_function_pool[18630]: TexGend (offset 188) */
- "iid\0"
- "glTexGend\0"
- "\0"
- /* _mesa_function_pool[18645]: ListParameterfvSGIX (dynamic) */
- "iip\0"
- "glListParameterfvSGIX\0"
- "\0"
- /* _mesa_function_pool[18672]: GetPolygonStipple (offset 274) */
- "p\0"
- "glGetPolygonStipple\0"
- "\0"
- /* _mesa_function_pool[18695]: Tangent3dvEXT (dynamic) */
- "p\0"
- "glTangent3dvEXT\0"
- "\0"
- /* _mesa_function_pool[18714]: BindBufferOffsetEXT (will be remapped) */
- "iiii\0"
- "glBindBufferOffsetEXT\0"
- "\0"
- /* _mesa_function_pool[18742]: WindowPos3sMESA (will be remapped) */
- "iii\0"
- "glWindowPos3s\0"
- "glWindowPos3sARB\0"
- "glWindowPos3sMESA\0"
- "\0"
- /* _mesa_function_pool[18796]: VertexAttrib2svNV (will be remapped) */
- "ip\0"
- "glVertexAttrib2svNV\0"
- "\0"
- /* _mesa_function_pool[18820]: DisableIndexedEXT (will be remapped) */
- "ii\0"
- "glDisableIndexedEXT\0"
- "glDisablei\0"
- "\0"
- /* _mesa_function_pool[18855]: BindBufferBaseEXT (will be remapped) */
- "iii\0"
- "glBindBufferBaseEXT\0"
- "glBindBufferBase\0"
- "\0"
- /* _mesa_function_pool[18897]: TexCoord2fVertex3fvSUN (dynamic) */
- "pp\0"
- "glTexCoord2fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[18926]: WindowPos4sMESA (will be remapped) */
- "iiii\0"
- "glWindowPos4sMESA\0"
- "\0"
- /* _mesa_function_pool[18950]: VertexAttrib4NuivARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4Nuiv\0"
- "glVertexAttrib4NuivARB\0"
- "\0"
- /* _mesa_function_pool[18997]: ClientActiveTextureARB (offset 375) */
- "i\0"
- "glClientActiveTexture\0"
- "glClientActiveTextureARB\0"
- "\0"
- /* _mesa_function_pool[19047]: PixelTexGenSGIX (will be remapped) */
- "i\0"
- "glPixelTexGenSGIX\0"
- "\0"
- /* _mesa_function_pool[19068]: ReplacementCodeusvSUN (dynamic) */
- "p\0"
- "glReplacementCodeusvSUN\0"
- "\0"
- /* _mesa_function_pool[19095]: Uniform4fARB (will be remapped) */
- "iffff\0"
- "glUniform4f\0"
- "glUniform4fARB\0"
- "\0"
- /* _mesa_function_pool[19129]: Color4sv (offset 34) */
- "p\0"
- "glColor4sv\0"
- "\0"
- /* _mesa_function_pool[19143]: FlushMappedBufferRange (will be remapped) */
- "iii\0"
- "glFlushMappedBufferRange\0"
- "\0"
- /* _mesa_function_pool[19173]: IsProgramNV (will be remapped) */
- "i\0"
- "glIsProgramARB\0"
- "glIsProgramNV\0"
- "\0"
- /* _mesa_function_pool[19205]: FlushMappedBufferRangeAPPLE (will be remapped) */
- "iii\0"
- "glFlushMappedBufferRangeAPPLE\0"
- "\0"
- /* _mesa_function_pool[19240]: PixelZoom (offset 246) */
- "ff\0"
- "glPixelZoom\0"
- "\0"
- /* _mesa_function_pool[19256]: ReplacementCodePointerSUN (dynamic) */
- "iip\0"
- "glReplacementCodePointerSUN\0"
- "\0"
- /* _mesa_function_pool[19289]: ProgramEnvParameter4dARB (will be remapped) */
- "iidddd\0"
- "glProgramEnvParameter4dARB\0"
- "glProgramParameter4dNV\0"
- "\0"
- /* _mesa_function_pool[19347]: ColorTableParameterfv (offset 340) */
- "iip\0"
- "glColorTableParameterfv\0"
- "glColorTableParameterfvSGI\0"
- "\0"
- /* _mesa_function_pool[19403]: FragmentLightModelfSGIX (dynamic) */
- "if\0"
- "glFragmentLightModelfSGIX\0"
- "\0"
- /* _mesa_function_pool[19433]: Binormal3bvEXT (dynamic) */
- "p\0"
- "glBinormal3bvEXT\0"
- "\0"
- /* _mesa_function_pool[19453]: PixelMapuiv (offset 252) */
- "iip\0"
- "glPixelMapuiv\0"
- "\0"
- /* _mesa_function_pool[19472]: Color3dv (offset 12) */
- "p\0"
- "glColor3dv\0"
- "\0"
- /* _mesa_function_pool[19486]: IsTexture (offset 330) */
- "i\0"
- "glIsTexture\0"
- "glIsTextureEXT\0"
- "\0"
- /* _mesa_function_pool[19516]: VertexWeightfvEXT (dynamic) */
- "p\0"
- "glVertexWeightfvEXT\0"
- "\0"
- /* _mesa_function_pool[19539]: VertexAttrib1dARB (will be remapped) */
- "id\0"
- "glVertexAttrib1d\0"
- "glVertexAttrib1dARB\0"
- "\0"
- /* _mesa_function_pool[19580]: ImageTransformParameterivHP (dynamic) */
- "iip\0"
- "glImageTransformParameterivHP\0"
- "\0"
- /* _mesa_function_pool[19615]: TexCoord4i (offset 122) */
- "iiii\0"
- "glTexCoord4i\0"
- "\0"
- /* _mesa_function_pool[19634]: DeleteQueriesARB (will be remapped) */
- "ip\0"
- "glDeleteQueries\0"
- "glDeleteQueriesARB\0"
- "\0"
- /* _mesa_function_pool[19673]: Color4ubVertex2fSUN (dynamic) */
- "iiiiff\0"
- "glColor4ubVertex2fSUN\0"
- "\0"
- /* _mesa_function_pool[19703]: FragmentColorMaterialSGIX (dynamic) */
- "ii\0"
- "glFragmentColorMaterialSGIX\0"
- "\0"
- /* _mesa_function_pool[19735]: CurrentPaletteMatrixARB (dynamic) */
- "i\0"
- "glCurrentPaletteMatrixARB\0"
- "\0"
- /* _mesa_function_pool[19764]: GetMapdv (offset 266) */
- "iip\0"
- "glGetMapdv\0"
- "\0"
- /* _mesa_function_pool[19780]: ObjectPurgeableAPPLE (will be remapped) */
- "iii\0"
- "glObjectPurgeableAPPLE\0"
- "\0"
- /* _mesa_function_pool[19808]: GetStringi (will be remapped) */
- "ii\0"
- "glGetStringi\0"
- "\0"
- /* _mesa_function_pool[19825]: SamplePatternSGIS (will be remapped) */
- "i\0"
- "glSamplePatternSGIS\0"
- "glSamplePatternEXT\0"
- "\0"
- /* _mesa_function_pool[19867]: PixelStoref (offset 249) */
- "if\0"
- "glPixelStoref\0"
- "\0"
- /* _mesa_function_pool[19885]: IsQueryARB (will be remapped) */
- "i\0"
- "glIsQuery\0"
- "glIsQueryARB\0"
- "\0"
- /* _mesa_function_pool[19911]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */
- "iiiiifff\0"
- "glReplacementCodeuiColor4ubVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[19960]: PixelStorei (offset 250) */
- "ii\0"
- "glPixelStorei\0"
- "\0"
- /* _mesa_function_pool[19978]: VertexAttrib4usvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4usv\0"
- "glVertexAttrib4usvARB\0"
- "\0"
- /* _mesa_function_pool[20023]: LinkProgramARB (will be remapped) */
- "i\0"
- "glLinkProgram\0"
- "glLinkProgramARB\0"
- "\0"
- /* _mesa_function_pool[20057]: VertexAttrib2fNV (will be remapped) */
- "iff\0"
- "glVertexAttrib2fNV\0"
- "\0"
- /* _mesa_function_pool[20081]: ShaderSourceARB (will be remapped) */
- "iipp\0"
- "glShaderSource\0"
- "glShaderSourceARB\0"
- "\0"
- /* _mesa_function_pool[20120]: FragmentMaterialiSGIX (dynamic) */
- "iii\0"
- "glFragmentMaterialiSGIX\0"
- "\0"
- /* _mesa_function_pool[20149]: EvalCoord2dv (offset 233) */
- "p\0"
- "glEvalCoord2dv\0"
- "\0"
- /* _mesa_function_pool[20167]: VertexAttrib3svARB (will be remapped) */
- "ip\0"
- "glVertexAttrib3sv\0"
- "glVertexAttrib3svARB\0"
- "\0"
- /* _mesa_function_pool[20210]: ColorMaterial (offset 151) */
- "ii\0"
- "glColorMaterial\0"
- "\0"
- /* _mesa_function_pool[20230]: CompressedTexSubImage3DARB (will be remapped) */
- "iiiiiiiiiip\0"
- "glCompressedTexSubImage3D\0"
- "glCompressedTexSubImage3DARB\0"
- "\0"
- /* _mesa_function_pool[20298]: WindowPos2ivMESA (will be remapped) */
- "p\0"
- "glWindowPos2iv\0"
- "glWindowPos2ivARB\0"
- "glWindowPos2ivMESA\0"
- "\0"
- /* _mesa_function_pool[20353]: IsFramebufferEXT (will be remapped) */
- "i\0"
- "glIsFramebuffer\0"
- "glIsFramebufferEXT\0"
- "\0"
- /* _mesa_function_pool[20391]: Uniform4ivARB (will be remapped) */
- "iip\0"
- "glUniform4iv\0"
- "glUniform4ivARB\0"
- "\0"
- /* _mesa_function_pool[20425]: GetVertexAttribdvARB (will be remapped) */
- "iip\0"
- "glGetVertexAttribdv\0"
- "glGetVertexAttribdvARB\0"
- "\0"
- /* _mesa_function_pool[20473]: TexBumpParameterivATI (will be remapped) */
- "ip\0"
- "glTexBumpParameterivATI\0"
- "\0"
- /* _mesa_function_pool[20501]: GetSeparableFilter (offset 359) */
- "iiippp\0"
- "glGetSeparableFilter\0"
- "glGetSeparableFilterEXT\0"
- "\0"
- /* _mesa_function_pool[20554]: Binormal3dEXT (dynamic) */
- "ddd\0"
- "glBinormal3dEXT\0"
- "\0"
- /* _mesa_function_pool[20575]: SpriteParameteriSGIX (dynamic) */
- "ii\0"
- "glSpriteParameteriSGIX\0"
- "\0"
- /* _mesa_function_pool[20602]: RequestResidentProgramsNV (will be remapped) */
- "ip\0"
- "glRequestResidentProgramsNV\0"
- "\0"
- /* _mesa_function_pool[20634]: TagSampleBufferSGIX (dynamic) */
- "\0"
- "glTagSampleBufferSGIX\0"
- "\0"
- /* _mesa_function_pool[20658]: TransformFeedbackVaryingsEXT (will be remapped) */
- "iipi\0"
- "glTransformFeedbackVaryingsEXT\0"
- "glTransformFeedbackVaryings\0"
- "\0"
- /* _mesa_function_pool[20723]: FeedbackBuffer (offset 194) */
- "iip\0"
- "glFeedbackBuffer\0"
- "\0"
- /* _mesa_function_pool[20745]: RasterPos2iv (offset 67) */
- "p\0"
- "glRasterPos2iv\0"
- "\0"
- /* _mesa_function_pool[20763]: TexImage1D (offset 182) */
- "iiiiiiip\0"
- "glTexImage1D\0"
- "\0"
- /* _mesa_function_pool[20786]: ListParameterivSGIX (dynamic) */
- "iip\0"
- "glListParameterivSGIX\0"
- "\0"
- /* _mesa_function_pool[20813]: MultiDrawElementsEXT (will be remapped) */
- "ipipi\0"
- "glMultiDrawElements\0"
- "glMultiDrawElementsEXT\0"
- "\0"
- /* _mesa_function_pool[20863]: Color3s (offset 17) */
- "iii\0"
- "glColor3s\0"
- "\0"
- /* _mesa_function_pool[20878]: Uniform1ivARB (will be remapped) */
- "iip\0"
- "glUniform1iv\0"
- "glUniform1ivARB\0"
- "\0"
- /* _mesa_function_pool[20912]: WindowPos2sMESA (will be remapped) */
- "ii\0"
- "glWindowPos2s\0"
- "glWindowPos2sARB\0"
- "glWindowPos2sMESA\0"
- "\0"
- /* _mesa_function_pool[20965]: WeightusvARB (dynamic) */
- "ip\0"
- "glWeightusvARB\0"
- "\0"
- /* _mesa_function_pool[20984]: TexCoordPointer (offset 320) */
- "iiip\0"
- "glTexCoordPointer\0"
- "\0"
- /* _mesa_function_pool[21008]: FogCoordPointerEXT (will be remapped) */
- "iip\0"
- "glFogCoordPointer\0"
- "glFogCoordPointerEXT\0"
- "\0"
- /* _mesa_function_pool[21052]: IndexMaterialEXT (dynamic) */
- "ii\0"
- "glIndexMaterialEXT\0"
- "\0"
- /* _mesa_function_pool[21075]: Color3i (offset 15) */
- "iii\0"
- "glColor3i\0"
- "\0"
- /* _mesa_function_pool[21090]: FrontFace (offset 157) */
- "i\0"
- "glFrontFace\0"
- "\0"
- /* _mesa_function_pool[21105]: EvalCoord2d (offset 232) */
- "dd\0"
- "glEvalCoord2d\0"
- "\0"
- /* _mesa_function_pool[21123]: SecondaryColor3ubvEXT (will be remapped) */
- "p\0"
- "glSecondaryColor3ubv\0"
- "glSecondaryColor3ubvEXT\0"
- "\0"
- /* _mesa_function_pool[21171]: EvalCoord2f (offset 234) */
- "ff\0"
- "glEvalCoord2f\0"
- "\0"
- /* _mesa_function_pool[21189]: VertexAttrib4dvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4dv\0"
- "glVertexAttrib4dvARB\0"
- "\0"
- /* _mesa_function_pool[21232]: BindAttribLocationARB (will be remapped) */
- "iip\0"
- "glBindAttribLocation\0"
- "glBindAttribLocationARB\0"
- "\0"
- /* _mesa_function_pool[21282]: Color3b (offset 9) */
- "iii\0"
- "glColor3b\0"
- "\0"
- /* _mesa_function_pool[21297]: MultiTexCoord2dARB (offset 384) */
- "idd\0"
- "glMultiTexCoord2d\0"
- "glMultiTexCoord2dARB\0"
- "\0"
- /* _mesa_function_pool[21341]: ExecuteProgramNV (will be remapped) */
- "iip\0"
- "glExecuteProgramNV\0"
- "\0"
- /* _mesa_function_pool[21365]: Color3f (offset 13) */
- "fff\0"
- "glColor3f\0"
- "\0"
- /* _mesa_function_pool[21380]: LightEnviSGIX (dynamic) */
- "ii\0"
- "glLightEnviSGIX\0"
- "\0"
- /* _mesa_function_pool[21400]: Color3d (offset 11) */
- "ddd\0"
- "glColor3d\0"
- "\0"
- /* _mesa_function_pool[21415]: Normal3dv (offset 55) */
- "p\0"
- "glNormal3dv\0"
- "\0"
- /* _mesa_function_pool[21430]: Lightf (offset 159) */
- "iif\0"
- "glLightf\0"
- "\0"
- /* _mesa_function_pool[21444]: ReplacementCodeuiSUN (dynamic) */
- "i\0"
- "glReplacementCodeuiSUN\0"
- "\0"
- /* _mesa_function_pool[21470]: MatrixMode (offset 293) */
- "i\0"
- "glMatrixMode\0"
- "\0"
- /* _mesa_function_pool[21486]: GetPixelMapusv (offset 273) */
- "ip\0"
- "glGetPixelMapusv\0"
- "\0"
- /* _mesa_function_pool[21507]: Lighti (offset 161) */
- "iii\0"
- "glLighti\0"
- "\0"
- /* _mesa_function_pool[21521]: VertexAttribPointerNV (will be remapped) */
- "iiiip\0"
- "glVertexAttribPointerNV\0"
- "\0"
- /* _mesa_function_pool[21552]: GetBooleanIndexedvEXT (will be remapped) */
- "iip\0"
- "glGetBooleanIndexedvEXT\0"
- "glGetBooleani_v\0"
- "\0"
- /* _mesa_function_pool[21597]: GetFramebufferAttachmentParameterivEXT (will be remapped) */
- "iiip\0"
- "glGetFramebufferAttachmentParameteriv\0"
- "glGetFramebufferAttachmentParameterivEXT\0"
- "\0"
- /* _mesa_function_pool[21682]: PixelTransformParameterfEXT (dynamic) */
- "iif\0"
- "glPixelTransformParameterfEXT\0"
- "\0"
- /* _mesa_function_pool[21717]: MultiTexCoord4dvARB (offset 401) */
- "ip\0"
- "glMultiTexCoord4dv\0"
- "glMultiTexCoord4dvARB\0"
- "\0"
- /* _mesa_function_pool[21762]: PixelTransformParameteriEXT (dynamic) */
- "iii\0"
- "glPixelTransformParameteriEXT\0"
- "\0"
- /* _mesa_function_pool[21797]: GetDoublev (offset 260) */
- "ip\0"
- "glGetDoublev\0"
- "\0"
- /* _mesa_function_pool[21814]: MultMatrixd (offset 295) */
- "p\0"
- "glMultMatrixd\0"
- "\0"
- /* _mesa_function_pool[21831]: MultMatrixf (offset 294) */
- "p\0"
- "glMultMatrixf\0"
- "\0"
- /* _mesa_function_pool[21848]: VertexAttribI4bvEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI4bvEXT\0"
- "glVertexAttribI4bv\0"
- "\0"
- /* _mesa_function_pool[21893]: TexCoord2fColor4ubVertex3fSUN (dynamic) */
- "ffiiiifff\0"
- "glTexCoord2fColor4ubVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[21936]: Uniform1iARB (will be remapped) */
- "ii\0"
- "glUniform1i\0"
- "glUniform1iARB\0"
- "\0"
- /* _mesa_function_pool[21967]: VertexAttribPointerARB (will be remapped) */
- "iiiiip\0"
- "glVertexAttribPointer\0"
- "glVertexAttribPointerARB\0"
- "\0"
- /* _mesa_function_pool[22022]: VertexAttrib3sNV (will be remapped) */
- "iiii\0"
- "glVertexAttrib3sNV\0"
- "\0"
- /* _mesa_function_pool[22047]: SharpenTexFuncSGIS (dynamic) */
- "iip\0"
- "glSharpenTexFuncSGIS\0"
- "\0"
- /* _mesa_function_pool[22073]: MultiTexCoord4fvARB (offset 403) */
- "ip\0"
- "glMultiTexCoord4fv\0"
- "glMultiTexCoord4fvARB\0"
- "\0"
- /* _mesa_function_pool[22118]: Uniform2uiEXT (will be remapped) */
- "iii\0"
- "glUniform2uiEXT\0"
- "glUniform2ui\0"
- "\0"
- /* _mesa_function_pool[22152]: UniformMatrix2x3fv (will be remapped) */
- "iiip\0"
- "glUniformMatrix2x3fv\0"
- "\0"
- /* _mesa_function_pool[22179]: TrackMatrixNV (will be remapped) */
- "iiii\0"
- "glTrackMatrixNV\0"
- "\0"
- /* _mesa_function_pool[22201]: CombinerParameteriNV (will be remapped) */
- "ii\0"
- "glCombinerParameteriNV\0"
- "\0"
- /* _mesa_function_pool[22228]: DeleteAsyncMarkersSGIX (dynamic) */
- "ii\0"
- "glDeleteAsyncMarkersSGIX\0"
- "\0"
- /* _mesa_function_pool[22257]: ReplacementCodeusSUN (dynamic) */
- "i\0"
- "glReplacementCodeusSUN\0"
- "\0"
- /* _mesa_function_pool[22283]: IsAsyncMarkerSGIX (dynamic) */
- "i\0"
- "glIsAsyncMarkerSGIX\0"
- "\0"
- /* _mesa_function_pool[22306]: FrameZoomSGIX (dynamic) */
- "i\0"
- "glFrameZoomSGIX\0"
- "\0"
- /* _mesa_function_pool[22325]: Normal3fVertex3fvSUN (dynamic) */
- "pp\0"
- "glNormal3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[22352]: RasterPos4sv (offset 85) */
- "p\0"
- "glRasterPos4sv\0"
- "\0"
- /* _mesa_function_pool[22370]: VertexAttrib4NsvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4Nsv\0"
- "glVertexAttrib4NsvARB\0"
- "\0"
- /* _mesa_function_pool[22415]: VertexAttrib3fvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib3fv\0"
- "glVertexAttrib3fvARB\0"
- "\0"
- /* _mesa_function_pool[22458]: ClearColor (offset 206) */
- "ffff\0"
- "glClearColor\0"
- "\0"
- /* _mesa_function_pool[22477]: GetSynciv (will be remapped) */
- "iiipp\0"
- "glGetSynciv\0"
- "\0"
- /* _mesa_function_pool[22496]: ClearColorIiEXT (will be remapped) */
- "iiii\0"
- "glClearColorIiEXT\0"
- "\0"
- /* _mesa_function_pool[22520]: DeleteFramebuffersEXT (will be remapped) */
- "ip\0"
- "glDeleteFramebuffers\0"
- "glDeleteFramebuffersEXT\0"
- "\0"
- /* _mesa_function_pool[22569]: GlobalAlphaFactorsSUN (dynamic) */
- "i\0"
- "glGlobalAlphaFactorsSUN\0"
- "\0"
- /* _mesa_function_pool[22596]: IsEnabledIndexedEXT (will be remapped) */
- "ii\0"
- "glIsEnabledIndexedEXT\0"
- "glIsEnabledi\0"
- "\0"
- /* _mesa_function_pool[22635]: TexEnviv (offset 187) */
- "iip\0"
- "glTexEnviv\0"
- "\0"
- /* _mesa_function_pool[22651]: TexSubImage3D (offset 372) */
- "iiiiiiiiiip\0"
- "glTexSubImage3D\0"
- "glTexSubImage3DEXT\0"
- "\0"
- /* _mesa_function_pool[22699]: Tangent3fEXT (dynamic) */
- "fff\0"
- "glTangent3fEXT\0"
- "\0"
- /* _mesa_function_pool[22719]: SecondaryColor3uivEXT (will be remapped) */
- "p\0"
- "glSecondaryColor3uiv\0"
- "glSecondaryColor3uivEXT\0"
- "\0"
- /* _mesa_function_pool[22767]: MatrixIndexubvARB (dynamic) */
- "ip\0"
- "glMatrixIndexubvARB\0"
- "\0"
- /* _mesa_function_pool[22791]: Color4fNormal3fVertex3fSUN (dynamic) */
- "ffffffffff\0"
- "glColor4fNormal3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[22832]: PixelTexGenParameterfSGIS (will be remapped) */
- "if\0"
- "glPixelTexGenParameterfSGIS\0"
- "\0"
- /* _mesa_function_pool[22864]: CreateShader (will be remapped) */
- "i\0"
- "glCreateShader\0"
- "\0"
- /* _mesa_function_pool[22882]: GetColorTableParameterfv (offset 344) */
- "iip\0"
- "glGetColorTableParameterfv\0"
- "glGetColorTableParameterfvSGI\0"
- "glGetColorTableParameterfvEXT\0"
- "\0"
- /* _mesa_function_pool[22974]: FragmentLightModelfvSGIX (dynamic) */
- "ip\0"
- "glFragmentLightModelfvSGIX\0"
- "\0"
- /* _mesa_function_pool[23005]: Bitmap (offset 8) */
- "iiffffp\0"
- "glBitmap\0"
- "\0"
- /* _mesa_function_pool[23023]: MultiTexCoord3fARB (offset 394) */
- "ifff\0"
- "glMultiTexCoord3f\0"
- "glMultiTexCoord3fARB\0"
- "\0"
- /* _mesa_function_pool[23068]: GetTexLevelParameterfv (offset 284) */
- "iiip\0"
- "glGetTexLevelParameterfv\0"
- "\0"
- /* _mesa_function_pool[23099]: GetPixelTexGenParameterfvSGIS (will be remapped) */
- "ip\0"
- "glGetPixelTexGenParameterfvSGIS\0"
- "\0"
- /* _mesa_function_pool[23135]: GenFramebuffersEXT (will be remapped) */
- "ip\0"
- "glGenFramebuffers\0"
- "glGenFramebuffersEXT\0"
- "\0"
- /* _mesa_function_pool[23178]: VertexAttribDivisor (will be remapped) */
- "ii\0"
- "glVertexAttribDivisor\0"
- "\0"
- /* _mesa_function_pool[23204]: GetProgramParameterdvNV (will be remapped) */
- "iiip\0"
- "glGetProgramParameterdvNV\0"
- "\0"
- /* _mesa_function_pool[23236]: Vertex2sv (offset 133) */
- "p\0"
- "glVertex2sv\0"
- "\0"
- /* _mesa_function_pool[23251]: GetIntegerv (offset 263) */
- "ip\0"
- "glGetIntegerv\0"
- "\0"
- /* _mesa_function_pool[23269]: IsVertexArrayAPPLE (will be remapped) */
- "i\0"
- "glIsVertexArray\0"
- "glIsVertexArrayAPPLE\0"
- "\0"
- /* _mesa_function_pool[23309]: FragmentLightfvSGIX (dynamic) */
- "iip\0"
- "glFragmentLightfvSGIX\0"
- "\0"
- /* _mesa_function_pool[23336]: DetachShader (will be remapped) */
- "ii\0"
- "glDetachShader\0"
- "\0"
- /* _mesa_function_pool[23355]: VertexAttrib4NubARB (will be remapped) */
- "iiiii\0"
- "glVertexAttrib4Nub\0"
- "glVertexAttrib4NubARB\0"
- "\0"
- /* _mesa_function_pool[23403]: GetProgramEnvParameterfvARB (will be remapped) */
- "iip\0"
- "glGetProgramEnvParameterfvARB\0"
- "\0"
- /* _mesa_function_pool[23438]: GetTrackMatrixivNV (will be remapped) */
- "iiip\0"
- "glGetTrackMatrixivNV\0"
- "\0"
- /* _mesa_function_pool[23465]: VertexAttrib3svNV (will be remapped) */
- "ip\0"
- "glVertexAttrib3svNV\0"
- "\0"
- /* _mesa_function_pool[23489]: Uniform4fvARB (will be remapped) */
- "iip\0"
- "glUniform4fv\0"
- "glUniform4fvARB\0"
- "\0"
- /* _mesa_function_pool[23523]: MultTransposeMatrixfARB (will be remapped) */
- "p\0"
- "glMultTransposeMatrixf\0"
- "glMultTransposeMatrixfARB\0"
- "\0"
- /* _mesa_function_pool[23575]: GetTexEnviv (offset 277) */
- "iip\0"
- "glGetTexEnviv\0"
- "\0"
- /* _mesa_function_pool[23594]: ColorFragmentOp1ATI (will be remapped) */
- "iiiiiii\0"
- "glColorFragmentOp1ATI\0"
- "\0"
- /* _mesa_function_pool[23625]: GetUniformfvARB (will be remapped) */
- "iip\0"
- "glGetUniformfv\0"
- "glGetUniformfvARB\0"
- "\0"
- /* _mesa_function_pool[23663]: EGLImageTargetRenderbufferStorageOES (will be remapped) */
- "ip\0"
- "glEGLImageTargetRenderbufferStorageOES\0"
- "\0"
- /* _mesa_function_pool[23706]: VertexAttribI2ivEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI2ivEXT\0"
- "glVertexAttribI2iv\0"
- "\0"
- /* _mesa_function_pool[23751]: PopClientAttrib (offset 334) */
- "\0"
- "glPopClientAttrib\0"
- "\0"
- /* _mesa_function_pool[23771]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
- "iffffffffffff\0"
- "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[23842]: DetachObjectARB (will be remapped) */
- "ii\0"
- "glDetachObjectARB\0"
- "\0"
- /* _mesa_function_pool[23864]: VertexBlendARB (dynamic) */
- "i\0"
- "glVertexBlendARB\0"
- "\0"
- /* _mesa_function_pool[23884]: WindowPos3iMESA (will be remapped) */
- "iii\0"
- "glWindowPos3i\0"
- "glWindowPos3iARB\0"
- "glWindowPos3iMESA\0"
- "\0"
- /* _mesa_function_pool[23938]: SeparableFilter2D (offset 360) */
- "iiiiiipp\0"
- "glSeparableFilter2D\0"
- "glSeparableFilter2DEXT\0"
- "\0"
- /* _mesa_function_pool[23991]: ProgramParameteriARB (will be remapped) */
- "iii\0"
- "glProgramParameteriARB\0"
- "\0"
- /* _mesa_function_pool[24019]: Map1d (offset 220) */
- "iddiip\0"
- "glMap1d\0"
- "\0"
- /* _mesa_function_pool[24035]: Map1f (offset 221) */
- "iffiip\0"
- "glMap1f\0"
- "\0"
- /* _mesa_function_pool[24051]: CompressedTexImage2DARB (will be remapped) */
- "iiiiiiip\0"
- "glCompressedTexImage2D\0"
- "glCompressedTexImage2DARB\0"
- "\0"
- /* _mesa_function_pool[24110]: ArrayElement (offset 306) */
- "i\0"
- "glArrayElement\0"
- "glArrayElementEXT\0"
- "\0"
- /* _mesa_function_pool[24146]: TexImage2D (offset 183) */
- "iiiiiiiip\0"
- "glTexImage2D\0"
- "\0"
- /* _mesa_function_pool[24170]: DepthBoundsEXT (will be remapped) */
- "dd\0"
- "glDepthBoundsEXT\0"
- "\0"
- /* _mesa_function_pool[24191]: ProgramParameters4fvNV (will be remapped) */
- "iiip\0"
- "glProgramParameters4fvNV\0"
- "\0"
- /* _mesa_function_pool[24222]: DeformationMap3fSGIX (dynamic) */
- "iffiiffiiffiip\0"
- "glDeformationMap3fSGIX\0"
- "\0"
- /* _mesa_function_pool[24261]: GetProgramivNV (will be remapped) */
- "iip\0"
- "glGetProgramivNV\0"
- "\0"
- /* _mesa_function_pool[24283]: GetFragDataLocationEXT (will be remapped) */
- "ip\0"
- "glGetFragDataLocationEXT\0"
- "glGetFragDataLocation\0"
- "\0"
- /* _mesa_function_pool[24334]: GetMinmaxParameteriv (offset 366) */
- "iip\0"
- "glGetMinmaxParameteriv\0"
- "glGetMinmaxParameterivEXT\0"
- "\0"
- /* _mesa_function_pool[24388]: PixelTransferf (offset 247) */
- "if\0"
- "glPixelTransferf\0"
- "\0"
- /* _mesa_function_pool[24409]: CopyTexImage1D (offset 323) */
- "iiiiiii\0"
- "glCopyTexImage1D\0"
- "glCopyTexImage1DEXT\0"
- "\0"
- /* _mesa_function_pool[24455]: PushMatrix (offset 298) */
- "\0"
- "glPushMatrix\0"
- "\0"
- /* _mesa_function_pool[24470]: Fogiv (offset 156) */
- "ip\0"
- "glFogiv\0"
- "\0"
- /* _mesa_function_pool[24482]: TexCoord1dv (offset 95) */
- "p\0"
- "glTexCoord1dv\0"
- "\0"
- /* _mesa_function_pool[24499]: AlphaFragmentOp3ATI (will be remapped) */
- "iiiiiiiiiiii\0"
- "glAlphaFragmentOp3ATI\0"
- "\0"
- /* _mesa_function_pool[24535]: PixelTransferi (offset 248) */
- "ii\0"
- "glPixelTransferi\0"
- "\0"
- /* _mesa_function_pool[24556]: GetVertexAttribdvNV (will be remapped) */
- "iip\0"
- "glGetVertexAttribdvNV\0"
- "\0"
- /* _mesa_function_pool[24583]: VertexAttrib3fvNV (will be remapped) */
- "ip\0"
- "glVertexAttrib3fvNV\0"
- "\0"
- /* _mesa_function_pool[24607]: Rotatef (offset 300) */
- "ffff\0"
- "glRotatef\0"
- "\0"
- /* _mesa_function_pool[24623]: GetFinalCombinerInputParameterivNV (will be remapped) */
- "iip\0"
- "glGetFinalCombinerInputParameterivNV\0"
- "\0"
- /* _mesa_function_pool[24665]: Vertex3i (offset 138) */
- "iii\0"
- "glVertex3i\0"
- "\0"
- /* _mesa_function_pool[24681]: Vertex3f (offset 136) */
- "fff\0"
- "glVertex3f\0"
- "\0"
- /* _mesa_function_pool[24697]: Clear (offset 203) */
- "i\0"
- "glClear\0"
- "\0"
- /* _mesa_function_pool[24708]: Vertex3d (offset 134) */
- "ddd\0"
- "glVertex3d\0"
- "\0"
- /* _mesa_function_pool[24724]: GetMapParameterivNV (dynamic) */
- "iip\0"
- "glGetMapParameterivNV\0"
- "\0"
- /* _mesa_function_pool[24751]: Uniform4iARB (will be remapped) */
- "iiiii\0"
- "glUniform4i\0"
- "glUniform4iARB\0"
- "\0"
- /* _mesa_function_pool[24785]: ReadBuffer (offset 254) */
- "i\0"
- "glReadBuffer\0"
- "\0"
- /* _mesa_function_pool[24801]: ConvolutionParameteri (offset 352) */
- "iii\0"
- "glConvolutionParameteri\0"
- "glConvolutionParameteriEXT\0"
- "\0"
- /* _mesa_function_pool[24857]: Ortho (offset 296) */
- "dddddd\0"
- "glOrtho\0"
- "\0"
- /* _mesa_function_pool[24873]: Binormal3sEXT (dynamic) */
- "iii\0"
- "glBinormal3sEXT\0"
- "\0"
- /* _mesa_function_pool[24894]: ListBase (offset 6) */
- "i\0"
- "glListBase\0"
- "\0"
- /* _mesa_function_pool[24908]: Vertex3s (offset 140) */
- "iii\0"
- "glVertex3s\0"
- "\0"
- /* _mesa_function_pool[24924]: ConvolutionParameterf (offset 350) */
- "iif\0"
- "glConvolutionParameterf\0"
- "glConvolutionParameterfEXT\0"
- "\0"
- /* _mesa_function_pool[24980]: GetColorTableParameteriv (offset 345) */
- "iip\0"
- "glGetColorTableParameteriv\0"
- "glGetColorTableParameterivSGI\0"
- "glGetColorTableParameterivEXT\0"
- "\0"
- /* _mesa_function_pool[25072]: ProgramEnvParameter4dvARB (will be remapped) */
- "iip\0"
- "glProgramEnvParameter4dvARB\0"
- "glProgramParameter4dvNV\0"
- "\0"
- /* _mesa_function_pool[25129]: ShadeModel (offset 177) */
- "i\0"
- "glShadeModel\0"
- "\0"
- /* _mesa_function_pool[25145]: VertexAttribs2fvNV (will be remapped) */
- "iip\0"
- "glVertexAttribs2fvNV\0"
- "\0"
- /* _mesa_function_pool[25171]: Rectiv (offset 91) */
- "pp\0"
- "glRectiv\0"
- "\0"
- /* _mesa_function_pool[25184]: UseProgramObjectARB (will be remapped) */
- "i\0"
- "glUseProgram\0"
- "glUseProgramObjectARB\0"
- "\0"
- /* _mesa_function_pool[25222]: GetMapParameterfvNV (dynamic) */
- "iip\0"
- "glGetMapParameterfvNV\0"
- "\0"
- /* _mesa_function_pool[25249]: EndConditionalRenderNV (will be remapped) */
- "\0"
- "glEndConditionalRenderNV\0"
- "glEndConditionalRender\0"
- "\0"
- /* _mesa_function_pool[25299]: PassTexCoordATI (will be remapped) */
- "iii\0"
- "glPassTexCoordATI\0"
- "\0"
- /* _mesa_function_pool[25322]: DeleteProgram (will be remapped) */
- "i\0"
- "glDeleteProgram\0"
- "\0"
- /* _mesa_function_pool[25341]: Tangent3ivEXT (dynamic) */
- "p\0"
- "glTangent3ivEXT\0"
- "\0"
- /* _mesa_function_pool[25360]: Tangent3dEXT (dynamic) */
- "ddd\0"
- "glTangent3dEXT\0"
- "\0"
- /* _mesa_function_pool[25380]: SecondaryColor3dvEXT (will be remapped) */
- "p\0"
- "glSecondaryColor3dv\0"
- "glSecondaryColor3dvEXT\0"
- "\0"
- /* _mesa_function_pool[25426]: Vertex2fv (offset 129) */
- "p\0"
- "glVertex2fv\0"
- "\0"
- /* _mesa_function_pool[25441]: MultiDrawArraysEXT (will be remapped) */
- "ippi\0"
- "glMultiDrawArrays\0"
- "glMultiDrawArraysEXT\0"
- "\0"
- /* _mesa_function_pool[25486]: BindRenderbufferEXT (will be remapped) */
- "ii\0"
- "glBindRenderbuffer\0"
- "glBindRenderbufferEXT\0"
- "\0"
- /* _mesa_function_pool[25531]: MultiTexCoord4dARB (offset 400) */
- "idddd\0"
- "glMultiTexCoord4d\0"
- "glMultiTexCoord4dARB\0"
- "\0"
- /* _mesa_function_pool[25577]: FramebufferTextureFaceARB (will be remapped) */
- "iiiii\0"
- "glFramebufferTextureFaceARB\0"
- "\0"
- /* _mesa_function_pool[25612]: Vertex3sv (offset 141) */
- "p\0"
- "glVertex3sv\0"
- "\0"
- /* _mesa_function_pool[25627]: SecondaryColor3usEXT (will be remapped) */
- "iii\0"
- "glSecondaryColor3us\0"
- "glSecondaryColor3usEXT\0"
- "\0"
- /* _mesa_function_pool[25675]: ProgramLocalParameter4fvARB (will be remapped) */
- "iip\0"
- "glProgramLocalParameter4fvARB\0"
- "\0"
- /* _mesa_function_pool[25710]: DeleteProgramsNV (will be remapped) */
- "ip\0"
- "glDeleteProgramsARB\0"
- "glDeleteProgramsNV\0"
- "\0"
- /* _mesa_function_pool[25753]: EvalMesh1 (offset 236) */
- "iii\0"
- "glEvalMesh1\0"
- "\0"
- /* _mesa_function_pool[25770]: PauseTransformFeedback (will be remapped) */
- "\0"
- "glPauseTransformFeedback\0"
- "\0"
- /* _mesa_function_pool[25797]: MultiTexCoord1sARB (offset 382) */
- "ii\0"
- "glMultiTexCoord1s\0"
- "glMultiTexCoord1sARB\0"
- "\0"
- /* _mesa_function_pool[25840]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */
- "iffffff\0"
- "glReplacementCodeuiColor3fVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[25887]: GetVertexAttribPointervNV (will be remapped) */
- "iip\0"
- "glGetVertexAttribPointerv\0"
- "glGetVertexAttribPointervARB\0"
- "glGetVertexAttribPointervNV\0"
- "\0"
- /* _mesa_function_pool[25975]: VertexAttribs1fvNV (will be remapped) */
- "iip\0"
- "glVertexAttribs1fvNV\0"
- "\0"
- /* _mesa_function_pool[26001]: MultiTexCoord1dvARB (offset 377) */
- "ip\0"
- "glMultiTexCoord1dv\0"
- "glMultiTexCoord1dvARB\0"
- "\0"
- /* _mesa_function_pool[26046]: Uniform2iARB (will be remapped) */
- "iii\0"
- "glUniform2i\0"
- "glUniform2iARB\0"
- "\0"
- /* _mesa_function_pool[26078]: Vertex2iv (offset 131) */
- "p\0"
- "glVertex2iv\0"
- "\0"
- /* _mesa_function_pool[26093]: GetProgramStringNV (will be remapped) */
- "iip\0"
- "glGetProgramStringNV\0"
- "\0"
- /* _mesa_function_pool[26119]: ColorPointerEXT (will be remapped) */
- "iiiip\0"
- "glColorPointerEXT\0"
- "\0"
- /* _mesa_function_pool[26144]: LineWidth (offset 168) */
- "f\0"
- "glLineWidth\0"
- "\0"
- /* _mesa_function_pool[26159]: MapBufferARB (will be remapped) */
- "ii\0"
- "glMapBuffer\0"
- "glMapBufferARB\0"
- "\0"
- /* _mesa_function_pool[26190]: MultiDrawElementsBaseVertex (will be remapped) */
- "ipipip\0"
- "glMultiDrawElementsBaseVertex\0"
- "\0"
- /* _mesa_function_pool[26228]: TexParameterIuivEXT (will be remapped) */
- "iip\0"
- "glTexParameterIuivEXT\0"
- "glTexParameterIuiv\0"
- "\0"
- /* _mesa_function_pool[26274]: Binormal3svEXT (dynamic) */
- "p\0"
- "glBinormal3svEXT\0"
- "\0"
- /* _mesa_function_pool[26294]: ApplyTextureEXT (dynamic) */
- "i\0"
- "glApplyTextureEXT\0"
- "\0"
- /* _mesa_function_pool[26315]: GetBufferParameteri64v (will be remapped) */
- "iip\0"
- "glGetBufferParameteri64v\0"
- "\0"
- /* _mesa_function_pool[26345]: TexGendv (offset 189) */
- "iip\0"
- "glTexGendv\0"
- "\0"
- /* _mesa_function_pool[26361]: VertexAttribI3iEXT (will be remapped) */
- "iiii\0"
- "glVertexAttribI3iEXT\0"
- "glVertexAttribI3i\0"
- "\0"
- /* _mesa_function_pool[26406]: EnableIndexedEXT (will be remapped) */
- "ii\0"
- "glEnableIndexedEXT\0"
- "glEnablei\0"
- "\0"
- /* _mesa_function_pool[26439]: TextureMaterialEXT (dynamic) */
- "ii\0"
- "glTextureMaterialEXT\0"
- "\0"
- /* _mesa_function_pool[26464]: TextureLightEXT (dynamic) */
- "i\0"
- "glTextureLightEXT\0"
- "\0"
- /* _mesa_function_pool[26485]: ResetMinmax (offset 370) */
- "i\0"
- "glResetMinmax\0"
- "glResetMinmaxEXT\0"
- "\0"
- /* _mesa_function_pool[26519]: SpriteParameterfSGIX (dynamic) */
- "if\0"
- "glSpriteParameterfSGIX\0"
- "\0"
- /* _mesa_function_pool[26546]: EnableClientState (offset 313) */
- "i\0"
- "glEnableClientState\0"
- "\0"
- /* _mesa_function_pool[26569]: VertexAttrib4sNV (will be remapped) */
- "iiiii\0"
- "glVertexAttrib4sNV\0"
- "\0"
- /* _mesa_function_pool[26595]: GetConvolutionParameterfv (offset 357) */
- "iip\0"
- "glGetConvolutionParameterfv\0"
- "glGetConvolutionParameterfvEXT\0"
- "\0"
- /* _mesa_function_pool[26659]: VertexAttribs4dvNV (will be remapped) */
- "iip\0"
- "glVertexAttribs4dvNV\0"
- "\0"
- /* _mesa_function_pool[26685]: VertexAttrib4dARB (will be remapped) */
- "idddd\0"
- "glVertexAttrib4d\0"
- "glVertexAttrib4dARB\0"
- "\0"
- /* _mesa_function_pool[26729]: GetTexBumpParameterfvATI (will be remapped) */
- "ip\0"
- "glGetTexBumpParameterfvATI\0"
- "\0"
- /* _mesa_function_pool[26760]: ProgramNamedParameter4dNV (will be remapped) */
- "iipdddd\0"
- "glProgramNamedParameter4dNV\0"
- "\0"
- /* _mesa_function_pool[26797]: GetMaterialfv (offset 269) */
- "iip\0"
- "glGetMaterialfv\0"
- "\0"
- /* _mesa_function_pool[26818]: VertexWeightfEXT (dynamic) */
- "f\0"
- "glVertexWeightfEXT\0"
- "\0"
- /* _mesa_function_pool[26840]: Binormal3fEXT (dynamic) */
- "fff\0"
- "glBinormal3fEXT\0"
- "\0"
- /* _mesa_function_pool[26861]: CallList (offset 2) */
- "i\0"
- "glCallList\0"
- "\0"
- /* _mesa_function_pool[26875]: Materialfv (offset 170) */
- "iip\0"
- "glMaterialfv\0"
- "\0"
- /* _mesa_function_pool[26893]: TexCoord3fv (offset 113) */
- "p\0"
- "glTexCoord3fv\0"
- "\0"
- /* _mesa_function_pool[26910]: FogCoordfvEXT (will be remapped) */
- "p\0"
- "glFogCoordfv\0"
- "glFogCoordfvEXT\0"
- "\0"
- /* _mesa_function_pool[26942]: MultiTexCoord1ivARB (offset 381) */
- "ip\0"
- "glMultiTexCoord1iv\0"
- "glMultiTexCoord1ivARB\0"
- "\0"
- /* _mesa_function_pool[26987]: SecondaryColor3ubEXT (will be remapped) */
- "iii\0"
- "glSecondaryColor3ub\0"
- "glSecondaryColor3ubEXT\0"
- "\0"
- /* _mesa_function_pool[27035]: MultiTexCoord2ivARB (offset 389) */
- "ip\0"
- "glMultiTexCoord2iv\0"
- "glMultiTexCoord2ivARB\0"
- "\0"
- /* _mesa_function_pool[27080]: FogFuncSGIS (dynamic) */
- "ip\0"
- "glFogFuncSGIS\0"
- "\0"
- /* _mesa_function_pool[27098]: CopyTexSubImage2D (offset 326) */
- "iiiiiiii\0"
- "glCopyTexSubImage2D\0"
- "glCopyTexSubImage2DEXT\0"
- "\0"
- /* _mesa_function_pool[27151]: GetObjectParameterivARB (will be remapped) */
- "iip\0"
- "glGetObjectParameterivARB\0"
- "\0"
- /* _mesa_function_pool[27182]: Color3iv (offset 16) */
- "p\0"
- "glColor3iv\0"
- "\0"
- /* _mesa_function_pool[27196]: TexCoord4fVertex4fSUN (dynamic) */
- "ffffffff\0"
- "glTexCoord4fVertex4fSUN\0"
- "\0"
- /* _mesa_function_pool[27230]: DrawElements (offset 311) */
- "iiip\0"
- "glDrawElements\0"
- "\0"
- /* _mesa_function_pool[27251]: BindVertexArrayAPPLE (will be remapped) */
- "i\0"
- "glBindVertexArrayAPPLE\0"
- "\0"
- /* _mesa_function_pool[27277]: GetProgramLocalParameterdvARB (will be remapped) */
- "iip\0"
- "glGetProgramLocalParameterdvARB\0"
- "\0"
- /* _mesa_function_pool[27314]: GetHistogramParameteriv (offset 363) */
- "iip\0"
- "glGetHistogramParameteriv\0"
- "glGetHistogramParameterivEXT\0"
- "\0"
- /* _mesa_function_pool[27374]: MultiTexCoord1iARB (offset 380) */
- "ii\0"
- "glMultiTexCoord1i\0"
- "glMultiTexCoord1iARB\0"
- "\0"
- /* _mesa_function_pool[27417]: GetConvolutionFilter (offset 356) */
- "iiip\0"
- "glGetConvolutionFilter\0"
- "glGetConvolutionFilterEXT\0"
- "\0"
- /* _mesa_function_pool[27472]: GetProgramivARB (will be remapped) */
- "iip\0"
- "glGetProgramivARB\0"
- "\0"
- /* _mesa_function_pool[27495]: BlendFuncSeparateEXT (will be remapped) */
- "iiii\0"
- "glBlendFuncSeparate\0"
- "glBlendFuncSeparateEXT\0"
- "glBlendFuncSeparateINGR\0"
- "\0"
- /* _mesa_function_pool[27568]: MapBufferRange (will be remapped) */
- "iiii\0"
- "glMapBufferRange\0"
- "\0"
- /* _mesa_function_pool[27591]: ProgramParameters4dvNV (will be remapped) */
- "iiip\0"
- "glProgramParameters4dvNV\0"
- "\0"
- /* _mesa_function_pool[27622]: TexCoord2fColor3fVertex3fvSUN (dynamic) */
- "ppp\0"
- "glTexCoord2fColor3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[27659]: EvalPoint2 (offset 239) */
- "ii\0"
- "glEvalPoint2\0"
- "\0"
- /* _mesa_function_pool[27676]: Uniform1uivEXT (will be remapped) */
- "iip\0"
- "glUniform1uivEXT\0"
- "glUniform1uiv\0"
- "\0"
- /* _mesa_function_pool[27712]: EvalPoint1 (offset 237) */
- "i\0"
- "glEvalPoint1\0"
- "\0"
- /* _mesa_function_pool[27728]: Binormal3dvEXT (dynamic) */
- "p\0"
- "glBinormal3dvEXT\0"
- "\0"
- /* _mesa_function_pool[27748]: PopMatrix (offset 297) */
- "\0"
- "glPopMatrix\0"
- "\0"
- /* _mesa_function_pool[27762]: FinishFenceNV (will be remapped) */
- "i\0"
- "glFinishFenceNV\0"
- "\0"
- /* _mesa_function_pool[27781]: GetFogFuncSGIS (dynamic) */
- "p\0"
- "glGetFogFuncSGIS\0"
- "\0"
- /* _mesa_function_pool[27801]: GetUniformLocationARB (will be remapped) */
- "ip\0"
- "glGetUniformLocation\0"
- "glGetUniformLocationARB\0"
- "\0"
- /* _mesa_function_pool[27850]: SecondaryColor3fEXT (will be remapped) */
- "fff\0"
- "glSecondaryColor3f\0"
- "glSecondaryColor3fEXT\0"
- "\0"
- /* _mesa_function_pool[27896]: GetTexGeniv (offset 280) */
- "iip\0"
- "glGetTexGeniv\0"
- "\0"
- /* _mesa_function_pool[27915]: CombinerInputNV (will be remapped) */
- "iiiiii\0"
- "glCombinerInputNV\0"
- "\0"
- /* _mesa_function_pool[27941]: VertexAttrib3sARB (will be remapped) */
- "iiii\0"
- "glVertexAttrib3s\0"
- "glVertexAttrib3sARB\0"
- "\0"
- /* _mesa_function_pool[27984]: IsTransformFeedback (will be remapped) */
- "i\0"
- "glIsTransformFeedback\0"
- "\0"
- /* _mesa_function_pool[28009]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */
- "ppp\0"
- "glReplacementCodeuiNormal3fVertex3fvSUN\0"
- "\0"
- /* _mesa_function_pool[28054]: Map2d (offset 222) */
- "iddiiddiip\0"
- "glMap2d\0"
- "\0"
- /* _mesa_function_pool[28074]: Map2f (offset 223) */
- "iffiiffiip\0"
- "glMap2f\0"
- "\0"
- /* _mesa_function_pool[28094]: ProgramStringARB (will be remapped) */
- "iiip\0"
- "glProgramStringARB\0"
- "\0"
- /* _mesa_function_pool[28119]: Vertex4s (offset 148) */
- "iiii\0"
- "glVertex4s\0"
- "\0"
- /* _mesa_function_pool[28136]: TexCoord4fVertex4fvSUN (dynamic) */
- "pp\0"
- "glTexCoord4fVertex4fvSUN\0"
- "\0"
- /* _mesa_function_pool[28165]: FragmentLightModelivSGIX (dynamic) */
- "ip\0"
- "glFragmentLightModelivSGIX\0"
- "\0"
- /* _mesa_function_pool[28196]: VertexAttrib1fNV (will be remapped) */
- "if\0"
- "glVertexAttrib1fNV\0"
- "\0"
- /* _mesa_function_pool[28219]: Vertex4f (offset 144) */
- "ffff\0"
- "glVertex4f\0"
- "\0"
- /* _mesa_function_pool[28236]: EvalCoord1d (offset 228) */
- "d\0"
- "glEvalCoord1d\0"
- "\0"
- /* _mesa_function_pool[28253]: Vertex4d (offset 142) */
- "dddd\0"
- "glVertex4d\0"
- "\0"
- /* _mesa_function_pool[28270]: RasterPos4dv (offset 79) */
- "p\0"
- "glRasterPos4dv\0"
- "\0"
- /* _mesa_function_pool[28288]: UseShaderProgramEXT (will be remapped) */
- "ii\0"
- "glUseShaderProgramEXT\0"
- "\0"
- /* _mesa_function_pool[28314]: FragmentLightfSGIX (dynamic) */
- "iif\0"
- "glFragmentLightfSGIX\0"
- "\0"
- /* _mesa_function_pool[28340]: GetCompressedTexImageARB (will be remapped) */
- "iip\0"
- "glGetCompressedTexImage\0"
- "glGetCompressedTexImageARB\0"
- "\0"
- /* _mesa_function_pool[28396]: GetTexGenfv (offset 279) */
- "iip\0"
- "glGetTexGenfv\0"
- "\0"
- /* _mesa_function_pool[28415]: Vertex4i (offset 146) */
- "iiii\0"
- "glVertex4i\0"
- "\0"
- /* _mesa_function_pool[28432]: VertexWeightPointerEXT (dynamic) */
- "iiip\0"
- "glVertexWeightPointerEXT\0"
- "\0"
- /* _mesa_function_pool[28463]: GetHistogram (offset 361) */
- "iiiip\0"
- "glGetHistogram\0"
- "glGetHistogramEXT\0"
- "\0"
- /* _mesa_function_pool[28503]: ActiveStencilFaceEXT (will be remapped) */
- "i\0"
- "glActiveStencilFaceEXT\0"
- "\0"
- /* _mesa_function_pool[28529]: StencilFuncSeparateATI (will be remapped) */
- "iiii\0"
- "glStencilFuncSeparateATI\0"
- "\0"
- /* _mesa_function_pool[28560]: Materialf (offset 169) */
- "iif\0"
- "glMaterialf\0"
- "\0"
- /* _mesa_function_pool[28577]: GetShaderSourceARB (will be remapped) */
- "iipp\0"
- "glGetShaderSource\0"
- "glGetShaderSourceARB\0"
- "\0"
- /* _mesa_function_pool[28622]: IglooInterfaceSGIX (dynamic) */
- "ip\0"
- "glIglooInterfaceSGIX\0"
- "\0"
- /* _mesa_function_pool[28647]: Materiali (offset 171) */
- "iii\0"
- "glMateriali\0"
- "\0"
- /* _mesa_function_pool[28664]: VertexAttrib4dNV (will be remapped) */
- "idddd\0"
- "glVertexAttrib4dNV\0"
- "\0"
- /* _mesa_function_pool[28690]: MultiModeDrawElementsIBM (will be remapped) */
- "ppipii\0"
- "glMultiModeDrawElementsIBM\0"
- "\0"
- /* _mesa_function_pool[28725]: Indexsv (offset 51) */
- "p\0"
- "glIndexsv\0"
- "\0"
- /* _mesa_function_pool[28738]: MultiTexCoord4svARB (offset 407) */
- "ip\0"
- "glMultiTexCoord4sv\0"
- "glMultiTexCoord4svARB\0"
- "\0"
- /* _mesa_function_pool[28783]: LightModelfv (offset 164) */
- "ip\0"
- "glLightModelfv\0"
- "\0"
- /* _mesa_function_pool[28802]: TexCoord2dv (offset 103) */
- "p\0"
- "glTexCoord2dv\0"
- "\0"
- /* _mesa_function_pool[28819]: GenQueriesARB (will be remapped) */
- "ip\0"
- "glGenQueries\0"
- "glGenQueriesARB\0"
- "\0"
- /* _mesa_function_pool[28852]: EvalCoord1dv (offset 229) */
- "p\0"
- "glEvalCoord1dv\0"
- "\0"
- /* _mesa_function_pool[28870]: ReplacementCodeuiVertex3fSUN (dynamic) */
- "ifff\0"
- "glReplacementCodeuiVertex3fSUN\0"
- "\0"
- /* _mesa_function_pool[28907]: Translated (offset 303) */
- "ddd\0"
- "glTranslated\0"
- "\0"
- /* _mesa_function_pool[28925]: Translatef (offset 304) */
- "fff\0"
- "glTranslatef\0"
- "\0"
- /* _mesa_function_pool[28943]: Uniform3uiEXT (will be remapped) */
- "iiii\0"
- "glUniform3uiEXT\0"
- "glUniform3ui\0"
- "\0"
- /* _mesa_function_pool[28978]: StencilMask (offset 209) */
- "i\0"
- "glStencilMask\0"
- "\0"
- /* _mesa_function_pool[28995]: Tangent3iEXT (dynamic) */
- "iii\0"
- "glTangent3iEXT\0"
- "\0"
- /* _mesa_function_pool[29015]: GetLightiv (offset 265) */
- "iip\0"
- "glGetLightiv\0"
- "\0"
- /* _mesa_function_pool[29033]: DrawMeshArraysSUN (dynamic) */
- "iiii\0"
- "glDrawMeshArraysSUN\0"
- "\0"
- /* _mesa_function_pool[29059]: IsList (offset 287) */
- "i\0"
- "glIsList\0"
- "\0"
- /* _mesa_function_pool[29071]: IsSync (will be remapped) */
- "i\0"
- "glIsSync\0"
- "\0"
- /* _mesa_function_pool[29083]: RenderMode (offset 196) */
- "i\0"
- "glRenderMode\0"
- "\0"
- /* _mesa_function_pool[29099]: GetMapControlPointsNV (dynamic) */
- "iiiiiip\0"
- "glGetMapControlPointsNV\0"
- "\0"
- /* _mesa_function_pool[29132]: DrawBuffersARB (will be remapped) */
- "ip\0"
- "glDrawBuffers\0"
- "glDrawBuffersARB\0"
- "glDrawBuffersATI\0"
- "\0"
- /* _mesa_function_pool[29184]: ClearBufferiv (will be remapped) */
- "iip\0"
- "glClearBufferiv\0"
- "\0"
- /* _mesa_function_pool[29205]: ProgramLocalParameter4fARB (will be remapped) */
- "iiffff\0"
- "glProgramLocalParameter4fARB\0"
- "\0"
- /* _mesa_function_pool[29242]: SpriteParameterivSGIX (dynamic) */
- "ip\0"
- "glSpriteParameterivSGIX\0"
- "\0"
- /* _mesa_function_pool[29270]: ProvokingVertexEXT (will be remapped) */
- "i\0"
- "glProvokingVertexEXT\0"
- "glProvokingVertex\0"
- "\0"
- /* _mesa_function_pool[29312]: MultiTexCoord1fARB (offset 378) */
- "if\0"
- "glMultiTexCoord1f\0"
- "glMultiTexCoord1fARB\0"
- "\0"
- /* _mesa_function_pool[29355]: LoadName (offset 198) */
- "i\0"
- "glLoadName\0"
- "\0"
- /* _mesa_function_pool[29369]: VertexAttribs4ubvNV (will be remapped) */
- "iip\0"
- "glVertexAttribs4ubvNV\0"
- "\0"
- /* _mesa_function_pool[29396]: WeightsvARB (dynamic) */
- "ip\0"
- "glWeightsvARB\0"
- "\0"
- /* _mesa_function_pool[29414]: Uniform1fvARB (will be remapped) */
- "iip\0"
- "glUniform1fv\0"
- "glUniform1fvARB\0"
- "\0"
- /* _mesa_function_pool[29448]: CopyTexSubImage1D (offset 325) */
- "iiiiii\0"
- "glCopyTexSubImage1D\0"
- "glCopyTexSubImage1DEXT\0"
- "\0"
- /* _mesa_function_pool[29499]: CullFace (offset 152) */
- "i\0"
- "glCullFace\0"
- "\0"
- /* _mesa_function_pool[29513]: BindTexture (offset 307) */
- "ii\0"
- "glBindTexture\0"
- "glBindTextureEXT\0"
- "\0"
- /* _mesa_function_pool[29548]: BeginFragmentShaderATI (will be remapped) */
- "\0"
- "glBeginFragmentShaderATI\0"
- "\0"
- /* _mesa_function_pool[29575]: MultiTexCoord4fARB (offset 402) */
- "iffff\0"
- "glMultiTexCoord4f\0"
- "glMultiTexCoord4fARB\0"
- "\0"
- /* _mesa_function_pool[29621]: VertexAttribs3svNV (will be remapped) */
- "iip\0"
- "glVertexAttribs3svNV\0"
- "\0"
- /* _mesa_function_pool[29647]: StencilFunc (offset 243) */
- "iii\0"
- "glStencilFunc\0"
- "\0"
- /* _mesa_function_pool[29666]: CopyPixels (offset 255) */
- "iiiii\0"
- "glCopyPixels\0"
- "\0"
- /* _mesa_function_pool[29686]: Rectsv (offset 93) */
- "pp\0"
- "glRectsv\0"
- "\0"
- /* _mesa_function_pool[29699]: ReplacementCodeuivSUN (dynamic) */
- "p\0"
- "glReplacementCodeuivSUN\0"
- "\0"
- /* _mesa_function_pool[29726]: EnableVertexAttribArrayARB (will be remapped) */
- "i\0"
- "glEnableVertexAttribArray\0"
- "glEnableVertexAttribArrayARB\0"
- "\0"
- /* _mesa_function_pool[29784]: NormalPointervINTEL (dynamic) */
- "ip\0"
- "glNormalPointervINTEL\0"
- "\0"
- /* _mesa_function_pool[29810]: CopyConvolutionFilter2D (offset 355) */
- "iiiiii\0"
- "glCopyConvolutionFilter2D\0"
- "glCopyConvolutionFilter2DEXT\0"
- "\0"
- /* _mesa_function_pool[29873]: WindowPos3ivMESA (will be remapped) */
- "p\0"
- "glWindowPos3iv\0"
- "glWindowPos3ivARB\0"
- "glWindowPos3ivMESA\0"
- "\0"
- /* _mesa_function_pool[29928]: CopyBufferSubData (will be remapped) */
- "iiiii\0"
- "glCopyBufferSubData\0"
- "\0"
- /* _mesa_function_pool[29955]: NormalPointer (offset 318) */
- "iip\0"
- "glNormalPointer\0"
- "\0"
- /* _mesa_function_pool[29976]: TexParameterfv (offset 179) */
- "iip\0"
- "glTexParameterfv\0"
- "\0"
- /* _mesa_function_pool[29998]: IsBufferARB (will be remapped) */
- "i\0"
- "glIsBuffer\0"
- "glIsBufferARB\0"
- "\0"
- /* _mesa_function_pool[30026]: WindowPos4iMESA (will be remapped) */
- "iiii\0"
- "glWindowPos4iMESA\0"
- "\0"
- /* _mesa_function_pool[30050]: VertexAttrib4uivARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4uiv\0"
- "glVertexAttrib4uivARB\0"
- "\0"
- /* _mesa_function_pool[30095]: Tangent3bvEXT (dynamic) */
- "p\0"
- "glTangent3bvEXT\0"
- "\0"
- /* _mesa_function_pool[30114]: VertexAttribI3uivEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI3uivEXT\0"
- "glVertexAttribI3uiv\0"
- "\0"
- /* _mesa_function_pool[30161]: UniformMatrix3x4fv (will be remapped) */
- "iiip\0"
- "glUniformMatrix3x4fv\0"
- "\0"
- /* _mesa_function_pool[30188]: ClipPlane (offset 150) */
- "ip\0"
- "glClipPlane\0"
- "\0"
- /* _mesa_function_pool[30204]: Recti (offset 90) */
- "iiii\0"
- "glRecti\0"
- "\0"
- /* _mesa_function_pool[30218]: VertexAttribI3ivEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI3ivEXT\0"
- "glVertexAttribI3iv\0"
- "\0"
- /* _mesa_function_pool[30263]: DrawRangeElementsBaseVertex (will be remapped) */
- "iiiiipi\0"
- "glDrawRangeElementsBaseVertex\0"
- "\0"
- /* _mesa_function_pool[30302]: TexCoordPointervINTEL (dynamic) */
- "iip\0"
- "glTexCoordPointervINTEL\0"
- "\0"
- /* _mesa_function_pool[30331]: DeleteBuffersARB (will be remapped) */
- "ip\0"
- "glDeleteBuffers\0"
- "glDeleteBuffersARB\0"
- "\0"
- /* _mesa_function_pool[30370]: PixelTransformParameterfvEXT (dynamic) */
- "iip\0"
- "glPixelTransformParameterfvEXT\0"
- "\0"
- /* _mesa_function_pool[30406]: PrimitiveRestartNV (will be remapped) */
- "\0"
- "glPrimitiveRestartNV\0"
- "\0"
- /* _mesa_function_pool[30429]: WindowPos4fvMESA (will be remapped) */
- "p\0"
- "glWindowPos4fvMESA\0"
- "\0"
- /* _mesa_function_pool[30451]: GetPixelMapuiv (offset 272) */
- "ip\0"
- "glGetPixelMapuiv\0"
- "\0"
- /* _mesa_function_pool[30472]: Rectf (offset 88) */
- "ffff\0"
- "glRectf\0"
- "\0"
- /* _mesa_function_pool[30486]: VertexAttrib1sNV (will be remapped) */
- "ii\0"
- "glVertexAttrib1sNV\0"
- "\0"
- /* _mesa_function_pool[30509]: Indexfv (offset 47) */
- "p\0"
- "glIndexfv\0"
- "\0"
- /* _mesa_function_pool[30522]: SecondaryColor3svEXT (will be remapped) */
- "p\0"
- "glSecondaryColor3sv\0"
- "glSecondaryColor3svEXT\0"
- "\0"
- /* _mesa_function_pool[30568]: LoadTransposeMatrixfARB (will be remapped) */
- "p\0"
- "glLoadTransposeMatrixf\0"
- "glLoadTransposeMatrixfARB\0"
- "\0"
- /* _mesa_function_pool[30620]: GetPointerv (offset 329) */
- "ip\0"
- "glGetPointerv\0"
- "glGetPointervEXT\0"
- "\0"
- /* _mesa_function_pool[30655]: Tangent3bEXT (dynamic) */
- "iii\0"
- "glTangent3bEXT\0"
- "\0"
- /* _mesa_function_pool[30675]: CombinerParameterfNV (will be remapped) */
- "if\0"
- "glCombinerParameterfNV\0"
- "\0"
- /* _mesa_function_pool[30702]: IndexMask (offset 212) */
- "i\0"
- "glIndexMask\0"
- "\0"
- /* _mesa_function_pool[30717]: BindProgramNV (will be remapped) */
- "ii\0"
- "glBindProgramARB\0"
- "glBindProgramNV\0"
- "\0"
- /* _mesa_function_pool[30754]: VertexAttrib4svARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4sv\0"
- "glVertexAttrib4svARB\0"
- "\0"
- /* _mesa_function_pool[30797]: GetFloatv (offset 262) */
- "ip\0"
- "glGetFloatv\0"
- "\0"
- /* _mesa_function_pool[30813]: CreateDebugObjectMESA (dynamic) */
- "\0"
- "glCreateDebugObjectMESA\0"
- "\0"
- /* _mesa_function_pool[30839]: GetShaderiv (will be remapped) */
- "iip\0"
- "glGetShaderiv\0"
- "\0"
- /* _mesa_function_pool[30858]: ClientWaitSync (will be remapped) */
- "iii\0"
- "glClientWaitSync\0"
- "\0"
- /* _mesa_function_pool[30880]: TexCoord4s (offset 124) */
- "iiii\0"
- "glTexCoord4s\0"
- "\0"
- /* _mesa_function_pool[30899]: TexCoord3sv (offset 117) */
- "p\0"
- "glTexCoord3sv\0"
- "\0"
- /* _mesa_function_pool[30916]: BindFragmentShaderATI (will be remapped) */
- "i\0"
- "glBindFragmentShaderATI\0"
- "\0"
- /* _mesa_function_pool[30943]: PopAttrib (offset 218) */
- "\0"
- "glPopAttrib\0"
- "\0"
- /* _mesa_function_pool[30957]: Fogfv (offset 154) */
- "ip\0"
- "glFogfv\0"
- "\0"
- /* _mesa_function_pool[30969]: UnmapBufferARB (will be remapped) */
- "i\0"
- "glUnmapBuffer\0"
- "glUnmapBufferARB\0"
- "\0"
- /* _mesa_function_pool[31003]: InitNames (offset 197) */
- "\0"
- "glInitNames\0"
- "\0"
- /* _mesa_function_pool[31017]: Normal3sv (offset 61) */
- "p\0"
- "glNormal3sv\0"
- "\0"
- /* _mesa_function_pool[31032]: Minmax (offset 368) */
- "iii\0"
- "glMinmax\0"
- "glMinmaxEXT\0"
- "\0"
- /* _mesa_function_pool[31058]: TexCoord4d (offset 118) */
- "dddd\0"
- "glTexCoord4d\0"
- "\0"
- /* _mesa_function_pool[31077]: DeformationMap3dSGIX (dynamic) */
- "iddiiddiiddiip\0"
- "glDeformationMap3dSGIX\0"
- "\0"
- /* _mesa_function_pool[31116]: TexCoord4f (offset 120) */
- "ffff\0"
- "glTexCoord4f\0"
- "\0"
- /* _mesa_function_pool[31135]: FogCoorddvEXT (will be remapped) */
- "p\0"
- "glFogCoorddv\0"
- "glFogCoorddvEXT\0"
- "\0"
- /* _mesa_function_pool[31167]: FinishTextureSUNX (dynamic) */
- "\0"
- "glFinishTextureSUNX\0"
- "\0"
- /* _mesa_function_pool[31189]: GetFragmentLightfvSGIX (dynamic) */
- "iip\0"
- "glGetFragmentLightfvSGIX\0"
- "\0"
- /* _mesa_function_pool[31219]: Binormal3fvEXT (dynamic) */
- "p\0"
- "glBinormal3fvEXT\0"
- "\0"
- /* _mesa_function_pool[31239]: GetBooleanv (offset 258) */
- "ip\0"
- "glGetBooleanv\0"
- "\0"
- /* _mesa_function_pool[31257]: ColorFragmentOp3ATI (will be remapped) */
- "iiiiiiiiiiiii\0"
- "glColorFragmentOp3ATI\0"
- "\0"
- /* _mesa_function_pool[31294]: Hint (offset 158) */
- "ii\0"
- "glHint\0"
- "\0"
- /* _mesa_function_pool[31305]: Color4dv (offset 28) */
- "p\0"
- "glColor4dv\0"
- "\0"
- /* _mesa_function_pool[31319]: VertexAttrib2svARB (will be remapped) */
- "ip\0"
- "glVertexAttrib2sv\0"
- "glVertexAttrib2svARB\0"
- "\0"
- /* _mesa_function_pool[31362]: AreProgramsResidentNV (will be remapped) */
- "ipp\0"
- "glAreProgramsResidentNV\0"
- "\0"
- /* _mesa_function_pool[31391]: WindowPos3svMESA (will be remapped) */
- "p\0"
- "glWindowPos3sv\0"
- "glWindowPos3svARB\0"
- "glWindowPos3svMESA\0"
- "\0"
- /* _mesa_function_pool[31446]: CopyColorSubTable (offset 347) */
- "iiiii\0"
- "glCopyColorSubTable\0"
- "glCopyColorSubTableEXT\0"
- "\0"
- /* _mesa_function_pool[31496]: WeightdvARB (dynamic) */
- "ip\0"
- "glWeightdvARB\0"
- "\0"
- /* _mesa_function_pool[31514]: DeleteRenderbuffersEXT (will be remapped) */
- "ip\0"
- "glDeleteRenderbuffers\0"
- "glDeleteRenderbuffersEXT\0"
- "\0"
- /* _mesa_function_pool[31565]: VertexAttrib4NubvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib4Nubv\0"
- "glVertexAttrib4NubvARB\0"
- "\0"
- /* _mesa_function_pool[31612]: VertexAttrib3dvNV (will be remapped) */
- "ip\0"
- "glVertexAttrib3dvNV\0"
- "\0"
- /* _mesa_function_pool[31636]: GetObjectParameterfvARB (will be remapped) */
- "iip\0"
- "glGetObjectParameterfvARB\0"
- "\0"
- /* _mesa_function_pool[31667]: Vertex4iv (offset 147) */
- "p\0"
- "glVertex4iv\0"
- "\0"
- /* _mesa_function_pool[31682]: GetProgramEnvParameterdvARB (will be remapped) */
- "iip\0"
- "glGetProgramEnvParameterdvARB\0"
- "\0"
- /* _mesa_function_pool[31717]: TexCoord4dv (offset 119) */
- "p\0"
- "glTexCoord4dv\0"
- "\0"
- /* _mesa_function_pool[31734]: LockArraysEXT (will be remapped) */
- "ii\0"
- "glLockArraysEXT\0"
- "\0"
- /* _mesa_function_pool[31754]: Begin (offset 7) */
- "i\0"
- "glBegin\0"
- "\0"
- /* _mesa_function_pool[31765]: LightModeli (offset 165) */
- "ii\0"
- "glLightModeli\0"
- "\0"
- /* _mesa_function_pool[31783]: VertexAttribI4ivEXT (will be remapped) */
- "ip\0"
- "glVertexAttribI4ivEXT\0"
- "glVertexAttribI4iv\0"
- "\0"
- /* _mesa_function_pool[31828]: Rectfv (offset 89) */
- "pp\0"
- "glRectfv\0"
- "\0"
- /* _mesa_function_pool[31841]: LightModelf (offset 163) */
- "if\0"
- "glLightModelf\0"
- "\0"
- /* _mesa_function_pool[31859]: GetTexParameterfv (offset 282) */
- "iip\0"
- "glGetTexParameterfv\0"
- "\0"
- /* _mesa_function_pool[31884]: GetLightfv (offset 264) */
- "iip\0"
- "glGetLightfv\0"
- "\0"
- /* _mesa_function_pool[31902]: PixelTransformParameterivEXT (dynamic) */
- "iip\0"
- "glPixelTransformParameterivEXT\0"
- "\0"
- /* _mesa_function_pool[31938]: BinormalPointerEXT (dynamic) */
- "iip\0"
- "glBinormalPointerEXT\0"
- "\0"
- /* _mesa_function_pool[31964]: VertexAttrib1dNV (will be remapped) */
- "id\0"
- "glVertexAttrib1dNV\0"
- "\0"
- /* _mesa_function_pool[31987]: GetCombinerInputParameterivNV (will be remapped) */
- "iiiip\0"
- "glGetCombinerInputParameterivNV\0"
- "\0"
- /* _mesa_function_pool[32026]: Disable (offset 214) */
- "i\0"
- "glDisable\0"
- "\0"
- /* _mesa_function_pool[32039]: MultiTexCoord2fvARB (offset 387) */
- "ip\0"
- "glMultiTexCoord2fv\0"
- "glMultiTexCoord2fvARB\0"
- "\0"
- /* _mesa_function_pool[32084]: GetRenderbufferParameterivEXT (will be remapped) */
- "iip\0"
- "glGetRenderbufferParameteriv\0"
- "glGetRenderbufferParameterivEXT\0"
- "\0"
- /* _mesa_function_pool[32150]: CombinerParameterivNV (will be remapped) */
- "ip\0"
- "glCombinerParameterivNV\0"
- "\0"
- /* _mesa_function_pool[32178]: GenFragmentShadersATI (will be remapped) */
- "i\0"
- "glGenFragmentShadersATI\0"
- "\0"
- /* _mesa_function_pool[32205]: DrawArrays (offset 310) */
- "iii\0"
- "glDrawArrays\0"
- "glDrawArraysEXT\0"
- "\0"
- /* _mesa_function_pool[32239]: WeightuivARB (dynamic) */
- "ip\0"
- "glWeightuivARB\0"
- "\0"
- /* _mesa_function_pool[32258]: VertexAttrib2sARB (will be remapped) */
- "iii\0"
- "glVertexAttrib2s\0"
- "glVertexAttrib2sARB\0"
- "\0"
- /* _mesa_function_pool[32300]: ColorMask (offset 210) */
- "iiii\0"
- "glColorMask\0"
- "\0"
- /* _mesa_function_pool[32318]: GenAsyncMarkersSGIX (dynamic) */
- "i\0"
- "glGenAsyncMarkersSGIX\0"
- "\0"
- /* _mesa_function_pool[32343]: Tangent3svEXT (dynamic) */
- "p\0"
- "glTangent3svEXT\0"
- "\0"
- /* _mesa_function_pool[32362]: GetListParameterivSGIX (dynamic) */
- "iip\0"
- "glGetListParameterivSGIX\0"
- "\0"
- /* _mesa_function_pool[32392]: BindBufferARB (will be remapped) */
- "ii\0"
- "glBindBuffer\0"
- "glBindBufferARB\0"
- "\0"
- /* _mesa_function_pool[32425]: GetInfoLogARB (will be remapped) */
- "iipp\0"
- "glGetInfoLogARB\0"
- "\0"
- /* _mesa_function_pool[32447]: RasterPos4iv (offset 83) */
- "p\0"
- "glRasterPos4iv\0"
- "\0"
- /* _mesa_function_pool[32465]: Enable (offset 215) */
- "i\0"
- "glEnable\0"
- "\0"
- /* _mesa_function_pool[32477]: LineStipple (offset 167) */
- "ii\0"
- "glLineStipple\0"
- "\0"
- /* _mesa_function_pool[32495]: VertexAttribs4svNV (will be remapped) */
- "iip\0"
- "glVertexAttribs4svNV\0"
- "\0"
- /* _mesa_function_pool[32521]: EdgeFlagPointerListIBM (dynamic) */
- "ipi\0"
- "glEdgeFlagPointerListIBM\0"
- "\0"
- /* _mesa_function_pool[32551]: UniformMatrix3x2fv (will be remapped) */
- "iiip\0"
- "glUniformMatrix3x2fv\0"
- "\0"
- /* _mesa_function_pool[32578]: GetMinmaxParameterfv (offset 365) */
- "iip\0"
- "glGetMinmaxParameterfv\0"
- "glGetMinmaxParameterfvEXT\0"
- "\0"
- /* _mesa_function_pool[32632]: VertexAttrib1fvARB (will be remapped) */
- "ip\0"
- "glVertexAttrib1fv\0"
- "glVertexAttrib1fvARB\0"
- "\0"
- /* _mesa_function_pool[32675]: GenBuffersARB (will be remapped) */
- "ip\0"
- "glGenBuffers\0"
- "glGenBuffersARB\0"
- "\0"
- /* _mesa_function_pool[32708]: VertexAttribs1svNV (will be remapped) */
- "iip\0"
- "glVertexAttribs1svNV\0"
- "\0"
- /* _mesa_function_pool[32734]: Vertex3fv (offset 137) */
- "p\0"
- "glVertex3fv\0"
- "\0"
- /* _mesa_function_pool[32749]: GetTexBumpParameterivATI (will be remapped) */
- "ip\0"
- "glGetTexBumpParameterivATI\0"
- "\0"
- /* _mesa_function_pool[32780]: Binormal3bEXT (dynamic) */
- "iii\0"
- "glBinormal3bEXT\0"
- "\0"
- /* _mesa_function_pool[32801]: FragmentMaterialivSGIX (dynamic) */
- "iip\0"
- "glFragmentMaterialivSGIX\0"
- "\0"
- /* _mesa_function_pool[32831]: IsRenderbufferEXT (will be remapped) */
- "i\0"
- "glIsRenderbuffer\0"
- "glIsRenderbufferEXT\0"
- "\0"
- /* _mesa_function_pool[32871]: GenProgramsNV (will be remapped) */
- "ip\0"
- "glGenProgramsARB\0"
- "glGenProgramsNV\0"
- "\0"
- /* _mesa_function_pool[32908]: VertexAttrib4dvNV (will be remapped) */
- "ip\0"
- "glVertexAttrib4dvNV\0"
- "\0"
- /* _mesa_function_pool[32932]: EndFragmentShaderATI (will be remapped) */
- "\0"
- "glEndFragmentShaderATI\0"
- "\0"
- /* _mesa_function_pool[32957]: Binormal3iEXT (dynamic) */
- "iii\0"
- "glBinormal3iEXT\0"
- "\0"
- /* _mesa_function_pool[32978]: WindowPos2fMESA (will be remapped) */
- "ff\0"
- "glWindowPos2f\0"
- "glWindowPos2fARB\0"
- "glWindowPos2fMESA\0"
- "\0"
- ;
-
-/* these functions need to be remapped */
-static const struct gl_function_pool_remap MESA_remap_table_functions[] = {
- { 1577, AttachShader_remap_index },
- { 9902, CreateProgram_remap_index },
- { 22864, CreateShader_remap_index },
- { 25322, DeleteProgram_remap_index },
- { 18525, DeleteShader_remap_index },
- { 23336, DetachShader_remap_index },
- { 17928, GetAttachedShaders_remap_index },
- { 4869, GetProgramInfoLog_remap_index },
- { 405, GetProgramiv_remap_index },
- { 6542, GetShaderInfoLog_remap_index },
- { 30839, GetShaderiv_remap_index },
- { 13311, IsProgram_remap_index },
- { 12263, IsShader_remap_index },
- { 10006, StencilFuncSeparate_remap_index },
- { 3921, StencilMaskSeparate_remap_index },
- { 7624, StencilOpSeparate_remap_index },
- { 22152, UniformMatrix2x3fv_remap_index },
- { 2847, UniformMatrix2x4fv_remap_index },
- { 32551, UniformMatrix3x2fv_remap_index },
- { 30161, UniformMatrix3x4fv_remap_index },
- { 16226, UniformMatrix4x2fv_remap_index },
- { 3263, UniformMatrix4x3fv_remap_index },
- { 5030, ClampColor_remap_index },
- { 17982, ClearBufferfi_remap_index },
- { 17448, ClearBufferfv_remap_index },
- { 29184, ClearBufferiv_remap_index },
- { 13516, ClearBufferuiv_remap_index },
- { 19808, GetStringi_remap_index },
- { 2788, TexBuffer_remap_index },
- { 938, FramebufferTexture_remap_index },
- { 26315, GetBufferParameteri64v_remap_index },
- { 10106, GetInteger64i_v_remap_index },
- { 23178, VertexAttribDivisor_remap_index },
- { 9920, LoadTransposeMatrixdARB_remap_index },
- { 30568, LoadTransposeMatrixfARB_remap_index },
- { 5608, MultTransposeMatrixdARB_remap_index },
- { 23523, MultTransposeMatrixfARB_remap_index },
- { 216, SampleCoverageARB_remap_index },
- { 5834, CompressedTexImage1DARB_remap_index },
- { 24051, CompressedTexImage2DARB_remap_index },
- { 3984, CompressedTexImage3DARB_remap_index },
- { 18242, CompressedTexSubImage1DARB_remap_index },
- { 2050, CompressedTexSubImage2DARB_remap_index },
- { 20230, CompressedTexSubImage3DARB_remap_index },
- { 28340, GetCompressedTexImageARB_remap_index },
- { 3829, DisableVertexAttribArrayARB_remap_index },
- { 29726, EnableVertexAttribArrayARB_remap_index },
- { 31682, GetProgramEnvParameterdvARB_remap_index },
- { 23403, GetProgramEnvParameterfvARB_remap_index },
- { 27277, GetProgramLocalParameterdvARB_remap_index },
- { 8066, GetProgramLocalParameterfvARB_remap_index },
- { 18376, GetProgramStringARB_remap_index },
- { 27472, GetProgramivARB_remap_index },
- { 20425, GetVertexAttribdvARB_remap_index },
- { 16034, GetVertexAttribfvARB_remap_index },
- { 9765, GetVertexAttribivARB_remap_index },
- { 19289, ProgramEnvParameter4dARB_remap_index },
- { 25072, ProgramEnvParameter4dvARB_remap_index },
- { 16770, ProgramEnvParameter4fARB_remap_index },
- { 8965, ProgramEnvParameter4fvARB_remap_index },
- { 3947, ProgramLocalParameter4dARB_remap_index },
- { 13021, ProgramLocalParameter4dvARB_remap_index },
- { 29205, ProgramLocalParameter4fARB_remap_index },
- { 25675, ProgramLocalParameter4fvARB_remap_index },
- { 28094, ProgramStringARB_remap_index },
- { 19539, VertexAttrib1dARB_remap_index },
- { 15688, VertexAttrib1dvARB_remap_index },
- { 4122, VertexAttrib1fARB_remap_index },
- { 32632, VertexAttrib1fvARB_remap_index },
- { 7150, VertexAttrib1sARB_remap_index },
- { 2224, VertexAttrib1svARB_remap_index },
- { 15119, VertexAttrib2dARB_remap_index },
- { 17469, VertexAttrib2dvARB_remap_index },
- { 1596, VertexAttrib2fARB_remap_index },
- { 17582, VertexAttrib2fvARB_remap_index },
- { 32258, VertexAttrib2sARB_remap_index },
- { 31319, VertexAttrib2svARB_remap_index },
- { 11268, VertexAttrib3dARB_remap_index },
- { 8632, VertexAttrib3dvARB_remap_index },
- { 1683, VertexAttrib3fARB_remap_index },
- { 22415, VertexAttrib3fvARB_remap_index },
- { 27941, VertexAttrib3sARB_remap_index },
- { 20167, VertexAttrib3svARB_remap_index },
- { 4895, VertexAttrib4NbvARB_remap_index },
- { 17805, VertexAttrib4NivARB_remap_index },
- { 22370, VertexAttrib4NsvARB_remap_index },
- { 23355, VertexAttrib4NubARB_remap_index },
- { 31565, VertexAttrib4NubvARB_remap_index },
- { 18950, VertexAttrib4NuivARB_remap_index },
- { 3136, VertexAttrib4NusvARB_remap_index },
- { 10846, VertexAttrib4bvARB_remap_index },
- { 26685, VertexAttrib4dARB_remap_index },
- { 21189, VertexAttrib4dvARB_remap_index },
- { 11422, VertexAttrib4fARB_remap_index },
- { 11826, VertexAttrib4fvARB_remap_index },
- { 10222, VertexAttrib4ivARB_remap_index },
- { 17262, VertexAttrib4sARB_remap_index },
- { 30754, VertexAttrib4svARB_remap_index },
- { 16575, VertexAttrib4ubvARB_remap_index },
- { 30050, VertexAttrib4uivARB_remap_index },
- { 19978, VertexAttrib4usvARB_remap_index },
- { 21967, VertexAttribPointerARB_remap_index },
- { 32392, BindBufferARB_remap_index },
- { 6857, BufferDataARB_remap_index },
- { 1498, BufferSubDataARB_remap_index },
- { 30331, DeleteBuffersARB_remap_index },
- { 32675, GenBuffersARB_remap_index },
- { 17625, GetBufferParameterivARB_remap_index },
- { 16722, GetBufferPointervARB_remap_index },
- { 1451, GetBufferSubDataARB_remap_index },
- { 29998, IsBufferARB_remap_index },
- { 26159, MapBufferARB_remap_index },
- { 30969, UnmapBufferARB_remap_index },
- { 312, BeginQueryARB_remap_index },
- { 19634, DeleteQueriesARB_remap_index },
- { 12153, EndQueryARB_remap_index },
- { 28819, GenQueriesARB_remap_index },
- { 1942, GetQueryObjectivARB_remap_index },
- { 17306, GetQueryObjectuivARB_remap_index },
- { 1740, GetQueryivARB_remap_index },
- { 19885, IsQueryARB_remap_index },
- { 8242, AttachObjectARB_remap_index },
- { 18487, CompileShaderARB_remap_index },
- { 3205, CreateProgramObjectARB_remap_index },
- { 6802, CreateShaderObjectARB_remap_index },
- { 14454, DeleteObjectARB_remap_index },
- { 23842, DetachObjectARB_remap_index },
- { 11898, GetActiveUniformARB_remap_index },
- { 9440, GetAttachedObjectsARB_remap_index },
- { 9747, GetHandleARB_remap_index },
- { 32425, GetInfoLogARB_remap_index },
- { 31636, GetObjectParameterfvARB_remap_index },
- { 27151, GetObjectParameterivARB_remap_index },
- { 28577, GetShaderSourceARB_remap_index },
- { 27801, GetUniformLocationARB_remap_index },
- { 23625, GetUniformfvARB_remap_index },
- { 12596, GetUniformivARB_remap_index },
- { 20023, LinkProgramARB_remap_index },
- { 20081, ShaderSourceARB_remap_index },
- { 7524, Uniform1fARB_remap_index },
- { 29414, Uniform1fvARB_remap_index },
- { 21936, Uniform1iARB_remap_index },
- { 20878, Uniform1ivARB_remap_index },
- { 2173, Uniform2fARB_remap_index },
- { 14290, Uniform2fvARB_remap_index },
- { 26046, Uniform2iARB_remap_index },
- { 2293, Uniform2ivARB_remap_index },
- { 18597, Uniform3fARB_remap_index },
- { 9470, Uniform3fvARB_remap_index },
- { 6396, Uniform3iARB_remap_index },
- { 16828, Uniform3ivARB_remap_index },
- { 19095, Uniform4fARB_remap_index },
- { 23489, Uniform4fvARB_remap_index },
- { 24751, Uniform4iARB_remap_index },
- { 20391, Uniform4ivARB_remap_index },
- { 8294, UniformMatrix2fvARB_remap_index },
- { 17, UniformMatrix3fvARB_remap_index },
- { 2690, UniformMatrix4fvARB_remap_index },
- { 25184, UseProgramObjectARB_remap_index },
- { 14807, ValidateProgramARB_remap_index },
- { 21232, BindAttribLocationARB_remap_index },
- { 4940, GetActiveAttribARB_remap_index },
- { 16509, GetAttribLocationARB_remap_index },
- { 29132, DrawBuffersARB_remap_index },
- { 17850, DrawArraysInstancedARB_remap_index },
- { 6457, DrawElementsInstancedARB_remap_index },
- { 13126, RenderbufferStorageMultisample_remap_index },
- { 13597, FramebufferTextureARB_remap_index },
- { 25577, FramebufferTextureFaceARB_remap_index },
- { 23991, ProgramParameteriARB_remap_index },
- { 19143, FlushMappedBufferRange_remap_index },
- { 27568, MapBufferRange_remap_index },
- { 16337, BindVertexArray_remap_index },
- { 14630, GenVertexArrays_remap_index },
- { 29928, CopyBufferSubData_remap_index },
- { 30858, ClientWaitSync_remap_index },
- { 2609, DeleteSync_remap_index },
- { 7191, FenceSync_remap_index },
- { 15178, GetInteger64v_remap_index },
- { 22477, GetSynciv_remap_index },
- { 29071, IsSync_remap_index },
- { 9388, WaitSync_remap_index },
- { 3797, DrawElementsBaseVertex_remap_index },
- { 30263, DrawRangeElementsBaseVertex_remap_index },
- { 26190, MultiDrawElementsBaseVertex_remap_index },
- { 5091, BindTransformFeedback_remap_index },
- { 3232, DeleteTransformFeedbacks_remap_index },
- { 6429, DrawTransformFeedback_remap_index },
- { 9607, GenTransformFeedbacks_remap_index },
- { 27984, IsTransformFeedback_remap_index },
- { 25770, PauseTransformFeedback_remap_index },
- { 5528, ResumeTransformFeedback_remap_index },
- { 5396, PolygonOffsetEXT_remap_index },
- { 23099, GetPixelTexGenParameterfvSGIS_remap_index },
- { 4417, GetPixelTexGenParameterivSGIS_remap_index },
- { 22832, PixelTexGenParameterfSGIS_remap_index },
- { 624, PixelTexGenParameterfvSGIS_remap_index },
- { 12634, PixelTexGenParameteriSGIS_remap_index },
- { 13771, PixelTexGenParameterivSGIS_remap_index },
- { 16425, SampleMaskSGIS_remap_index },
- { 19825, SamplePatternSGIS_remap_index },
- { 26119, ColorPointerEXT_remap_index },
- { 17512, EdgeFlagPointerEXT_remap_index },
- { 6050, IndexPointerEXT_remap_index },
- { 6130, NormalPointerEXT_remap_index },
- { 15772, TexCoordPointerEXT_remap_index },
- { 6980, VertexPointerEXT_remap_index },
- { 3599, PointParameterfEXT_remap_index },
- { 7831, PointParameterfvEXT_remap_index },
- { 31734, LockArraysEXT_remap_index },
- { 14871, UnlockArraysEXT_remap_index },
- { 1267, SecondaryColor3bEXT_remap_index },
- { 7990, SecondaryColor3bvEXT_remap_index },
- { 10399, SecondaryColor3dEXT_remap_index },
- { 25380, SecondaryColor3dvEXT_remap_index },
- { 27850, SecondaryColor3fEXT_remap_index },
- { 18178, SecondaryColor3fvEXT_remap_index },
- { 470, SecondaryColor3iEXT_remap_index },
- { 16082, SecondaryColor3ivEXT_remap_index },
- { 10034, SecondaryColor3sEXT_remap_index },
- { 30522, SecondaryColor3svEXT_remap_index },
- { 26987, SecondaryColor3ubEXT_remap_index },
- { 21123, SecondaryColor3ubvEXT_remap_index },
- { 12876, SecondaryColor3uiEXT_remap_index },
- { 22719, SecondaryColor3uivEXT_remap_index },
- { 25627, SecondaryColor3usEXT_remap_index },
- { 12949, SecondaryColor3usvEXT_remap_index },
- { 11769, SecondaryColorPointerEXT_remap_index },
- { 25441, MultiDrawArraysEXT_remap_index },
- { 20813, MultiDrawElementsEXT_remap_index },
- { 21008, FogCoordPointerEXT_remap_index },
- { 4566, FogCoorddEXT_remap_index },
- { 31135, FogCoorddvEXT_remap_index },
- { 4683, FogCoordfEXT_remap_index },
- { 26910, FogCoordfvEXT_remap_index },
- { 19047, PixelTexGenSGIX_remap_index },
- { 27495, BlendFuncSeparateEXT_remap_index },
- { 6892, FlushVertexArrayRangeNV_remap_index },
- { 5345, VertexArrayRangeNV_remap_index },
- { 27915, CombinerInputNV_remap_index },
- { 2116, CombinerOutputNV_remap_index },
- { 30675, CombinerParameterfNV_remap_index },
- { 5219, CombinerParameterfvNV_remap_index },
- { 22201, CombinerParameteriNV_remap_index },
- { 32150, CombinerParameterivNV_remap_index },
- { 7268, FinalCombinerInputNV_remap_index },
- { 9813, GetCombinerInputParameterfvNV_remap_index },
- { 31987, GetCombinerInputParameterivNV_remap_index },
- { 13872, GetCombinerOutputParameterfvNV_remap_index },
- { 13700, GetCombinerOutputParameterivNV_remap_index },
- { 6637, GetFinalCombinerInputParameterfvNV_remap_index },
- { 24623, GetFinalCombinerInputParameterivNV_remap_index },
- { 12574, ResizeBuffersMESA_remap_index },
- { 11095, WindowPos2dMESA_remap_index },
- { 1060, WindowPos2dvMESA_remap_index },
- { 32978, WindowPos2fMESA_remap_index },
- { 7935, WindowPos2fvMESA_remap_index },
- { 18125, WindowPos2iMESA_remap_index },
- { 20298, WindowPos2ivMESA_remap_index },
- { 20912, WindowPos2sMESA_remap_index },
- { 5748, WindowPos2svMESA_remap_index },
- { 7760, WindowPos3dMESA_remap_index },
- { 14018, WindowPos3dvMESA_remap_index },
- { 516, WindowPos3fMESA_remap_index },
- { 14932, WindowPos3fvMESA_remap_index },
- { 23884, WindowPos3iMESA_remap_index },
- { 29873, WindowPos3ivMESA_remap_index },
- { 18742, WindowPos3sMESA_remap_index },
- { 31391, WindowPos3svMESA_remap_index },
- { 11046, WindowPos4dMESA_remap_index },
- { 16966, WindowPos4dvMESA_remap_index },
- { 13977, WindowPos4fMESA_remap_index },
- { 30429, WindowPos4fvMESA_remap_index },
- { 30026, WindowPos4iMESA_remap_index },
- { 12377, WindowPos4ivMESA_remap_index },
- { 18926, WindowPos4sMESA_remap_index },
- { 3183, WindowPos4svMESA_remap_index },
- { 13739, MultiModeDrawArraysIBM_remap_index },
- { 28690, MultiModeDrawElementsIBM_remap_index },
- { 12181, DeleteFencesNV_remap_index },
- { 27762, FinishFenceNV_remap_index },
- { 3721, GenFencesNV_remap_index },
- { 16946, GetFenceivNV_remap_index },
- { 8227, IsFenceNV_remap_index },
- { 13627, SetFenceNV_remap_index },
- { 4178, TestFenceNV_remap_index },
- { 31362, AreProgramsResidentNV_remap_index },
- { 30717, BindProgramNV_remap_index },
- { 25710, DeleteProgramsNV_remap_index },
- { 21341, ExecuteProgramNV_remap_index },
- { 32871, GenProgramsNV_remap_index },
- { 23204, GetProgramParameterdvNV_remap_index },
- { 10461, GetProgramParameterfvNV_remap_index },
- { 26093, GetProgramStringNV_remap_index },
- { 24261, GetProgramivNV_remap_index },
- { 23438, GetTrackMatrixivNV_remap_index },
- { 25887, GetVertexAttribPointervNV_remap_index },
- { 24556, GetVertexAttribdvNV_remap_index },
- { 9283, GetVertexAttribfvNV_remap_index },
- { 18349, GetVertexAttribivNV_remap_index },
- { 19173, IsProgramNV_remap_index },
- { 9366, LoadProgramNV_remap_index },
- { 27591, ProgramParameters4dvNV_remap_index },
- { 24191, ProgramParameters4fvNV_remap_index },
- { 20602, RequestResidentProgramsNV_remap_index },
- { 22179, TrackMatrixNV_remap_index },
- { 31964, VertexAttrib1dNV_remap_index },
- { 13538, VertexAttrib1dvNV_remap_index },
- { 28196, VertexAttrib1fNV_remap_index },
- { 2415, VertexAttrib1fvNV_remap_index },
- { 30486, VertexAttrib1sNV_remap_index },
- { 15005, VertexAttrib1svNV_remap_index },
- { 4845, VertexAttrib2dNV_remap_index },
- { 13431, VertexAttrib2dvNV_remap_index },
- { 20057, VertexAttrib2fNV_remap_index },
- { 12997, VertexAttrib2fvNV_remap_index },
- { 5960, VertexAttrib2sNV_remap_index },
- { 18796, VertexAttrib2svNV_remap_index },
- { 11243, VertexAttrib3dNV_remap_index },
- { 31612, VertexAttrib3dvNV_remap_index },
- { 10273, VertexAttrib3fNV_remap_index },
- { 24583, VertexAttrib3fvNV_remap_index },
- { 22022, VertexAttrib3sNV_remap_index },
- { 23465, VertexAttrib3svNV_remap_index },
- { 28664, VertexAttrib4dNV_remap_index },
- { 32908, VertexAttrib4dvNV_remap_index },
- { 4467, VertexAttrib4fNV_remap_index },
- { 9416, VertexAttrib4fvNV_remap_index },
- { 26569, VertexAttrib4sNV_remap_index },
- { 1409, VertexAttrib4svNV_remap_index },
- { 5003, VertexAttrib4ubNV_remap_index },
- { 778, VertexAttrib4ubvNV_remap_index },
- { 21521, VertexAttribPointerNV_remap_index },
- { 2267, VertexAttribs1dvNV_remap_index },
- { 25975, VertexAttribs1fvNV_remap_index },
- { 32708, VertexAttribs1svNV_remap_index },
- { 10298, VertexAttribs2dvNV_remap_index },
- { 25145, VertexAttribs2fvNV_remap_index },
- { 17538, VertexAttribs2svNV_remap_index },
- { 5247, VertexAttribs3dvNV_remap_index },
- { 2147, VertexAttribs3fvNV_remap_index },
- { 29621, VertexAttribs3svNV_remap_index },
- { 26659, VertexAttribs4dvNV_remap_index },
- { 5319, VertexAttribs4fvNV_remap_index },
- { 32495, VertexAttribs4svNV_remap_index },
- { 29369, VertexAttribs4ubvNV_remap_index },
- { 26729, GetTexBumpParameterfvATI_remap_index },
- { 32749, GetTexBumpParameterivATI_remap_index },
- { 18459, TexBumpParameterfvATI_remap_index },
- { 20473, TexBumpParameterivATI_remap_index },
- { 15551, AlphaFragmentOp1ATI_remap_index },
- { 10889, AlphaFragmentOp2ATI_remap_index },
- { 24499, AlphaFragmentOp3ATI_remap_index },
- { 29548, BeginFragmentShaderATI_remap_index },
- { 30916, BindFragmentShaderATI_remap_index },
- { 23594, ColorFragmentOp1ATI_remap_index },
- { 4345, ColorFragmentOp2ATI_remap_index },
- { 31257, ColorFragmentOp3ATI_remap_index },
- { 5485, DeleteFragmentShaderATI_remap_index },
- { 32932, EndFragmentShaderATI_remap_index },
- { 32178, GenFragmentShadersATI_remap_index },
- { 25299, PassTexCoordATI_remap_index },
- { 6960, SampleMapATI_remap_index },
- { 6733, SetFragmentShaderConstantATI_remap_index },
- { 363, PointParameteriNV_remap_index },
- { 14179, PointParameterivNV_remap_index },
- { 28503, ActiveStencilFaceEXT_remap_index },
- { 27251, BindVertexArrayAPPLE_remap_index },
- { 2737, DeleteVertexArraysAPPLE_remap_index },
- { 17955, GenVertexArraysAPPLE_remap_index },
- { 23269, IsVertexArrayAPPLE_remap_index },
- { 819, GetProgramNamedParameterdvNV_remap_index },
- { 3562, GetProgramNamedParameterfvNV_remap_index },
- { 26760, ProgramNamedParameter4dNV_remap_index },
- { 14505, ProgramNamedParameter4dvNV_remap_index },
- { 8899, ProgramNamedParameter4fNV_remap_index },
- { 11734, ProgramNamedParameter4fvNV_remap_index },
- { 16877, PrimitiveRestartIndexNV_remap_index },
- { 30406, PrimitiveRestartNV_remap_index },
- { 24170, DepthBoundsEXT_remap_index },
- { 1159, BlendEquationSeparateEXT_remap_index },
- { 14706, BindFramebufferEXT_remap_index },
- { 25486, BindRenderbufferEXT_remap_index },
- { 9663, CheckFramebufferStatusEXT_remap_index },
- { 22520, DeleteFramebuffersEXT_remap_index },
- { 31514, DeleteRenderbuffersEXT_remap_index },
- { 13455, FramebufferRenderbufferEXT_remap_index },
- { 13644, FramebufferTexture1DEXT_remap_index },
- { 11528, FramebufferTexture2DEXT_remap_index },
- { 11148, FramebufferTexture3DEXT_remap_index },
- { 23135, GenFramebuffersEXT_remap_index },
- { 17403, GenRenderbuffersEXT_remap_index },
- { 6679, GenerateMipmapEXT_remap_index },
- { 21597, GetFramebufferAttachmentParameterivEXT_remap_index },
- { 32084, GetRenderbufferParameterivEXT_remap_index },
- { 20353, IsFramebufferEXT_remap_index },
- { 32831, IsRenderbufferEXT_remap_index },
- { 8174, RenderbufferStorageEXT_remap_index },
- { 695, BlitFramebufferEXT_remap_index },
- { 14324, BufferParameteriAPPLE_remap_index },
- { 19205, FlushMappedBufferRangeAPPLE_remap_index },
- { 1815, BindFragDataLocationEXT_remap_index },
- { 24283, GetFragDataLocationEXT_remap_index },
- { 10576, GetUniformuivEXT_remap_index },
- { 2933, GetVertexAttribIivEXT_remap_index },
- { 4195, GetVertexAttribIuivEXT_remap_index },
- { 12014, Uniform1uiEXT_remap_index },
- { 27676, Uniform1uivEXT_remap_index },
- { 22118, Uniform2uiEXT_remap_index },
- { 4309, Uniform2uivEXT_remap_index },
- { 28943, Uniform3uiEXT_remap_index },
- { 14652, Uniform3uivEXT_remap_index },
- { 3486, Uniform4uiEXT_remap_index },
- { 8675, Uniform4uivEXT_remap_index },
- { 18306, VertexAttribI1iEXT_remap_index },
- { 965, VertexAttribI1ivEXT_remap_index },
- { 2516, VertexAttribI1uiEXT_remap_index },
- { 12725, VertexAttribI1uivEXT_remap_index },
- { 81, VertexAttribI2iEXT_remap_index },
- { 23706, VertexAttribI2ivEXT_remap_index },
- { 5273, VertexAttribI2uiEXT_remap_index },
- { 4728, VertexAttribI2uivEXT_remap_index },
- { 26361, VertexAttribI3iEXT_remap_index },
- { 30218, VertexAttribI3ivEXT_remap_index },
- { 3340, VertexAttribI3uiEXT_remap_index },
- { 30114, VertexAttribI3uivEXT_remap_index },
- { 21848, VertexAttribI4bvEXT_remap_index },
- { 14584, VertexAttribI4iEXT_remap_index },
- { 31783, VertexAttribI4ivEXT_remap_index },
- { 13358, VertexAttribI4svEXT_remap_index },
- { 16462, VertexAttribI4ubvEXT_remap_index },
- { 16145, VertexAttribI4uiEXT_remap_index },
- { 5419, VertexAttribI4uivEXT_remap_index },
- { 11311, VertexAttribI4usvEXT_remap_index },
- { 18403, VertexAttribIPointerEXT_remap_index },
- { 3027, FramebufferTextureLayerEXT_remap_index },
- { 5660, ColorMaskIndexedEXT_remap_index },
- { 18820, DisableIndexedEXT_remap_index },
- { 26406, EnableIndexedEXT_remap_index },
- { 21552, GetBooleanIndexedvEXT_remap_index },
- { 10922, GetIntegerIndexedvEXT_remap_index },
- { 22596, IsEnabledIndexedEXT_remap_index },
- { 22496, ClearColorIiEXT_remap_index },
- { 3436, ClearColorIuiEXT_remap_index },
- { 9852, GetTexParameterIivEXT_remap_index },
- { 5908, GetTexParameterIuivEXT_remap_index },
- { 2983, TexParameterIivEXT_remap_index },
- { 26228, TexParameterIuivEXT_remap_index },
- { 4596, BeginConditionalRenderNV_remap_index },
- { 25249, EndConditionalRenderNV_remap_index },
- { 9310, BeginTransformFeedbackEXT_remap_index },
- { 18855, BindBufferBaseEXT_remap_index },
- { 18714, BindBufferOffsetEXT_remap_index },
- { 12202, BindBufferRangeEXT_remap_index },
- { 14239, EndTransformFeedbackEXT_remap_index },
- { 10774, GetTransformFeedbackVaryingEXT_remap_index },
- { 20658, TransformFeedbackVaryingsEXT_remap_index },
- { 29270, ProvokingVertexEXT_remap_index },
- { 10722, GetTexParameterPointervAPPLE_remap_index },
- { 5047, TextureRangeAPPLE_remap_index },
- { 11600, GetObjectParameterivAPPLE_remap_index },
- { 19780, ObjectPurgeableAPPLE_remap_index },
- { 5702, ObjectUnpurgeableAPPLE_remap_index },
- { 17225, ActiveProgramEXT_remap_index },
- { 17196, CreateShaderProgramEXT_remap_index },
- { 28288, UseShaderProgramEXT_remap_index },
- { 28529, StencilFuncSeparateATI_remap_index },
- { 18044, ProgramEnvParameters4fvEXT_remap_index },
- { 17090, ProgramLocalParameters4fvEXT_remap_index },
- { 14107, GetQueryObjecti64vEXT_remap_index },
- { 10324, GetQueryObjectui64vEXT_remap_index },
- { 23663, EGLImageTargetRenderbufferStorageOES_remap_index },
- { 12120, EGLImageTargetTexture2DOES_remap_index },
- { -1, -1 }
-};
-
-/* these functions are in the ABI, but have alternative names */
-static const struct gl_function_remap MESA_alt_functions[] = {
- /* from GL_EXT_blend_color */
- { 2655, _gloffset_BlendColor },
- /* from GL_EXT_blend_minmax */
- { 11205, _gloffset_BlendEquation },
- /* from GL_EXT_color_subtable */
- { 16988, _gloffset_ColorSubTable },
- { 31446, _gloffset_CopyColorSubTable },
- /* from GL_EXT_convolution */
- { 257, _gloffset_ConvolutionFilter1D },
- { 2454, _gloffset_CopyConvolutionFilter1D },
- { 4058, _gloffset_GetConvolutionParameteriv },
- { 8523, _gloffset_ConvolutionFilter2D },
- { 8725, _gloffset_ConvolutionParameteriv },
- { 9185, _gloffset_ConvolutionParameterfv },
- { 20501, _gloffset_GetSeparableFilter },
- { 23938, _gloffset_SeparableFilter2D },
- { 24801, _gloffset_ConvolutionParameteri },
- { 24924, _gloffset_ConvolutionParameterf },
- { 26595, _gloffset_GetConvolutionParameterfv },
- { 27417, _gloffset_GetConvolutionFilter },
- { 29810, _gloffset_CopyConvolutionFilter2D },
- /* from GL_EXT_copy_texture */
- { 15065, _gloffset_CopyTexSubImage3D },
- { 16675, _gloffset_CopyTexImage2D },
- { 24409, _gloffset_CopyTexImage1D },
- { 27098, _gloffset_CopyTexSubImage2D },
- { 29448, _gloffset_CopyTexSubImage1D },
- /* from GL_EXT_draw_range_elements */
- { 9522, _gloffset_DrawRangeElements },
- /* from GL_EXT_histogram */
- { 856, _gloffset_Histogram },
- { 3522, _gloffset_ResetHistogram },
- { 9972, _gloffset_GetMinmax },
- { 15399, _gloffset_GetHistogramParameterfv },
- { 24334, _gloffset_GetMinmaxParameteriv },
- { 26485, _gloffset_ResetMinmax },
- { 27314, _gloffset_GetHistogramParameteriv },
- { 28463, _gloffset_GetHistogram },
- { 31032, _gloffset_Minmax },
- { 32578, _gloffset_GetMinmaxParameterfv },
- /* from GL_EXT_paletted_texture */
- { 8385, _gloffset_ColorTable },
- { 15245, _gloffset_GetColorTable },
- { 22882, _gloffset_GetColorTableParameterfv },
- { 24980, _gloffset_GetColorTableParameteriv },
- /* from GL_EXT_subtexture */
- { 7106, _gloffset_TexSubImage1D },
- { 10649, _gloffset_TexSubImage2D },
- /* from GL_EXT_texture3D */
- { 1774, _gloffset_TexImage3D },
- { 22651, _gloffset_TexSubImage3D },
- /* from GL_EXT_texture_object */
- { 3290, _gloffset_PrioritizeTextures },
- { 7555, _gloffset_AreTexturesResident },
- { 13562, _gloffset_GenTextures },
- { 15731, _gloffset_DeleteTextures },
- { 19486, _gloffset_IsTexture },
- { 29513, _gloffset_BindTexture },
- /* from GL_EXT_vertex_array */
- { 24110, _gloffset_ArrayElement },
- { 30620, _gloffset_GetPointerv },
- { 32205, _gloffset_DrawArrays },
- /* from GL_SGI_color_table */
- { 7673, _gloffset_ColorTableParameteriv },
- { 8385, _gloffset_ColorTable },
- { 15245, _gloffset_GetColorTable },
- { 15355, _gloffset_CopyColorTable },
- { 19347, _gloffset_ColorTableParameterfv },
- { 22882, _gloffset_GetColorTableParameterfv },
- { 24980, _gloffset_GetColorTableParameteriv },
- /* from GL_VERSION_1_3 */
- { 425, _gloffset_MultiTexCoord3sARB },
- { 657, _gloffset_ActiveTextureARB },
- { 4247, _gloffset_MultiTexCoord1fvARB },
- { 6155, _gloffset_MultiTexCoord3dARB },
- { 6200, _gloffset_MultiTexCoord2iARB },
- { 6324, _gloffset_MultiTexCoord2svARB },
- { 8341, _gloffset_MultiTexCoord2fARB },
- { 10354, _gloffset_MultiTexCoord3fvARB },
- { 10967, _gloffset_MultiTexCoord4sARB },
- { 11648, _gloffset_MultiTexCoord2dvARB },
- { 12063, _gloffset_MultiTexCoord1svARB },
- { 12435, _gloffset_MultiTexCoord3svARB },
- { 12496, _gloffset_MultiTexCoord4iARB },
- { 13266, _gloffset_MultiTexCoord3iARB },
- { 14136, _gloffset_MultiTexCoord1dARB },
- { 14353, _gloffset_MultiTexCoord3dvARB },
- { 15599, _gloffset_MultiTexCoord3ivARB },
- { 15644, _gloffset_MultiTexCoord2sARB },
- { 17045, _gloffset_MultiTexCoord4ivARB },
- { 18997, _gloffset_ClientActiveTextureARB },
- { 21297, _gloffset_MultiTexCoord2dARB },
- { 21717, _gloffset_MultiTexCoord4dvARB },
- { 22073, _gloffset_MultiTexCoord4fvARB },
- { 23023, _gloffset_MultiTexCoord3fARB },
- { 25531, _gloffset_MultiTexCoord4dARB },
- { 25797, _gloffset_MultiTexCoord1sARB },
- { 26001, _gloffset_MultiTexCoord1dvARB },
- { 26942, _gloffset_MultiTexCoord1ivARB },
- { 27035, _gloffset_MultiTexCoord2ivARB },
- { 27374, _gloffset_MultiTexCoord1iARB },
- { 28738, _gloffset_MultiTexCoord4svARB },
- { 29312, _gloffset_MultiTexCoord1fARB },
- { 29575, _gloffset_MultiTexCoord4fARB },
- { 32039, _gloffset_MultiTexCoord2fvARB },
- { -1, -1 }
-};
-
-#endif /* need_MESA_remap_table */
-
-#if defined(need_GL_3DFX_tbuffer)
-static const struct gl_function_remap GL_3DFX_tbuffer_functions[] = {
- { 9243, -1 }, /* TbufferMask3DFX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_APPLE_flush_buffer_range)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_APPLE_flush_buffer_range_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_APPLE_object_purgeable)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_APPLE_object_purgeable_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_APPLE_texture_range)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_APPLE_texture_range_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_APPLE_vertex_array_object)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_APPLE_vertex_array_object_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_copy_buffer)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_copy_buffer_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_draw_buffers)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_draw_buffers_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_draw_elements_base_vertex)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_draw_elements_base_vertex_functions[] = {
- { -1, -1 }
-};
-#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[] = {
- { -1, -1 }
-};
-#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[] = {
- { 12399, -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[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const struct gl_function_remap GL_ARB_matrix_palette_functions[] = {
- { 3773, -1 }, /* MatrixIndexusvARB */
- { 13087, -1 }, /* MatrixIndexuivARB */
- { 14475, -1 }, /* MatrixIndexPointerARB */
- { 19735, -1 }, /* CurrentPaletteMatrixARB */
- { 22767, -1 }, /* MatrixIndexubvARB */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_multisample)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_multisample_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_occlusion_query)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_occlusion_query_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_point_parameters)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_point_parameters_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_provoking_vertex)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_provoking_vertex_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_shader_objects_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_sync)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_sync_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_texture_compression)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_texture_compression_functions[] = {
- { -1, -1 }
-};
-#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[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_array_object)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_vertex_array_object_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const struct gl_function_remap GL_ARB_vertex_blend_functions[] = {
- { 2396, -1 }, /* WeightubvARB */
- { 6567, -1 }, /* WeightivARB */
- { 11070, -1 }, /* WeightPointerARB */
- { 13854, -1 }, /* WeightfvARB */
- { 17564, -1 }, /* WeightbvARB */
- { 20965, -1 }, /* WeightusvARB */
- { 23864, -1 }, /* VertexBlendARB */
- { 29396, -1 }, /* WeightsvARB */
- { 31496, -1 }, /* WeightdvARB */
- { 32239, -1 }, /* WeightuivARB */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_buffer_object)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_vertex_buffer_object_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_vertex_program_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_shader)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_vertex_shader_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ARB_window_pos)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ARB_window_pos_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ATI_blend_equation_separate)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ATI_blend_equation_separate_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ATI_draw_buffers)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ATI_draw_buffers_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ATI_envmap_bumpmap)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ATI_envmap_bumpmap_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ATI_fragment_shader_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_ATI_separate_stencil)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_ATI_separate_stencil_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_color)
-static const struct gl_function_remap GL_EXT_blend_color_functions[] = {
- { 2655, _gloffset_BlendColor },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_equation_separate)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_blend_equation_separate_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_func_separate)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_blend_func_separate_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_minmax)
-static const struct gl_function_remap GL_EXT_blend_minmax_functions[] = {
- { 11205, _gloffset_BlendEquation },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_color_subtable)
-static const struct gl_function_remap GL_EXT_color_subtable_functions[] = {
- { 16988, _gloffset_ColorSubTable },
- { 31446, _gloffset_CopyColorSubTable },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_compiled_vertex_array)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_compiled_vertex_array_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const struct gl_function_remap GL_EXT_convolution_functions[] = {
- { 257, _gloffset_ConvolutionFilter1D },
- { 2454, _gloffset_CopyConvolutionFilter1D },
- { 4058, _gloffset_GetConvolutionParameteriv },
- { 8523, _gloffset_ConvolutionFilter2D },
- { 8725, _gloffset_ConvolutionParameteriv },
- { 9185, _gloffset_ConvolutionParameterfv },
- { 20501, _gloffset_GetSeparableFilter },
- { 23938, _gloffset_SeparableFilter2D },
- { 24801, _gloffset_ConvolutionParameteri },
- { 24924, _gloffset_ConvolutionParameterf },
- { 26595, _gloffset_GetConvolutionParameterfv },
- { 27417, _gloffset_GetConvolutionFilter },
- { 29810, _gloffset_CopyConvolutionFilter2D },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = {
- { 10493, -1 }, /* TangentPointerEXT */
- { 12554, -1 }, /* Binormal3ivEXT */
- { 13219, -1 }, /* Tangent3sEXT */
- { 14540, -1 }, /* Tangent3fvEXT */
- { 18695, -1 }, /* Tangent3dvEXT */
- { 19433, -1 }, /* Binormal3bvEXT */
- { 20554, -1 }, /* Binormal3dEXT */
- { 22699, -1 }, /* Tangent3fEXT */
- { 24873, -1 }, /* Binormal3sEXT */
- { 25341, -1 }, /* Tangent3ivEXT */
- { 25360, -1 }, /* Tangent3dEXT */
- { 26274, -1 }, /* Binormal3svEXT */
- { 26840, -1 }, /* Binormal3fEXT */
- { 27728, -1 }, /* Binormal3dvEXT */
- { 28995, -1 }, /* Tangent3iEXT */
- { 30095, -1 }, /* Tangent3bvEXT */
- { 30655, -1 }, /* Tangent3bEXT */
- { 31219, -1 }, /* Binormal3fvEXT */
- { 31938, -1 }, /* BinormalPointerEXT */
- { 32343, -1 }, /* Tangent3svEXT */
- { 32780, -1 }, /* Binormal3bEXT */
- { 32957, -1 }, /* Binormal3iEXT */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const struct gl_function_remap GL_EXT_copy_texture_functions[] = {
- { 15065, _gloffset_CopyTexSubImage3D },
- { 16675, _gloffset_CopyTexImage2D },
- { 24409, _gloffset_CopyTexImage1D },
- { 27098, _gloffset_CopyTexSubImage2D },
- { 29448, _gloffset_CopyTexSubImage1D },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_cull_vertex)
-static const struct gl_function_remap GL_EXT_cull_vertex_functions[] = {
- { 8874, -1 }, /* CullParameterdvEXT */
- { 11693, -1 }, /* CullParameterfvEXT */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_depth_bounds_test)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_depth_bounds_test_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_draw_buffers2)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_draw_buffers2_functions[] = {
- { -1, -1 }
-};
-#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[] = {
- { 9522, _gloffset_DrawRangeElements },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_fog_coord)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_fog_coord_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_framebuffer_blit)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_framebuffer_blit_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_framebuffer_multisample)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_framebuffer_multisample_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_framebuffer_object_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_gpu_program_parameters)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_gpu_program_parameters_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_gpu_shader4)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_gpu_shader4_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const struct gl_function_remap GL_EXT_histogram_functions[] = {
- { 856, _gloffset_Histogram },
- { 3522, _gloffset_ResetHistogram },
- { 9972, _gloffset_GetMinmax },
- { 15399, _gloffset_GetHistogramParameterfv },
- { 24334, _gloffset_GetMinmaxParameteriv },
- { 26485, _gloffset_ResetMinmax },
- { 27314, _gloffset_GetHistogramParameteriv },
- { 28463, _gloffset_GetHistogram },
- { 31032, _gloffset_Minmax },
- { 32578, _gloffset_GetMinmaxParameterfv },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_index_func)
-static const struct gl_function_remap GL_EXT_index_func_functions[] = {
- { 11479, -1 }, /* IndexFuncEXT */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_index_material)
-static const struct gl_function_remap GL_EXT_index_material_functions[] = {
- { 21052, -1 }, /* IndexMaterialEXT */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_light_texture)
-static const struct gl_function_remap GL_EXT_light_texture_functions[] = {
- { 26294, -1 }, /* ApplyTextureEXT */
- { 26439, -1 }, /* TextureMaterialEXT */
- { 26464, -1 }, /* TextureLightEXT */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_multi_draw_arrays)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_multi_draw_arrays_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_multisample)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_multisample_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_paletted_texture)
-static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = {
- { 8385, _gloffset_ColorTable },
- { 15245, _gloffset_GetColorTable },
- { 22882, _gloffset_GetColorTableParameterfv },
- { 24980, _gloffset_GetColorTableParameteriv },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const struct gl_function_remap GL_EXT_pixel_transform_functions[] = {
- { 21682, -1 }, /* PixelTransformParameterfEXT */
- { 21762, -1 }, /* PixelTransformParameteriEXT */
- { 30370, -1 }, /* PixelTransformParameterfvEXT */
- { 31902, -1 }, /* PixelTransformParameterivEXT */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_point_parameters)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_point_parameters_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_polygon_offset)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_polygon_offset_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_provoking_vertex)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_provoking_vertex_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_secondary_color)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_secondary_color_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_separate_shader_objects)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_separate_shader_objects_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_stencil_two_side)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_stencil_two_side_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_subtexture)
-static const struct gl_function_remap GL_EXT_subtexture_functions[] = {
- { 7106, _gloffset_TexSubImage1D },
- { 10649, _gloffset_TexSubImage2D },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture3D)
-static const struct gl_function_remap GL_EXT_texture3D_functions[] = {
- { 1774, _gloffset_TexImage3D },
- { 22651, _gloffset_TexSubImage3D },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture_array)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_texture_array_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture_integer)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_texture_integer_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const struct gl_function_remap GL_EXT_texture_object_functions[] = {
- { 3290, _gloffset_PrioritizeTextures },
- { 7555, _gloffset_AreTexturesResident },
- { 13562, _gloffset_GenTextures },
- { 15731, _gloffset_DeleteTextures },
- { 19486, _gloffset_IsTexture },
- { 29513, _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[] = {
- { 13804, -1 }, /* TextureNormalEXT */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_timer_query)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_EXT_timer_query_functions[] = {
- { -1, -1 }
-};
-#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[] = {
- { 24110, _gloffset_ArrayElement },
- { 30620, _gloffset_GetPointerv },
- { 32205, _gloffset_DrawArrays },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_EXT_vertex_weighting)
-static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = {
- { 19516, -1 }, /* VertexWeightfvEXT */
- { 26818, -1 }, /* VertexWeightfEXT */
- { 28432, -1 }, /* VertexWeightPointerEXT */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const struct gl_function_remap GL_HP_image_transform_functions[] = {
- { 2327, -1 }, /* GetImageTransformParameterfvHP */
- { 3739, -1 }, /* ImageTransformParameterfHP */
- { 10187, -1 }, /* ImageTransformParameterfvHP */
- { 11948, -1 }, /* ImageTransformParameteriHP */
- { 12289, -1 }, /* GetImageTransformParameterivHP */
- { 19580, -1 }, /* ImageTransformParameterivHP */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_IBM_multimode_draw_arrays)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_IBM_multimode_draw_arrays_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const struct gl_function_remap GL_IBM_vertex_array_lists_functions[] = {
- { 4379, -1 }, /* SecondaryColorPointerListIBM */
- { 6021, -1 }, /* NormalPointerListIBM */
- { 7729, -1 }, /* FogCoordPointerListIBM */
- { 8036, -1 }, /* VertexPointerListIBM */
- { 11869, -1 }, /* ColorPointerListIBM */
- { 13326, -1 }, /* TexCoordPointerListIBM */
- { 13826, -1 }, /* IndexPointerListIBM */
- { 32521, -1 }, /* EdgeFlagPointerListIBM */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_INGR_blend_func_separate)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_INGR_blend_func_separate_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const struct gl_function_remap GL_INTEL_parallel_arrays_functions[] = {
- { 12666, -1 }, /* VertexPointervINTEL */
- { 15492, -1 }, /* ColorPointervINTEL */
- { 29784, -1 }, /* NormalPointervINTEL */
- { 30302, -1 }, /* TexCoordPointervINTEL */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_MESA_resize_buffers)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_MESA_resize_buffers_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_MESA_shader_debug)
-static const struct gl_function_remap GL_MESA_shader_debug_functions[] = {
- { 1638, -1 }, /* GetDebugLogLengthMESA */
- { 3461, -1 }, /* ClearDebugLogMESA */
- { 4540, -1 }, /* GetDebugLogMESA */
- { 30813, -1 }, /* CreateDebugObjectMESA */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_MESA_window_pos_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_NV_condtitional_render)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_NV_condtitional_render_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const struct gl_function_remap GL_NV_evaluators_functions[] = {
- { 6768, -1 }, /* GetMapAttribParameterivNV */
- { 8491, -1 }, /* MapControlPointsNV */
- { 8590, -1 }, /* MapParameterfvNV */
- { 10632, -1 }, /* EvalMapsNV */
- { 17162, -1 }, /* GetMapAttribParameterfvNV */
- { 17379, -1 }, /* MapParameterivNV */
- { 24724, -1 }, /* GetMapParameterivNV */
- { 25222, -1 }, /* GetMapParameterfvNV */
- { 29099, -1 }, /* GetMapControlPointsNV */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_NV_fence)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_NV_fence_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_NV_fragment_program_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_NV_point_sprite)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_NV_point_sprite_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_NV_primitive_restart)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_NV_primitive_restart_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_NV_register_combiners_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_NV_register_combiners2)
-static const struct gl_function_remap GL_NV_register_combiners2_functions[] = {
- { 15884, -1 }, /* CombinerStageParameterfvNV */
- { 16280, -1 }, /* GetCombinerStageParameterfvNV */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_NV_vertex_array_range)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_NV_vertex_array_range_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_NV_vertex_program_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_OES_EGL_image)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_OES_EGL_image_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_PGI_misc_hints)
-static const struct gl_function_remap GL_PGI_misc_hints_functions[] = {
- { 8711, -1 }, /* HintPGI */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIS_detail_texture)
-static const struct gl_function_remap GL_SGIS_detail_texture_functions[] = {
- { 16253, -1 }, /* GetDetailTexFuncSGIS */
- { 16620, -1 }, /* DetailTexFuncSGIS */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIS_fog_function)
-static const struct gl_function_remap GL_SGIS_fog_function_functions[] = {
- { 27080, -1 }, /* FogFuncSGIS */
- { 27781, -1 }, /* GetFogFuncSGIS */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIS_multisample)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_SGIS_multisample_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_SGIS_pixel_texture_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIS_point_parameters)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_SGIS_point_parameters_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIS_sharpen_texture)
-static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = {
- { 6829, -1 }, /* GetSharpenTexFuncSGIS */
- { 22047, -1 }, /* SharpenTexFuncSGIS */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIS_texture4D)
-static const struct gl_function_remap GL_SGIS_texture4D_functions[] = {
- { 1010, -1 }, /* TexImage4DSGIS */
- { 15800, -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[] = {
- { 15198, -1 }, /* TextureColorMaskSGIS */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIS_texture_filter4)
-static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = {
- { 7006, -1 }, /* GetTexFilterFuncSGIS */
- { 16399, -1 }, /* TexFilterFuncSGIS */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const struct gl_function_remap GL_SGIX_async_functions[] = {
- { 3387, -1 }, /* AsyncMarkerSGIX */
- { 4519, -1 }, /* FinishAsyncSGIX */
- { 5466, -1 }, /* PollAsyncSGIX */
- { 22228, -1 }, /* DeleteAsyncMarkersSGIX */
- { 22283, -1 }, /* IsAsyncMarkerSGIX */
- { 32318, -1 }, /* GenAsyncMarkersSGIX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_flush_raster)
-static const struct gl_function_remap GL_SGIX_flush_raster_functions[] = {
- { 7383, -1 }, /* FlushRasterSGIX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = {
- { 2625, -1 }, /* FragmentMaterialfvSGIX */
- { 5370, -1 }, /* FragmentLightiSGIX */
- { 8103, -1 }, /* FragmentMaterialfSGIX */
- { 8264, -1 }, /* GetFragmentLightivSGIX */
- { 9137, -1 }, /* FragmentLightModeliSGIX */
- { 10695, -1 }, /* FragmentLightivSGIX */
- { 11013, -1 }, /* GetFragmentMaterialivSGIX */
- { 16193, -1 }, /* GetFragmentMaterialfvSGIX */
- { 19403, -1 }, /* FragmentLightModelfSGIX */
- { 19703, -1 }, /* FragmentColorMaterialSGIX */
- { 20120, -1 }, /* FragmentMaterialiSGIX */
- { 21380, -1 }, /* LightEnviSGIX */
- { 22974, -1 }, /* FragmentLightModelfvSGIX */
- { 23309, -1 }, /* FragmentLightfvSGIX */
- { 28165, -1 }, /* FragmentLightModelivSGIX */
- { 28314, -1 }, /* FragmentLightfSGIX */
- { 31189, -1 }, /* GetFragmentLightfvSGIX */
- { 32801, -1 }, /* FragmentMaterialivSGIX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_framezoom)
-static const struct gl_function_remap GL_SGIX_framezoom_functions[] = {
- { 22306, -1 }, /* FrameZoomSGIX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_igloo_interface)
-static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = {
- { 28622, -1 }, /* IglooInterfaceSGIX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const struct gl_function_remap GL_SGIX_instruments_functions[] = {
- { 2805, -1 }, /* ReadInstrumentsSGIX */
- { 6585, -1 }, /* PollInstrumentsSGIX */
- { 10553, -1 }, /* GetInstrumentsSGIX */
- { 12924, -1 }, /* StartInstrumentsSGIX */
- { 15918, -1 }, /* StopInstrumentsSGIX */
- { 17777, -1 }, /* InstrumentsBufferSGIX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const struct gl_function_remap GL_SGIX_list_priority_functions[] = {
- { 1241, -1 }, /* ListParameterfSGIX */
- { 3089, -1 }, /* GetListParameterfvSGIX */
- { 17692, -1 }, /* ListParameteriSGIX */
- { 18645, -1 }, /* ListParameterfvSGIX */
- { 20786, -1 }, /* ListParameterivSGIX */
- { 32362, -1 }, /* GetListParameterivSGIX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_pixel_texture)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_SGIX_pixel_texture_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const struct gl_function_remap GL_SGIX_polynomial_ffd_functions[] = {
- { 3685, -1 }, /* LoadIdentityDeformationMapSGIX */
- { 16018, -1 }, /* DeformSGIX */
- { 24222, -1 }, /* DeformationMap3fSGIX */
- { 31077, -1 }, /* DeformationMap3dSGIX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_reference_plane)
-static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = {
- { 14749, -1 }, /* ReferencePlaneSGIX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const struct gl_function_remap GL_SGIX_sprite_functions[] = {
- { 9635, -1 }, /* SpriteParameterfvSGIX */
- { 20575, -1 }, /* SpriteParameteriSGIX */
- { 26519, -1 }, /* SpriteParameterfSGIX */
- { 29242, -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[] = {
- { 20634, -1 }, /* TagSampleBufferSGIX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const struct gl_function_remap GL_SGI_color_table_functions[] = {
- { 7673, _gloffset_ColorTableParameteriv },
- { 8385, _gloffset_ColorTable },
- { 15245, _gloffset_GetColorTable },
- { 15355, _gloffset_CopyColorTable },
- { 19347, _gloffset_ColorTableParameterfv },
- { 22882, _gloffset_GetColorTableParameterfv },
- { 24980, _gloffset_GetColorTableParameteriv },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SUNX_constant_data)
-static const struct gl_function_remap GL_SUNX_constant_data_functions[] = {
- { 31167, -1 }, /* FinishTextureSUNX */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const struct gl_function_remap GL_SUN_global_alpha_functions[] = {
- { 3408, -1 }, /* GlobalAlphaFactorubSUN */
- { 4818, -1 }, /* GlobalAlphaFactoriSUN */
- { 6610, -1 }, /* GlobalAlphaFactordSUN */
- { 9719, -1 }, /* GlobalAlphaFactoruiSUN */
- { 10144, -1 }, /* GlobalAlphaFactorbSUN */
- { 13239, -1 }, /* GlobalAlphaFactorfSUN */
- { 13403, -1 }, /* GlobalAlphaFactorusSUN */
- { 22569, -1 }, /* GlobalAlphaFactorsSUN */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SUN_mesh_array)
-static const struct gl_function_remap GL_SUN_mesh_array_functions[] = {
- { 29033, -1 }, /* DrawMeshArraysSUN */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const struct gl_function_remap GL_SUN_triangle_list_functions[] = {
- { 4493, -1 }, /* ReplacementCodeubSUN */
- { 6369, -1 }, /* ReplacementCodeubvSUN */
- { 19068, -1 }, /* ReplacementCodeusvSUN */
- { 19256, -1 }, /* ReplacementCodePointerSUN */
- { 21444, -1 }, /* ReplacementCodeuiSUN */
- { 22257, -1 }, /* ReplacementCodeusSUN */
- { 29699, -1 }, /* ReplacementCodeuivSUN */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const struct gl_function_remap GL_SUN_vertex_functions[] = {
- { 1115, -1 }, /* ReplacementCodeuiColor3fVertex3fvSUN */
- { 1313, -1 }, /* TexCoord4fColor4fNormal3fVertex4fvSUN */
- { 1539, -1 }, /* TexCoord2fColor4ubVertex3fvSUN */
- { 1869, -1 }, /* ReplacementCodeuiVertex3fvSUN */
- { 2003, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fvSUN */
- { 2561, -1 }, /* ReplacementCodeuiNormal3fVertex3fSUN */
- { 2874, -1 }, /* Color4ubVertex3fvSUN */
- { 4652, -1 }, /* Color4ubVertex3fSUN */
- { 4775, -1 }, /* TexCoord2fVertex3fSUN */
- { 5119, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */
- { 5570, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */
- { 6264, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */
- { 7061, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */
- { 7420, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */
- { 8132, -1 }, /* TexCoord2fNormal3fVertex3fSUN */
- { 8936, -1 }, /* Color3fVertex3fSUN */
- { 10080, -1 }, /* Color3fVertex3fvSUN */
- { 10518, -1 }, /* Color4fNormal3fVertex3fvSUN */
- { 11358, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */
- { 12787, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */
- { 14398, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */
- { 14891, -1 }, /* TexCoord2fColor3fVertex3fSUN */
- { 15943, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */
- { 16358, -1 }, /* Color4ubVertex2fvSUN */
- { 16645, -1 }, /* Normal3fVertex3fSUN */
- { 17718, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */
- { 18079, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */
- { 18897, -1 }, /* TexCoord2fVertex3fvSUN */
- { 19673, -1 }, /* Color4ubVertex2fSUN */
- { 19911, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */
- { 21893, -1 }, /* TexCoord2fColor4ubVertex3fSUN */
- { 22325, -1 }, /* Normal3fVertex3fvSUN */
- { 22791, -1 }, /* Color4fNormal3fVertex3fSUN */
- { 23771, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */
- { 25840, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */
- { 27196, -1 }, /* TexCoord4fVertex4fSUN */
- { 27622, -1 }, /* TexCoord2fColor3fVertex3fvSUN */
- { 28009, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */
- { 28136, -1 }, /* TexCoord4fVertex4fvSUN */
- { 28870, -1 }, /* ReplacementCodeuiVertex3fSUN */
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_VERSION_1_3_functions[] = {
- { 425, _gloffset_MultiTexCoord3sARB },
- { 657, _gloffset_ActiveTextureARB },
- { 4247, _gloffset_MultiTexCoord1fvARB },
- { 6155, _gloffset_MultiTexCoord3dARB },
- { 6200, _gloffset_MultiTexCoord2iARB },
- { 6324, _gloffset_MultiTexCoord2svARB },
- { 8341, _gloffset_MultiTexCoord2fARB },
- { 10354, _gloffset_MultiTexCoord3fvARB },
- { 10967, _gloffset_MultiTexCoord4sARB },
- { 11648, _gloffset_MultiTexCoord2dvARB },
- { 12063, _gloffset_MultiTexCoord1svARB },
- { 12435, _gloffset_MultiTexCoord3svARB },
- { 12496, _gloffset_MultiTexCoord4iARB },
- { 13266, _gloffset_MultiTexCoord3iARB },
- { 14136, _gloffset_MultiTexCoord1dARB },
- { 14353, _gloffset_MultiTexCoord3dvARB },
- { 15599, _gloffset_MultiTexCoord3ivARB },
- { 15644, _gloffset_MultiTexCoord2sARB },
- { 17045, _gloffset_MultiTexCoord4ivARB },
- { 18997, _gloffset_ClientActiveTextureARB },
- { 21297, _gloffset_MultiTexCoord2dARB },
- { 21717, _gloffset_MultiTexCoord4dvARB },
- { 22073, _gloffset_MultiTexCoord4fvARB },
- { 23023, _gloffset_MultiTexCoord3fARB },
- { 25531, _gloffset_MultiTexCoord4dARB },
- { 25797, _gloffset_MultiTexCoord1sARB },
- { 26001, _gloffset_MultiTexCoord1dvARB },
- { 26942, _gloffset_MultiTexCoord1ivARB },
- { 27035, _gloffset_MultiTexCoord2ivARB },
- { 27374, _gloffset_MultiTexCoord1iARB },
- { 28738, _gloffset_MultiTexCoord4svARB },
- { 29312, _gloffset_MultiTexCoord1fARB },
- { 29575, _gloffset_MultiTexCoord4fARB },
- { 32039, _gloffset_MultiTexCoord2fvARB },
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_VERSION_1_4)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_VERSION_1_4_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_VERSION_1_5)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_VERSION_1_5_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_VERSION_2_0_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_VERSION_2_1)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_VERSION_2_1_functions[] = {
- { -1, -1 }
-};
-#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
-
-#if defined(need_GL_VERSION_3_2)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_VERSION_3_2_functions[] = {
- { -1, -1 }
-};
-#endif
-
-#if defined(need_GL_VERSION_3_3)
-/* functions defined in MESA_remap_table_functions are excluded */
-static const struct gl_function_remap GL_VERSION_3_3_functions[] = {
- { -1, -1 }
-};
-#endif
-
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
deleted file mode 100644
index 3d1a8f8..0000000
--- a/src/mesa/main/renderbuffer.c
+++ /dev/null
@@ -1,2007 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * 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.
- */
-
-
-/**
- * Functions for allocating/managing renderbuffers.
- * Also, routines for reading/writing software-based renderbuffer data as
- * ubytes, ushorts, uints, etc.
- *
- * The 'alpha8' renderbuffer is interesting. It's used to add a software-based
- * alpha channel to RGB renderbuffers. This is done by wrapping the RGB
- * renderbuffer with the alpha renderbuffer. We can do this because of the
- * OO-nature of renderbuffers.
- *
- * Down the road we'll use this for run-time support of 8, 16 and 32-bit
- * color channels. For example, Mesa may use 32-bit/float color channels
- * internally (swrast) and use wrapper renderbuffers to convert 32-bit
- * values down to 16 or 8-bit values for whatever kind of framebuffer we have.
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "fbobject.h"
-#include "formats.h"
-#include "mtypes.h"
-#include "renderbuffer.h"
-
-
-/*
- * Routines for get/put values in common buffer formats follow.
- * Someday add support for arbitrary row stride to make them more
- * flexible.
- */
-
-/**********************************************************************
- * Functions for buffers of 1 X GLubyte values.
- * Typically stencil.
- */
-
-static void *
-get_pointer_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLint x, GLint y)
-{
- if (!rb->Data)
- return NULL;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- /* Can't assert rb->Format since these funcs may be used for serveral
- * different formats (GL_ALPHA8, GL_STENCIL_INDEX8, etc).
- */
- return (GLubyte *) rb->Data + y * rb->Width + x;
-}
-
-
-static void
-get_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, void *values)
-{
- const GLubyte *src = (const GLubyte *) rb->Data + y * rb->Width + x;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- memcpy(values, src, count * sizeof(GLubyte));
-}
-
-
-static void
-get_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- GLubyte *dst = (GLubyte *) values;
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- for (i = 0; i < count; i++) {
- const GLubyte *src = (GLubyte *) rb->Data + y[i] * rb->Width + x[i];
- dst[i] = *src;
- }
-}
-
-
-static void
-put_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- const GLubyte *src = (const GLubyte *) values;
- GLubyte *dst = (GLubyte *) rb->Data + y * rb->Width + x;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i] = src[i];
- }
- }
- }
- else {
- memcpy(dst, values, count * sizeof(GLubyte));
- }
-}
-
-
-static void
-put_mono_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *value, const GLubyte *mask)
-{
- const GLubyte val = *((const GLubyte *) value);
- GLubyte *dst = (GLubyte *) rb->Data + y * rb->Width + x;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i] = val;
- }
- }
- }
- else {
- GLuint i;
- for (i = 0; i < count; i++) {
- dst[i] = val;
- }
- }
-}
-
-
-static void
-put_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[],
- const void *values, const GLubyte *mask)
-{
- const GLubyte *src = (const GLubyte *) values;
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLubyte *dst = (GLubyte *) rb->Data + y[i] * rb->Width + x[i];
- *dst = src[i];
- }
- }
-}
-
-
-static void
-put_mono_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[],
- const void *value, const GLubyte *mask)
-{
- const GLubyte val = *((const GLubyte *) value);
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLubyte *dst = (GLubyte *) rb->Data + y[i] * rb->Width + x[i];
- *dst = val;
- }
- }
-}
-
-
-/**********************************************************************
- * Functions for buffers of 1 X GLushort values.
- * Typically depth/Z.
- */
-
-static void *
-get_pointer_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLint x, GLint y)
-{
- if (!rb->Data)
- return NULL;
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
- ASSERT(rb->Width > 0);
- return (GLushort *) rb->Data + y * rb->Width + x;
-}
-
-
-static void
-get_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, void *values)
-{
- const void *src = rb->GetPointer(ctx, rb, x, y);
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
- memcpy(values, src, count * sizeof(GLushort));
-}
-
-
-static void
-get_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- GLushort *dst = (GLushort *) values;
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
- for (i = 0; i < count; i++) {
- const GLushort *src = (GLushort *) rb->Data + y[i] * rb->Width + x[i];
- dst[i] = *src;
- }
-}
-
-
-static void
-put_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- const GLushort *src = (const GLushort *) values;
- GLushort *dst = (GLushort *) rb->Data + y * rb->Width + x;
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i] = src[i];
- }
- }
- }
- else {
- memcpy(dst, src, count * sizeof(GLushort));
- }
-}
-
-
-static void
-put_mono_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *value, const GLubyte *mask)
-{
- const GLushort val = *((const GLushort *) value);
- GLushort *dst = (GLushort *) rb->Data + y * rb->Width + x;
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i] = val;
- }
- }
- }
- else {
- GLuint i;
- for (i = 0; i < count; i++) {
- dst[i] = val;
- }
- }
-}
-
-
-static void
-put_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], const void *values,
- const GLubyte *mask)
-{
- const GLushort *src = (const GLushort *) values;
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLushort *dst = (GLushort *) rb->Data + y[i] * rb->Width + x[i];
- *dst = src[i];
- }
- }
-}
-
-
-static void
-put_mono_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, const GLint x[], const GLint y[],
- const void *value, const GLubyte *mask)
-{
- const GLushort val = *((const GLushort *) value);
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- GLushort *dst = (GLushort *) rb->Data + y[i] * rb->Width + x[i];
- *dst = val;
- }
- }
- }
- else {
- GLuint i;
- for (i = 0; i < count; i++) {
- GLushort *dst = (GLushort *) rb->Data + y[i] * rb->Width + x[i];
- *dst = val;
- }
- }
-}
-
-
-/**********************************************************************
- * Functions for buffers of 1 X GLuint values.
- * Typically depth/Z or color index.
- */
-
-static void *
-get_pointer_uint(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLint x, GLint y)
-{
- if (!rb->Data)
- return NULL;
- ASSERT(rb->DataType == GL_UNSIGNED_INT ||
- rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- return (GLuint *) rb->Data + y * rb->Width + x;
-}
-
-
-static void
-get_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, void *values)
-{
- const void *src = rb->GetPointer(ctx, rb, x, y);
- ASSERT(rb->DataType == GL_UNSIGNED_INT ||
- rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- memcpy(values, src, count * sizeof(GLuint));
-}
-
-
-static void
-get_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- GLuint *dst = (GLuint *) values;
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_INT ||
- rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- for (i = 0; i < count; i++) {
- const GLuint *src = (GLuint *) rb->Data + y[i] * rb->Width + x[i];
- dst[i] = *src;
- }
-}
-
-
-static void
-put_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- const GLuint *src = (const GLuint *) values;
- GLuint *dst = (GLuint *) rb->Data + y * rb->Width + x;
- ASSERT(rb->DataType == GL_UNSIGNED_INT ||
- rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i] = src[i];
- }
- }
- }
- else {
- memcpy(dst, src, count * sizeof(GLuint));
- }
-}
-
-
-static void
-put_mono_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *value, const GLubyte *mask)
-{
- const GLuint val = *((const GLuint *) value);
- GLuint *dst = (GLuint *) rb->Data + y * rb->Width + x;
- ASSERT(rb->DataType == GL_UNSIGNED_INT ||
- rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i] = val;
- }
- }
- }
- else {
- GLuint i;
- for (i = 0; i < count; i++) {
- dst[i] = val;
- }
- }
-}
-
-
-static void
-put_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], const void *values,
- const GLubyte *mask)
-{
- const GLuint *src = (const GLuint *) values;
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_INT ||
- rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLuint *dst = (GLuint *) rb->Data + y[i] * rb->Width + x[i];
- *dst = src[i];
- }
- }
-}
-
-
-static void
-put_mono_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], const void *value,
- const GLubyte *mask)
-{
- const GLuint val = *((const GLuint *) value);
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_INT ||
- rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLuint *dst = (GLuint *) rb->Data + y[i] * rb->Width + x[i];
- *dst = val;
- }
- }
-}
-
-
-/**********************************************************************
- * Functions for buffers of 3 X GLubyte (or GLbyte) values.
- * Typically color buffers.
- * NOTE: the incoming and outgoing colors are RGBA! We ignore incoming
- * alpha values and return 255 for outgoing alpha values.
- */
-
-static void *
-get_pointer_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLint x, GLint y)
-{
- ASSERT(rb->Format == MESA_FORMAT_RGB888);
- /* No direct access since this buffer is RGB but caller will be
- * treating it as if it were RGBA.
- */
- return NULL;
-}
-
-
-static void
-get_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, void *values)
-{
- const GLubyte *src = (const GLubyte *) rb->Data + 3 * (y * rb->Width + x);
- GLubyte *dst = (GLubyte *) values;
- GLuint i;
- ASSERT(rb->Format == MESA_FORMAT_RGB888);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- for (i = 0; i < count; i++) {
- dst[i * 4 + 0] = src[i * 3 + 0];
- dst[i * 4 + 1] = src[i * 3 + 1];
- dst[i * 4 + 2] = src[i * 3 + 2];
- dst[i * 4 + 3] = 255;
- }
-}
-
-
-static void
-get_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- GLubyte *dst = (GLubyte *) values;
- GLuint i;
- ASSERT(rb->Format == MESA_FORMAT_RGB888);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- for (i = 0; i < count; i++) {
- const GLubyte *src
- = (GLubyte *) rb->Data + 3 * (y[i] * rb->Width + x[i]);
- dst[i * 4 + 0] = src[0];
- dst[i * 4 + 1] = src[1];
- dst[i * 4 + 2] = src[2];
- dst[i * 4 + 3] = 255;
- }
-}
-
-
-static void
-put_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- /* note: incoming values are RGB+A! */
- const GLubyte *src = (const GLubyte *) values;
- GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x);
- GLuint i;
- ASSERT(rb->Format == MESA_FORMAT_RGB888);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i * 3 + 0] = src[i * 4 + 0];
- dst[i * 3 + 1] = src[i * 4 + 1];
- dst[i * 3 + 2] = src[i * 4 + 2];
- }
- }
-}
-
-
-static void
-put_row_rgb_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- /* note: incoming values are RGB+A! */
- const GLubyte *src = (const GLubyte *) values;
- GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x);
- GLuint i;
- ASSERT(rb->Format == MESA_FORMAT_RGB888);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i * 3 + 0] = src[i * 3 + 0];
- dst[i * 3 + 1] = src[i * 3 + 1];
- dst[i * 3 + 2] = src[i * 3 + 2];
- }
- }
-}
-
-
-static void
-put_mono_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *value, const GLubyte *mask)
-{
- /* note: incoming value is RGB+A! */
- const GLubyte val0 = ((const GLubyte *) value)[0];
- const GLubyte val1 = ((const GLubyte *) value)[1];
- const GLubyte val2 = ((const GLubyte *) value)[2];
- GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x);
- ASSERT(rb->Format == MESA_FORMAT_RGB888);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- if (!mask && val0 == val1 && val1 == val2) {
- /* optimized case */
- memset(dst, val0, 3 * count);
- }
- else {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i * 3 + 0] = val0;
- dst[i * 3 + 1] = val1;
- dst[i * 3 + 2] = val2;
- }
- }
- }
-}
-
-
-static void
-put_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], const void *values,
- const GLubyte *mask)
-{
- /* note: incoming values are RGB+A! */
- const GLubyte *src = (const GLubyte *) values;
- GLuint i;
- ASSERT(rb->Format == MESA_FORMAT_RGB888);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLubyte *dst = (GLubyte *) rb->Data + 3 * (y[i] * rb->Width + x[i]);
- dst[0] = src[i * 4 + 0];
- dst[1] = src[i * 4 + 1];
- dst[2] = src[i * 4 + 2];
- }
- }
-}
-
-
-static void
-put_mono_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, const GLint x[], const GLint y[],
- const void *value, const GLubyte *mask)
-{
- /* note: incoming value is RGB+A! */
- const GLubyte val0 = ((const GLubyte *) value)[0];
- const GLubyte val1 = ((const GLubyte *) value)[1];
- const GLubyte val2 = ((const GLubyte *) value)[2];
- GLuint i;
- ASSERT(rb->Format == MESA_FORMAT_RGB888);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLubyte *dst = (GLubyte *) rb->Data + 3 * (y[i] * rb->Width + x[i]);
- dst[0] = val0;
- dst[1] = val1;
- dst[2] = val2;
- }
- }
-}
-
-
-/**********************************************************************
- * Functions for buffers of 4 X GLubyte (or GLbyte) values.
- * Typically color buffers.
- */
-
-static void *
-get_pointer_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLint x, GLint y)
-{
- if (!rb->Data)
- return NULL;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
- return (GLubyte *) rb->Data + 4 * (y * rb->Width + x);
-}
-
-
-static void
-get_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, void *values)
-{
- const GLubyte *src = (const GLubyte *) rb->Data + 4 * (y * rb->Width + x);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
- memcpy(values, src, 4 * count * sizeof(GLubyte));
-}
-
-
-static void
-get_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- /* treat 4*GLubyte as 1*GLuint */
- GLuint *dst = (GLuint *) values;
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
- for (i = 0; i < count; i++) {
- const GLuint *src = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]);
- dst[i] = *src;
- }
-}
-
-
-static void
-put_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- /* treat 4*GLubyte as 1*GLuint */
- const GLuint *src = (const GLuint *) values;
- GLuint *dst = (GLuint *) rb->Data + (y * rb->Width + x);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i] = src[i];
- }
- }
- }
- else {
- memcpy(dst, src, 4 * count * sizeof(GLubyte));
- }
-}
-
-
-static void
-put_row_rgb_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- /* Store RGB values in RGBA buffer */
- const GLubyte *src = (const GLubyte *) values;
- GLubyte *dst = (GLubyte *) rb->Data + 4 * (y * rb->Width + x);
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i * 4 + 0] = src[i * 3 + 0];
- dst[i * 4 + 1] = src[i * 3 + 1];
- dst[i * 4 + 2] = src[i * 3 + 2];
- dst[i * 4 + 3] = 0xff;
- }
- }
-}
-
-
-static void
-put_mono_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *value, const GLubyte *mask)
-{
- /* treat 4*GLubyte as 1*GLuint */
- const GLuint val = *((const GLuint *) value);
- GLuint *dst = (GLuint *) rb->Data + (y * rb->Width + x);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
- if (!mask && val == 0) {
- /* common case */
- memset(dst, 0, count * 4 * sizeof(GLubyte));
- }
- else {
- /* general case */
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i] = val;
- }
- }
- }
- else {
- GLuint i;
- for (i = 0; i < count; i++) {
- dst[i] = val;
- }
- }
- }
-}
-
-
-static void
-put_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], const void *values,
- const GLubyte *mask)
-{
- /* treat 4*GLubyte as 1*GLuint */
- const GLuint *src = (const GLuint *) values;
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]);
- *dst = src[i];
- }
- }
-}
-
-
-static void
-put_mono_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, const GLint x[], const GLint y[],
- const void *value, const GLubyte *mask)
-{
- /* treat 4*GLubyte as 1*GLuint */
- const GLuint val = *((const GLuint *) value);
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]);
- *dst = val;
- }
- }
-}
-
-
-/**********************************************************************
- * Functions for buffers of 4 X GLushort (or GLshort) values.
- * Typically accum buffer.
- */
-
-static void *
-get_pointer_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLint x, GLint y)
-{
- if (!rb->Data)
- return NULL;
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
- return (GLushort *) rb->Data + 4 * (y * rb->Width + x);
-}
-
-
-static void
-get_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, void *values)
-{
- const GLshort *src = (const GLshort *) rb->Data + 4 * (y * rb->Width + x);
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
- memcpy(values, src, 4 * count * sizeof(GLshort));
-}
-
-
-static void
-get_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- GLushort *dst = (GLushort *) values;
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
- for (i = 0; i < count; i++) {
- const GLushort *src
- = (GLushort *) rb->Data + 4 * (y[i] * rb->Width + x[i]);
- dst[i] = *src;
- }
-}
-
-
-static void
-put_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- const GLushort *src = (const GLushort *) values;
- GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->Width + x);
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i * 4 + 0] = src[i * 4 + 0];
- dst[i * 4 + 1] = src[i * 4 + 1];
- dst[i * 4 + 2] = src[i * 4 + 2];
- dst[i * 4 + 3] = src[i * 4 + 3];
- }
- }
- }
- else {
- memcpy(dst, src, 4 * count * sizeof(GLushort));
- }
-}
-
-
-static void
-put_row_rgb_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- /* Put RGB values in RGBA buffer */
- const GLushort *src = (const GLushort *) values;
- GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->Width + x);
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i * 4 + 0] = src[i * 3 + 0];
- dst[i * 4 + 1] = src[i * 3 + 1];
- dst[i * 4 + 2] = src[i * 3 + 2];
- dst[i * 4 + 3] = 0xffff;
- }
- }
- }
- else {
- memcpy(dst, src, 4 * count * sizeof(GLushort));
- }
-}
-
-
-static void
-put_mono_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *value, const GLubyte *mask)
-{
- const GLushort val0 = ((const GLushort *) value)[0];
- const GLushort val1 = ((const GLushort *) value)[1];
- const GLushort val2 = ((const GLushort *) value)[2];
- const GLushort val3 = ((const GLushort *) value)[3];
- GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->Width + x);
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
- if (!mask && val0 == 0 && val1 == 0 && val2 == 0 && val3 == 0) {
- /* common case for clearing accum buffer */
- memset(dst, 0, count * 4 * sizeof(GLushort));
- }
- else {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i * 4 + 0] = val0;
- dst[i * 4 + 1] = val1;
- dst[i * 4 + 2] = val2;
- dst[i * 4 + 3] = val3;
- }
- }
- }
-}
-
-
-static void
-put_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], const void *values,
- const GLubyte *mask)
-{
- const GLushort *src = (const GLushort *) values;
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLushort *dst = (GLushort *) rb->Data + 4 * (y[i] * rb->Width + x[i]);
- dst[0] = src[i * 4 + 0];
- dst[1] = src[i * 4 + 1];
- dst[2] = src[i * 4 + 2];
- dst[3] = src[i * 4 + 3];
- }
- }
-}
-
-
-static void
-put_mono_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, const GLint x[], const GLint y[],
- const void *value, const GLubyte *mask)
-{
- const GLushort val0 = ((const GLushort *) value)[0];
- const GLushort val1 = ((const GLushort *) value)[1];
- const GLushort val2 = ((const GLushort *) value)[2];
- const GLushort val3 = ((const GLushort *) value)[3];
- GLuint i;
- ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLushort *dst = (GLushort *) rb->Data + 4 * (y[i] * rb->Width + x[i]);
- dst[0] = val0;
- dst[1] = val1;
- dst[2] = val2;
- dst[3] = val3;
- }
- }
-}
-
-
-
-/**
- * This is a software fallback for the gl_renderbuffer->AllocStorage
- * function.
- * Device drivers will typically override this function for the buffers
- * which it manages (typically color buffers, Z and stencil).
- * Other buffers (like software accumulation and aux buffers) which the driver
- * doesn't manage can be handled with this function.
- *
- * This one multi-purpose function can allocate stencil, depth, accum, color
- * or color-index buffers!
- *
- * This function also plugs in the appropriate GetPointer, Get/PutRow and
- * Get/PutValues functions.
- */
-GLboolean
-_mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat,
- GLuint width, GLuint height)
-{
- GLuint pixelSize;
-
- switch (internalFormat) {
- case GL_RGB:
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- rb->Format = MESA_FORMAT_RGB888;
- rb->DataType = GL_UNSIGNED_BYTE;
- rb->GetPointer = get_pointer_ubyte3;
- rb->GetRow = get_row_ubyte3;
- rb->GetValues = get_values_ubyte3;
- rb->PutRow = put_row_ubyte3;
- rb->PutRowRGB = put_row_rgb_ubyte3;
- rb->PutMonoRow = put_mono_row_ubyte3;
- rb->PutValues = put_values_ubyte3;
- rb->PutMonoValues = put_mono_values_ubyte3;
- pixelSize = 3 * sizeof(GLubyte);
- break;
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGBA8:
-#if 1
- case GL_RGB10_A2:
- case GL_RGBA12:
-#endif
- rb->Format = MESA_FORMAT_RGBA8888;
- rb->DataType = GL_UNSIGNED_BYTE;
- rb->GetPointer = get_pointer_ubyte4;
- rb->GetRow = get_row_ubyte4;
- rb->GetValues = get_values_ubyte4;
- rb->PutRow = put_row_ubyte4;
- rb->PutRowRGB = put_row_rgb_ubyte4;
- rb->PutMonoRow = put_mono_row_ubyte4;
- rb->PutValues = put_values_ubyte4;
- rb->PutMonoValues = put_mono_values_ubyte4;
- 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;
- rb->GetPointer = get_pointer_ushort4;
- rb->GetRow = get_row_ushort4;
- rb->GetValues = get_values_ushort4;
- rb->PutRow = put_row_ushort4;
- rb->PutRowRGB = put_row_rgb_ushort4;
- rb->PutMonoRow = put_mono_row_ushort4;
- rb->PutValues = put_values_ushort4;
- rb->PutMonoValues = put_mono_values_ushort4;
- pixelSize = 4 * sizeof(GLushort);
- break;
-#if 0
- case GL_ALPHA8:
- rb->Format = MESA_FORMAT_A8;
- rb->DataType = GL_UNSIGNED_BYTE;
- rb->GetPointer = get_pointer_alpha8;
- rb->GetRow = get_row_alpha8;
- rb->GetValues = get_values_alpha8;
- rb->PutRow = put_row_alpha8;
- rb->PutRowRGB = NULL;
- rb->PutMonoRow = put_mono_row_alpha8;
- rb->PutValues = put_values_alpha8;
- rb->PutMonoValues = put_mono_values_alpha8;
- pixelSize = sizeof(GLubyte);
- break;
-#endif
- case GL_STENCIL_INDEX:
- case GL_STENCIL_INDEX1_EXT:
- case GL_STENCIL_INDEX4_EXT:
- case GL_STENCIL_INDEX8_EXT:
- case GL_STENCIL_INDEX16_EXT:
- rb->Format = MESA_FORMAT_S8;
- 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;
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16:
- rb->Format = MESA_FORMAT_Z16;
- rb->DataType = GL_UNSIGNED_SHORT;
- rb->GetPointer = get_pointer_ushort;
- rb->GetRow = get_row_ushort;
- rb->GetValues = get_values_ushort;
- rb->PutRow = put_row_ushort;
- rb->PutRowRGB = NULL;
- rb->PutMonoRow = put_mono_row_ushort;
- rb->PutValues = put_values_ushort;
- rb->PutMonoValues = put_mono_values_ushort;
- pixelSize = sizeof(GLushort);
- break;
- case GL_DEPTH_COMPONENT24:
- rb->DataType = GL_UNSIGNED_INT;
- rb->GetPointer = get_pointer_uint;
- rb->GetRow = get_row_uint;
- rb->GetValues = get_values_uint;
- rb->PutRow = put_row_uint;
- rb->PutRowRGB = NULL;
- rb->PutMonoRow = put_mono_row_uint;
- rb->PutValues = put_values_uint;
- rb->PutMonoValues = put_mono_values_uint;
- rb->Format = MESA_FORMAT_X8_Z24;
- pixelSize = sizeof(GLuint);
- break;
- case GL_DEPTH_COMPONENT32:
- rb->DataType = GL_UNSIGNED_INT;
- rb->GetPointer = get_pointer_uint;
- rb->GetRow = get_row_uint;
- rb->GetValues = get_values_uint;
- rb->PutRow = put_row_uint;
- rb->PutRowRGB = NULL;
- rb->PutMonoRow = put_mono_row_uint;
- rb->PutValues = put_values_uint;
- rb->PutMonoValues = put_mono_values_uint;
- rb->Format = MESA_FORMAT_Z32;
- pixelSize = sizeof(GLuint);
- break;
- case GL_DEPTH_STENCIL_EXT:
- case GL_DEPTH24_STENCIL8_EXT:
- rb->Format = MESA_FORMAT_Z24_S8;
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
- rb->GetPointer = get_pointer_uint;
- rb->GetRow = get_row_uint;
- rb->GetValues = get_values_uint;
- rb->PutRow = put_row_uint;
- rb->PutRowRGB = NULL;
- rb->PutMonoRow = put_mono_row_uint;
- rb->PutValues = put_values_uint;
- rb->PutMonoValues = put_mono_values_uint;
- pixelSize = sizeof(GLuint);
- break;
- default:
- _mesa_problem(ctx, "Bad internalFormat in _mesa_soft_renderbuffer_storage");
- return GL_FALSE;
- }
-
- ASSERT(rb->DataType);
- ASSERT(rb->GetPointer);
- ASSERT(rb->GetRow);
- ASSERT(rb->GetValues);
- ASSERT(rb->PutRow);
- ASSERT(rb->PutMonoRow);
- ASSERT(rb->PutValues);
- ASSERT(rb->PutMonoValues);
-
- /* free old buffer storage */
- if (rb->Data) {
- free(rb->Data);
- rb->Data = NULL;
- }
-
- if (width > 0 && height > 0) {
- /* allocate new buffer storage */
- rb->Data = malloc(width * height * pixelSize);
-
- if (rb->Data == NULL) {
- rb->Width = 0;
- rb->Height = 0;
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "software renderbuffer allocation (%d x %d x %d)",
- width, height, pixelSize);
- return GL_FALSE;
- }
- }
-
- rb->Width = width;
- rb->Height = height;
- rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);
- ASSERT(rb->_BaseFormat);
-
- return GL_TRUE;
-}
-
-
-
-/**********************************************************************/
-/**********************************************************************/
-/**********************************************************************/
-
-
-/**
- * Here we utilize the gl_renderbuffer->Wrapper field to put an alpha
- * buffer wrapper around an existing RGB renderbuffer (hw or sw).
- *
- * When PutRow is called (for example), we store the alpha values in
- * this buffer, then pass on the PutRow call to the wrapped RGB
- * buffer.
- */
-
-
-static GLboolean
-alloc_storage_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb,
- GLenum internalFormat, GLuint width, GLuint height)
-{
- ASSERT(arb != arb->Wrapped);
- ASSERT(arb->Format == MESA_FORMAT_A8);
-
- /* first, pass the call to the wrapped RGB buffer */
- if (!arb->Wrapped->AllocStorage(ctx, arb->Wrapped, internalFormat,
- width, height)) {
- return GL_FALSE;
- }
-
- /* next, resize my alpha buffer */
- if (arb->Data) {
- free(arb->Data);
- }
-
- arb->Data = malloc(width * height * sizeof(GLubyte));
- if (arb->Data == NULL) {
- arb->Width = 0;
- arb->Height = 0;
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "software alpha buffer allocation");
- return GL_FALSE;
- }
-
- arb->Width = width;
- arb->Height = height;
-
- return GL_TRUE;
-}
-
-
-/**
- * Delete an alpha_renderbuffer object, as well as the wrapped RGB buffer.
- */
-static void
-delete_renderbuffer_alpha8(struct gl_renderbuffer *arb)
-{
- if (arb->Data) {
- free(arb->Data);
- }
- ASSERT(arb->Wrapped);
- ASSERT(arb != arb->Wrapped);
- arb->Wrapped->Delete(arb->Wrapped);
- arb->Wrapped = NULL;
- free(arb);
-}
-
-
-static void *
-get_pointer_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb,
- GLint x, GLint y)
-{
- return NULL; /* don't allow direct access! */
-}
-
-
-static void
-get_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
- GLint x, GLint y, void *values)
-{
- /* NOTE: 'values' is RGBA format! */
- const GLubyte *src = (const GLubyte *) arb->Data + y * arb->Width + x;
- GLubyte *dst = (GLubyte *) values;
- GLuint i;
- ASSERT(arb != arb->Wrapped);
- ASSERT(arb->DataType == GL_UNSIGNED_BYTE);
- /* first, pass the call to the wrapped RGB buffer */
- arb->Wrapped->GetRow(ctx, arb->Wrapped, count, x, y, values);
- /* second, fill in alpha values from this buffer! */
- for (i = 0; i < count; i++) {
- dst[i * 4 + 3] = src[i];
- }
-}
-
-
-static void
-get_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- GLubyte *dst = (GLubyte *) values;
- GLuint i;
- ASSERT(arb != arb->Wrapped);
- ASSERT(arb->DataType == GL_UNSIGNED_BYTE);
- /* first, pass the call to the wrapped RGB buffer */
- arb->Wrapped->GetValues(ctx, arb->Wrapped, count, x, y, values);
- /* second, fill in alpha values from this buffer! */
- for (i = 0; i < count; i++) {
- const GLubyte *src = (GLubyte *) arb->Data + y[i] * arb->Width + x[i];
- dst[i * 4 + 3] = *src;
- }
-}
-
-
-static void
-put_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- const GLubyte *src = (const GLubyte *) values;
- GLubyte *dst = (GLubyte *) arb->Data + y * arb->Width + x;
- GLuint i;
- ASSERT(arb != arb->Wrapped);
- ASSERT(arb->DataType == GL_UNSIGNED_BYTE);
- /* first, pass the call to the wrapped RGB buffer */
- arb->Wrapped->PutRow(ctx, arb->Wrapped, count, x, y, values, mask);
- /* second, store alpha in our buffer */
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i] = src[i * 4 + 3];
- }
- }
-}
-
-
-static void
-put_row_rgb_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- const GLubyte *src = (const GLubyte *) values;
- GLubyte *dst = (GLubyte *) arb->Data + y * arb->Width + x;
- GLuint i;
- ASSERT(arb != arb->Wrapped);
- ASSERT(arb->DataType == GL_UNSIGNED_BYTE);
- /* first, pass the call to the wrapped RGB buffer */
- arb->Wrapped->PutRowRGB(ctx, arb->Wrapped, count, x, y, values, mask);
- /* second, store alpha in our buffer */
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i] = src[i * 4 + 3];
- }
- }
-}
-
-
-static void
-put_mono_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
- GLint x, GLint y, const void *value, const GLubyte *mask)
-{
- const GLubyte val = ((const GLubyte *) value)[3];
- GLubyte *dst = (GLubyte *) arb->Data + y * arb->Width + x;
- ASSERT(arb != arb->Wrapped);
- ASSERT(arb->DataType == GL_UNSIGNED_BYTE);
- /* first, pass the call to the wrapped RGB buffer */
- arb->Wrapped->PutMonoRow(ctx, arb->Wrapped, count, x, y, value, mask);
- /* second, store alpha in our buffer */
- if (mask) {
- GLuint i;
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- dst[i] = val;
- }
- }
- }
- else {
- memset(dst, val, count);
- }
-}
-
-
-static void
-put_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
- const GLint x[], const GLint y[],
- const void *values, const GLubyte *mask)
-{
- const GLubyte *src = (const GLubyte *) values;
- GLuint i;
- ASSERT(arb != arb->Wrapped);
- ASSERT(arb->DataType == GL_UNSIGNED_BYTE);
- /* first, pass the call to the wrapped RGB buffer */
- arb->Wrapped->PutValues(ctx, arb->Wrapped, count, x, y, values, mask);
- /* second, store alpha in our buffer */
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLubyte *dst = (GLubyte *) arb->Data + y[i] * arb->Width + x[i];
- *dst = src[i * 4 + 3];
- }
- }
-}
-
-
-static void
-put_mono_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb,
- GLuint count, const GLint x[], const GLint y[],
- const void *value, const GLubyte *mask)
-{
- const GLubyte val = ((const GLubyte *) value)[3];
- GLuint i;
- ASSERT(arb != arb->Wrapped);
- ASSERT(arb->DataType == GL_UNSIGNED_BYTE);
- /* first, pass the call to the wrapped RGB buffer */
- arb->Wrapped->PutValues(ctx, arb->Wrapped, count, x, y, value, mask);
- /* second, store alpha in our buffer */
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLubyte *dst = (GLubyte *) arb->Data + y[i] * arb->Width + x[i];
- *dst = val;
- }
- }
-}
-
-
-static void
-copy_buffer_alpha8(struct gl_renderbuffer* dst, struct gl_renderbuffer* src)
-{
- ASSERT(dst->Format == MESA_FORMAT_A8);
- ASSERT(src->Format == MESA_FORMAT_A8);
- ASSERT(dst->Width == src->Width);
- ASSERT(dst->Height == src->Height);
-
- memcpy(dst->Data, src->Data, dst->Width * dst->Height * sizeof(GLubyte));
-}
-
-
-/**********************************************************************/
-/**********************************************************************/
-/**********************************************************************/
-
-
-/**
- * Default GetPointer routine. Always return NULL to indicate that
- * direct buffer access is not supported.
- */
-static void *
-nop_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
-{
- return NULL;
-}
-
-
-/**
- * Initialize the fields of a gl_renderbuffer to default values.
- */
-void
-_mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
-{
- _glthread_INIT_MUTEX(rb->Mutex);
-
- rb->Magic = RB_MAGIC;
- rb->ClassID = 0;
- rb->Name = name;
- rb->RefCount = 0;
- rb->Delete = _mesa_delete_renderbuffer;
-
- /* The rest of these should be set later by the caller of this function or
- * the AllocStorage method:
- */
- rb->AllocStorage = NULL;
-
- rb->Width = 0;
- rb->Height = 0;
- rb->InternalFormat = GL_NONE;
- rb->Format = MESA_FORMAT_NONE;
-
- rb->DataType = GL_NONE;
- rb->Data = NULL;
-
- /* Point back to ourself so that we don't have to check for Wrapped==NULL
- * all over the drivers.
- */
- rb->Wrapped = rb;
-
- rb->GetPointer = nop_get_pointer;
- rb->GetRow = NULL;
- rb->GetValues = NULL;
- rb->PutRow = NULL;
- rb->PutRowRGB = NULL;
- rb->PutMonoRow = NULL;
- rb->PutValues = NULL;
- rb->PutMonoValues = NULL;
-}
-
-
-/**
- * Allocate a new gl_renderbuffer object. This can be used for user-created
- * renderbuffers or window-system renderbuffers.
- */
-struct gl_renderbuffer *
-_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
-{
- struct gl_renderbuffer *rb = CALLOC_STRUCT(gl_renderbuffer);
- if (rb) {
- _mesa_init_renderbuffer(rb, name);
- }
- return rb;
-}
-
-
-/**
- * Delete a gl_framebuffer.
- * This is the default function for renderbuffer->Delete().
- */
-void
-_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
-{
- if (rb->Data) {
- free(rb->Data);
- }
- free(rb);
-}
-
-
-/**
- * Allocate a software-based renderbuffer. This is called via the
- * ctx->Driver.NewRenderbuffer() function when the user creates a new
- * renderbuffer.
- * This would not be used for hardware-based renderbuffers.
- */
-struct gl_renderbuffer *
-_mesa_new_soft_renderbuffer(struct gl_context *ctx, GLuint name)
-{
- struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, name);
- if (rb) {
- rb->AllocStorage = _mesa_soft_renderbuffer_storage;
- /* Normally, one would setup the PutRow, GetRow, etc functions here.
- * But we're doing that in the _mesa_soft_renderbuffer_storage() function
- * instead.
- */
- }
- return rb;
-}
-
-
-/**
- * Add software-based color renderbuffers to the given framebuffer.
- * This is a helper routine for device drivers when creating a
- * window system framebuffer (not a user-created render/framebuffer).
- * Once this function is called, you can basically forget about this
- * renderbuffer; core Mesa will handle all the buffer management and
- * rendering!
- */
-GLboolean
-_mesa_add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint rgbBits, GLuint alphaBits,
- GLboolean frontLeft, GLboolean backLeft,
- GLboolean frontRight, GLboolean backRight)
-{
- GLuint b;
-
- if (rgbBits > 16 || alphaBits > 16) {
- _mesa_problem(ctx,
- "Unsupported bit depth in _mesa_add_color_renderbuffers");
- return GL_FALSE;
- }
-
- assert(MAX_COLOR_ATTACHMENTS >= 4);
-
- for (b = BUFFER_FRONT_LEFT; b <= BUFFER_BACK_RIGHT; b++) {
- struct gl_renderbuffer *rb;
-
- if (b == BUFFER_FRONT_LEFT && !frontLeft)
- continue;
- else if (b == BUFFER_BACK_LEFT && !backLeft)
- continue;
- else if (b == BUFFER_FRONT_RIGHT && !frontRight)
- continue;
- else if (b == BUFFER_BACK_RIGHT && !backRight)
- continue;
-
- assert(fb->Attachment[b].Renderbuffer == NULL);
-
- rb = _mesa_new_renderbuffer(ctx, 0);
- if (!rb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating color buffer");
- return GL_FALSE;
- }
-
- if (rgbBits <= 8) {
- if (alphaBits)
- rb->Format = MESA_FORMAT_RGBA8888;
- else
- rb->Format = MESA_FORMAT_RGB888;
- }
- else {
- assert(rgbBits <= 16);
- rb->Format = MESA_FORMAT_NONE; /*XXX RGBA16;*/
- }
- rb->InternalFormat = GL_RGBA;
-
- rb->AllocStorage = _mesa_soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, b, rb);
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Add software-based alpha renderbuffers to the given framebuffer.
- * This is a helper routine for device drivers when creating a
- * window system framebuffer (not a user-created render/framebuffer).
- * Once this function is called, you can basically forget about this
- * renderbuffer; core Mesa will handle all the buffer management and
- * rendering!
- */
-GLboolean
-_mesa_add_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint alphaBits,
- GLboolean frontLeft, GLboolean backLeft,
- GLboolean frontRight, GLboolean backRight)
-{
- GLuint b;
-
- /* for window system framebuffers only! */
- assert(fb->Name == 0);
-
- if (alphaBits > 8) {
- _mesa_problem(ctx,
- "Unsupported bit depth in _mesa_add_alpha_renderbuffers");
- return GL_FALSE;
- }
-
- assert(MAX_COLOR_ATTACHMENTS >= 4);
-
- /* Wrap each of the RGB color buffers with an alpha renderbuffer.
- */
- for (b = BUFFER_FRONT_LEFT; b <= BUFFER_BACK_RIGHT; b++) {
- struct gl_renderbuffer *arb;
-
- if (b == BUFFER_FRONT_LEFT && !frontLeft)
- continue;
- else if (b == BUFFER_BACK_LEFT && !backLeft)
- continue;
- else if (b == BUFFER_FRONT_RIGHT && !frontRight)
- continue;
- else if (b == BUFFER_BACK_RIGHT && !backRight)
- continue;
-
- /* the RGB buffer to wrap must already exist!! */
- assert(fb->Attachment[b].Renderbuffer);
-
- /* only GLubyte supported for now */
- assert(fb->Attachment[b].Renderbuffer->DataType == GL_UNSIGNED_BYTE);
-
- /* allocate alpha renderbuffer */
- arb = _mesa_new_renderbuffer(ctx, 0);
- if (!arb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating alpha buffer");
- return GL_FALSE;
- }
-
- /* wrap the alpha renderbuffer around the RGB renderbuffer */
- arb->Wrapped = fb->Attachment[b].Renderbuffer;
-
- /* Set up my alphabuffer fields and plug in my functions.
- * The functions will put/get the alpha values from/to RGBA arrays
- * and then call the wrapped buffer's functions to handle the RGB
- * values.
- */
- arb->InternalFormat = arb->Wrapped->InternalFormat;
- arb->Format = MESA_FORMAT_A8;
- arb->DataType = arb->Wrapped->DataType;
- arb->AllocStorage = alloc_storage_alpha8;
- arb->Delete = delete_renderbuffer_alpha8;
- arb->GetPointer = get_pointer_alpha8;
- arb->GetRow = get_row_alpha8;
- arb->GetValues = get_values_alpha8;
- arb->PutRow = put_row_alpha8;
- arb->PutRowRGB = put_row_rgb_alpha8;
- arb->PutMonoRow = put_mono_row_alpha8;
- arb->PutValues = put_values_alpha8;
- arb->PutMonoValues = put_mono_values_alpha8;
-
- /* clear the pointer to avoid assertion/sanity check failure later */
- fb->Attachment[b].Renderbuffer = NULL;
-
- /* plug the alpha renderbuffer into the colorbuffer attachment */
- _mesa_add_renderbuffer(fb, b, arb);
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * For framebuffers that use a software alpha channel wrapper
- * created by _mesa_add_alpha_renderbuffer or _mesa_add_soft_renderbuffers,
- * copy the back buffer alpha channel into the front buffer alpha channel.
- */
-void
-_mesa_copy_soft_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb)
-{
- if (fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer &&
- fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer)
- copy_buffer_alpha8(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer,
- fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
-
-
- if (fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer &&
- fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer)
- copy_buffer_alpha8(fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer,
- fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer);
-}
-
-
-/**
- * Add a software-based depth renderbuffer to the given framebuffer.
- * This is a helper routine for device drivers when creating a
- * window system framebuffer (not a user-created render/framebuffer).
- * Once this function is called, you can basically forget about this
- * renderbuffer; core Mesa will handle all the buffer management and
- * rendering!
- */
-GLboolean
-_mesa_add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint depthBits)
-{
- struct gl_renderbuffer *rb;
-
- if (depthBits > 32) {
- _mesa_problem(ctx,
- "Unsupported depthBits in _mesa_add_depth_renderbuffer");
- return GL_FALSE;
- }
-
- assert(fb->Attachment[BUFFER_DEPTH].Renderbuffer == NULL);
-
- rb = _mesa_new_renderbuffer(ctx, 0);
- if (!rb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating depth buffer");
- return GL_FALSE;
- }
-
- if (depthBits <= 16) {
- rb->Format = MESA_FORMAT_Z16;
- rb->InternalFormat = GL_DEPTH_COMPONENT16;
- }
- else if (depthBits <= 24) {
- rb->Format = MESA_FORMAT_X8_Z24;
- rb->InternalFormat = GL_DEPTH_COMPONENT24;
- }
- else {
- rb->Format = MESA_FORMAT_Z32;
- rb->InternalFormat = GL_DEPTH_COMPONENT32;
- }
-
- rb->AllocStorage = _mesa_soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb);
-
- return GL_TRUE;
-}
-
-
-/**
- * Add a software-based stencil renderbuffer to the given framebuffer.
- * This is a helper routine for device drivers when creating a
- * window system framebuffer (not a user-created render/framebuffer).
- * Once this function is called, you can basically forget about this
- * renderbuffer; core Mesa will handle all the buffer management and
- * rendering!
- */
-GLboolean
-_mesa_add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint stencilBits)
-{
- struct gl_renderbuffer *rb;
-
- if (stencilBits > 16) {
- _mesa_problem(ctx,
- "Unsupported stencilBits in _mesa_add_stencil_renderbuffer");
- return GL_FALSE;
- }
-
- assert(fb->Attachment[BUFFER_STENCIL].Renderbuffer == NULL);
-
- rb = _mesa_new_renderbuffer(ctx, 0);
- if (!rb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating stencil buffer");
- return GL_FALSE;
- }
-
- assert(stencilBits <= 8);
- rb->Format = MESA_FORMAT_S8;
- rb->InternalFormat = GL_STENCIL_INDEX8;
-
- rb->AllocStorage = _mesa_soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb);
-
- return GL_TRUE;
-}
-
-
-/**
- * Add a software-based accumulation renderbuffer to the given framebuffer.
- * This is a helper routine for device drivers when creating a
- * window system framebuffer (not a user-created render/framebuffer).
- * Once this function is called, you can basically forget about this
- * renderbuffer; core Mesa will handle all the buffer management and
- * rendering!
- */
-GLboolean
-_mesa_add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint redBits, GLuint greenBits,
- GLuint blueBits, GLuint alphaBits)
-{
- struct gl_renderbuffer *rb;
-
- if (redBits > 16 || greenBits > 16 || blueBits > 16 || alphaBits > 16) {
- _mesa_problem(ctx,
- "Unsupported accumBits in _mesa_add_accum_renderbuffer");
- return GL_FALSE;
- }
-
- assert(fb->Attachment[BUFFER_ACCUM].Renderbuffer == NULL);
-
- rb = _mesa_new_renderbuffer(ctx, 0);
- if (!rb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating accum buffer");
- return GL_FALSE;
- }
-
- rb->Format = MESA_FORMAT_SIGNED_RGBA_16;
- rb->InternalFormat = GL_RGBA16_SNORM;
- rb->AllocStorage = _mesa_soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, BUFFER_ACCUM, rb);
-
- return GL_TRUE;
-}
-
-
-
-/**
- * Add a software-based aux renderbuffer to the given framebuffer.
- * This is a helper routine for device drivers when creating a
- * window system framebuffer (not a user-created render/framebuffer).
- * Once this function is called, you can basically forget about this
- * renderbuffer; core Mesa will handle all the buffer management and
- * rendering!
- *
- * NOTE: color-index aux buffers not supported.
- */
-GLboolean
-_mesa_add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint colorBits, GLuint numBuffers)
-{
- GLuint i;
-
- if (colorBits > 16) {
- _mesa_problem(ctx,
- "Unsupported accumBits in _mesa_add_aux_renderbuffers");
- return GL_FALSE;
- }
-
- assert(numBuffers <= MAX_AUX_BUFFERS);
-
- for (i = 0; i < numBuffers; i++) {
- struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, 0);
-
- assert(fb->Attachment[BUFFER_AUX0 + i].Renderbuffer == NULL);
-
- if (!rb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating aux buffer");
- return GL_FALSE;
- }
-
- assert (colorBits <= 8);
- rb->Format = MESA_FORMAT_RGBA8888;
- rb->InternalFormat = GL_RGBA;
-
- rb->AllocStorage = _mesa_soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, BUFFER_AUX0 + i, rb);
- }
- return GL_TRUE;
-}
-
-
-/**
- * Create/attach software-based renderbuffers to the given framebuffer.
- * This is a helper routine for device drivers. Drivers can just as well
- * call the individual _mesa_add_*_renderbuffer() routines directly.
- */
-void
-_mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
- GLboolean color,
- GLboolean depth,
- GLboolean stencil,
- GLboolean accum,
- GLboolean alpha,
- GLboolean aux)
-{
- GLboolean frontLeft = GL_TRUE;
- GLboolean backLeft = fb->Visual.doubleBufferMode;
- GLboolean frontRight = fb->Visual.stereoMode;
- GLboolean backRight = fb->Visual.stereoMode && fb->Visual.doubleBufferMode;
-
- if (color) {
- assert(fb->Visual.redBits == fb->Visual.greenBits);
- assert(fb->Visual.redBits == fb->Visual.blueBits);
- _mesa_add_color_renderbuffers(NULL, fb,
- fb->Visual.redBits,
- fb->Visual.alphaBits,
- frontLeft, backLeft,
- frontRight, backRight);
- }
-
- if (depth) {
- assert(fb->Visual.depthBits > 0);
- _mesa_add_depth_renderbuffer(NULL, fb, fb->Visual.depthBits);
- }
-
- if (stencil) {
- assert(fb->Visual.stencilBits > 0);
- _mesa_add_stencil_renderbuffer(NULL, fb, fb->Visual.stencilBits);
- }
-
- if (accum) {
- assert(fb->Visual.accumRedBits > 0);
- assert(fb->Visual.accumGreenBits > 0);
- assert(fb->Visual.accumBlueBits > 0);
- _mesa_add_accum_renderbuffer(NULL, fb,
- fb->Visual.accumRedBits,
- fb->Visual.accumGreenBits,
- fb->Visual.accumBlueBits,
- fb->Visual.accumAlphaBits);
- }
-
- if (aux) {
- assert(fb->Visual.numAuxBuffers > 0);
- _mesa_add_aux_renderbuffers(NULL, fb, fb->Visual.redBits,
- fb->Visual.numAuxBuffers);
- }
-
- if (alpha) {
- assert(fb->Visual.alphaBits > 0);
- _mesa_add_alpha_renderbuffers(NULL, fb, fb->Visual.alphaBits,
- frontLeft, backLeft,
- frontRight, backRight);
- }
-
-#if 0
- if (multisample) {
- /* maybe someday */
- }
-#endif
-}
-
-
-/**
- * Attach a renderbuffer to a framebuffer.
- */
-void
-_mesa_add_renderbuffer(struct gl_framebuffer *fb,
- GLuint bufferName, struct gl_renderbuffer *rb)
-{
- assert(fb);
- assert(rb);
- assert(bufferName < BUFFER_COUNT);
-
- /* There should be no previous renderbuffer on this attachment point,
- * with the exception of depth/stencil since the same renderbuffer may
- * be used for both.
- */
- assert(bufferName == BUFFER_DEPTH ||
- bufferName == BUFFER_STENCIL ||
- fb->Attachment[bufferName].Renderbuffer == NULL);
-
- /* winsys vs. user-created buffer cross check */
- if (fb->Name) {
- assert(rb->Name);
- }
- else {
- assert(!rb->Name);
- }
-
- fb->Attachment[bufferName].Type = GL_RENDERBUFFER_EXT;
- fb->Attachment[bufferName].Complete = GL_TRUE;
- _mesa_reference_renderbuffer(&fb->Attachment[bufferName].Renderbuffer, rb);
-}
-
-
-/**
- * Remove the named renderbuffer from the given framebuffer.
- */
-void
-_mesa_remove_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName)
-{
- struct gl_renderbuffer *rb;
-
- assert(bufferName < BUFFER_COUNT);
-
- rb = fb->Attachment[bufferName].Renderbuffer;
- if (!rb)
- return;
-
- _mesa_reference_renderbuffer(&rb, NULL);
-
- fb->Attachment[bufferName].Renderbuffer = NULL;
-}
-
-
-/**
- * Set *ptr to point to rb. If *ptr points to another renderbuffer,
- * dereference that buffer first. The new renderbuffer's refcount will
- * be incremented. The old renderbuffer's refcount will be decremented.
- */
-void
-_mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
- struct gl_renderbuffer *rb)
-{
- assert(ptr);
- if (*ptr == rb) {
- /* no change */
- return;
- }
-
- if (*ptr) {
- /* Unreference the old renderbuffer */
- GLboolean deleteFlag = GL_FALSE;
- struct gl_renderbuffer *oldRb = *ptr;
-
- assert(oldRb->Magic == RB_MAGIC);
- _glthread_LOCK_MUTEX(oldRb->Mutex);
- assert(oldRb->Magic == RB_MAGIC);
- ASSERT(oldRb->RefCount > 0);
- oldRb->RefCount--;
- /*printf("RB DECR %p (%d) to %d\n", (void*) oldRb, oldRb->Name, oldRb->RefCount);*/
- deleteFlag = (oldRb->RefCount == 0);
- _glthread_UNLOCK_MUTEX(oldRb->Mutex);
-
- if (deleteFlag) {
- oldRb->Magic = 0; /* now invalid memory! */
- oldRb->Delete(oldRb);
- }
-
- *ptr = NULL;
- }
- assert(!*ptr);
-
- if (rb) {
- assert(rb->Magic == RB_MAGIC);
- /* reference new renderbuffer */
- _glthread_LOCK_MUTEX(rb->Mutex);
- rb->RefCount++;
- /*printf("RB INCR %p (%d) to %d\n", (void*) rb, rb->Name, rb->RefCount);*/
- _glthread_UNLOCK_MUTEX(rb->Mutex);
- *ptr = rb;
- }
-}
-
-
-/**
- * Create a new combined depth/stencil renderbuffer for implementing
- * the GL_EXT_packed_depth_stencil extension.
- * \return new depth/stencil renderbuffer
- */
-struct gl_renderbuffer *
-_mesa_new_depthstencil_renderbuffer(struct gl_context *ctx, GLuint name)
-{
- struct gl_renderbuffer *dsrb;
-
- dsrb = _mesa_new_renderbuffer(ctx, name);
- if (!dsrb)
- return NULL;
-
- /* init fields not covered by _mesa_new_renderbuffer() */
- dsrb->InternalFormat = GL_DEPTH24_STENCIL8_EXT;
- dsrb->Format = MESA_FORMAT_Z24_S8;
- dsrb->AllocStorage = _mesa_soft_renderbuffer_storage;
-
- return dsrb;
-}
diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h
deleted file mode 100644
index 62e812f..0000000
--- a/src/mesa/main/renderbuffer.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.
- */
-
-
-#ifndef RENDERBUFFER_H
-#define RENDERBUFFER_H
-
-#include "glheader.h"
-
-struct gl_context;
-struct gl_framebuffer;
-struct gl_renderbuffer;
-
-extern void
-_mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name);
-
-extern struct gl_renderbuffer *
-_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name);
-
-extern void
-_mesa_delete_renderbuffer(struct gl_renderbuffer *rb);
-
-
-extern struct gl_renderbuffer *
-_mesa_new_soft_renderbuffer(struct gl_context *ctx, GLuint name);
-
-
-extern GLboolean
-_mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat,
- GLuint width, GLuint height);
-
-extern GLboolean
-_mesa_add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint rgbBits, GLuint alphaBits,
- GLboolean frontLeft, GLboolean backLeft,
- GLboolean frontRight, GLboolean backRight);
-
-extern GLboolean
-_mesa_add_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint alphaBits,
- GLboolean frontLeft, GLboolean backLeft,
- GLboolean frontRight, GLboolean backRight);
-
-extern void
-_mesa_copy_soft_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb);
-
-extern GLboolean
-_mesa_add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint depthBits);
-
-extern GLboolean
-_mesa_add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint stencilBits);
-
-
-extern GLboolean
-_mesa_add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint redBits, GLuint greenBits,
- GLuint blueBits, GLuint alphaBits);
-
-extern GLboolean
-_mesa_add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint bits, GLuint numBuffers);
-
-extern void
-_mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
- GLboolean color,
- GLboolean depth,
- GLboolean stencil,
- GLboolean accum,
- GLboolean alpha,
- GLboolean aux);
-
-extern void
-_mesa_add_renderbuffer(struct gl_framebuffer *fb,
- GLuint bufferName, struct gl_renderbuffer *rb);
-
-extern void
-_mesa_remove_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName);
-
-extern void
-_mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
- struct gl_renderbuffer *rb);
-
-extern struct gl_renderbuffer *
-_mesa_new_depthstencil_renderbuffer(struct gl_context *ctx, GLuint name);
-
-
-#endif /* RENDERBUFFER_H */
diff --git a/src/mesa/main/restart.c b/src/mesa/main/restart.c
deleted file mode 100644
index ff36649..0000000
--- a/src/mesa/main/restart.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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/src/mesa/main/restart.h b/src/mesa/main/restart.h
deleted file mode 100644
index 25f58f2..0000000
--- a/src/mesa/main/restart.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
deleted file mode 100644
index 4cf0bc2..0000000
--- a/src/mesa/main/scissor.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/scissor.h"
-
-
-/**
- * Called via glScissor
- */
-void GLAPIENTRY
-_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height);
-
- if (width < 0 || height < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" );
- return;
- }
-
- _mesa_set_scissor(ctx, x, y, width, height);
-}
-
-
-/**
- * Define the scissor box.
- *
- * \param x, y coordinates of the scissor box lower-left corner.
- * \param width width of the scissor box.
- * \param height height of the scissor box.
- *
- * \sa glScissor().
- *
- * Verifies the parameters and updates __struct gl_contextRec::Scissor. On a
- * change flushes the vertices and notifies the driver via
- * the dd_function_table::Scissor callback.
- */
-void
-_mesa_set_scissor(struct gl_context *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height)
-{
- if (x == ctx->Scissor.X &&
- y == ctx->Scissor.Y &&
- width == ctx->Scissor.Width &&
- height == ctx->Scissor.Height)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_SCISSOR);
- ctx->Scissor.X = x;
- ctx->Scissor.Y = y;
- ctx->Scissor.Width = width;
- ctx->Scissor.Height = height;
-
- if (ctx->Driver.Scissor)
- ctx->Driver.Scissor( ctx, x, y, width, height );
-}
-
-
-/**
- * Initialize the context's scissor state.
- * \param ctx the GL context.
- */
-void
-_mesa_init_scissor(struct gl_context *ctx)
-{
- /* Scissor group */
- ctx->Scissor.Enabled = GL_FALSE;
- ctx->Scissor.X = 0;
- ctx->Scissor.Y = 0;
- ctx->Scissor.Width = 0;
- ctx->Scissor.Height = 0;
-}
diff --git a/src/mesa/main/scissor.h b/src/mesa/main/scissor.h
deleted file mode 100644
index da9385e..0000000
--- a/src/mesa/main/scissor.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#ifndef SCISSOR_H
-#define SCISSOR_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-extern void GLAPIENTRY
-_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height );
-
-
-extern void
-_mesa_set_scissor(struct gl_context *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height);
-
-
-extern void
-_mesa_init_scissor(struct gl_context *ctx);
-
-
-#endif
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
deleted file mode 100644
index 96df58d..0000000
--- a/src/mesa/main/shaderapi.c
+++ /dev/null
@@ -1,1886 +0,0 @@
-/*
- * 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"
-#include <stdbool.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(struct gl_context *ctx)
-{
- /* Device drivers may override these to control what kind of instructions
- * are generated by the GLSL compiler.
- */
- struct gl_shader_compiler_options options;
- gl_shader_type sh;
-
- memset(&options, 0, sizeof(options));
- options.MaxUnrollIterations = 32;
-
- /* Default pragma settings */
- options.DefaultPragmas.Optimize = GL_TRUE;
-
- for (sh = 0; sh < MESA_SHADER_TYPES; ++sh)
- memcpy(&ctx->ShaderCompilerOptions[sh], &options, sizeof(options));
-
- ctx->Shader.Flags = get_shader_flags();
-}
-
-
-/**
- * Free the per-context shader-related state.
- */
-void
-_mesa_free_shader_state(struct gl_context *ctx)
-{
- _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentVertexProgram, NULL);
- _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentGeometryProgram,
- NULL);
- _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentFragmentProgram,
- NULL);
- _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, 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;
-}
-
-
-
-/**
- * Confirm that the a shader type is valid and supported by the implementation
- *
- * \param ctx Current GL context
- * \param type Shader target
- *
- */
-static bool
-validate_shader_target(const struct gl_context *ctx, GLenum type)
-{
- switch (type) {
-#if FEATURE_ARB_fragment_shader
- case GL_FRAGMENT_SHADER:
- return ctx->Extensions.ARB_fragment_shader;
-#endif
-#if FEATURE_ARB_vertex_shader
- case GL_VERTEX_SHADER:
- return ctx->Extensions.ARB_vertex_shader;
-#endif
-#if FEATURE_ARB_geometry_shader4
- case GL_GEOMETRY_SHADER_ARB:
- return ctx->Extensions.ARB_geometry_shader4;
-#endif
- default:
- return false;
- }
-}
-
-
-/**
- * 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(struct gl_context *ctx, GLuint name)
-{
- struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name);
- return shProg ? GL_TRUE : GL_FALSE;
-}
-
-
-static GLboolean
-is_shader(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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 void
-bind_frag_data_location(struct gl_context *ctx, GLuint program,
- GLuint colorNumber, const GLchar *name)
-{
- _mesa_problem(ctx, "bind_frag_data_location() not implemented yet");
-}
-
-
-static GLuint
-create_shader(struct gl_context *ctx, GLenum type)
-{
- struct gl_shader *sh;
- GLuint name;
-
- if (!validate_shader_target(ctx, type)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "CreateShader(type)");
- return 0;
- }
-
- name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
- sh = ctx->Driver.NewShader(ctx, name, type);
- _mesa_HashInsert(ctx->Shared->ShaderObjects, name, sh);
-
- return name;
-}
-
-
-static GLuint
-create_shader_program(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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 GLint
-get_frag_data_location(struct gl_context *ctx, GLuint program,
- const GLchar *name)
-{
- _mesa_problem(ctx, "get_frag_data_location() not implemented yet");
- return -1;
-}
-
-
-
-/**
- * glGetHandleARB() - return ID/name of currently bound shader program.
- */
-static GLuint
-get_handle(struct gl_context *ctx, GLenum pname)
-{
- if (pname == GL_PROGRAM_OBJECT_ARB) {
- if (ctx->Shader.ActiveProgram)
- return ctx->Shader.ActiveProgram->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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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.CurrentVertexProgram
- || shProg == ctx->Shader.CurrentGeometryProgram
- || shProg == ctx->Shader.CurrentFragmentProgram)) {
- _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 glUniform calls
- */
-void
-_mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
- const char *caller)
-{
- if ((shProg != NULL) && !shProg->LinkStatus) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(program %u not linked)", caller, shProg->Name);
- return;
- }
-
- if (ctx->Shader.ActiveProgram != shProg) {
- _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, shProg);
- }
-}
-
-/**
- */
-static bool
-use_shader_program(struct gl_context *ctx, GLenum type,
- struct gl_shader_program *shProg)
-{
- struct gl_shader_program **target;
-
- switch (type) {
-#if FEATURE_ARB_vertex_shader
- case GL_VERTEX_SHADER:
- target = &ctx->Shader.CurrentVertexProgram;
- if ((shProg == NULL)
- || (shProg->_LinkedShaders[MESA_SHADER_VERTEX] == NULL)) {
- shProg = NULL;
- }
- break;
-#endif
-#if FEATURE_ARB_geometry_shader4
- case GL_GEOMETRY_SHADER_ARB:
- target = &ctx->Shader.CurrentGeometryProgram;
- if ((shProg == NULL)
- || (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY] == NULL)) {
- shProg = NULL;
- }
- break;
-#endif
-#if FEATURE_ARB_fragment_shader
- case GL_FRAGMENT_SHADER:
- target = &ctx->Shader.CurrentFragmentProgram;
- if ((shProg == NULL)
- || (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL)) {
- shProg = NULL;
- }
- break;
-#endif
- default:
- return false;
- }
-
- if (*target != shProg) {
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
- _mesa_reference_shader_program(ctx, target, shProg);
- return true;
- }
-
- return false;
-}
-
-/**
- * Use the named shader program for subsequent rendering.
- */
-void
-_mesa_use_program(struct gl_context *ctx, struct gl_shader_program *shProg)
-{
- use_shader_program(ctx, GL_VERTEX_SHADER, shProg);
- use_shader_program(ctx, GL_GEOMETRY_SHADER_ARB, shProg);
- use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg);
- _mesa_active_program(ctx, shProg, "glUseProgram");
-
- 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(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] != (int) 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(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(&vp->Base, errMsg)) {
- return GL_FALSE;
- }
- if (fp && !validate_samplers(&fp->Base, errMsg)) {
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Called via glValidateProgram()
- */
-static void
-validate_program(struct gl_context *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(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);
-}
-
-
-/* GL_EXT_gpu_shader4, GL3 */
-void GLAPIENTRY
-_mesa_BindFragDataLocation(GLuint program, GLuint colorNumber,
- const GLchar *name)
-{
- GET_CURRENT_CONTEXT(ctx);
- bind_frag_data_location(ctx, program, colorNumber, 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);
-}
-
-
-/* GL_EXT_gpu_shader4, GL3 */
-GLint GLAPIENTRY
-_mesa_GetFragDataLocation(GLuint program, const GLchar *name)
-{
- GET_CURRENT_CONTEXT(ctx);
- return get_frag_data_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);
- 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 (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;
- }
-
- _mesa_use_program(ctx, shProg);
-}
-
-
-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);
- (void) shadertype;
- (void) precisiontype;
- (void) range;
- (void) precision;
- _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);
- (void) n;
- (void) shaders;
- (void) binaryformat;
- (void) binary;
- (void) length;
- _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 ||
- (unsigned) 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
-
-void
-_mesa_use_shader_program(struct gl_context *ctx, GLenum type,
- struct gl_shader_program *shProg)
-{
- use_shader_program(ctx, type, shProg);
-
- if (ctx->Driver.UseProgram)
- ctx->Driver.UseProgram(ctx, shProg);
-}
-
-void GLAPIENTRY
-_mesa_UseShaderProgramEXT(GLenum type, GLuint program)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_shader_program *shProg = NULL;
-
- if (!validate_shader_target(ctx, type)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glUseShaderProgramEXT(type)");
- return;
- }
-
- if (ctx->TransformFeedback.CurrentObject->Active) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glUseShaderProgramEXT(transform feedback is active)");
- return;
- }
-
- if (program) {
- shProg = _mesa_lookup_shader_program_err(ctx, program,
- "glUseShaderProgramEXT");
- if (shProg == NULL)
- return;
-
- if (!shProg->LinkStatus) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glUseShaderProgramEXT(program not linked)");
- return;
- }
- }
-
- _mesa_use_shader_program(ctx, type, shProg);
-}
-
-void GLAPIENTRY
-_mesa_ActiveProgramEXT(GLuint program)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_shader_program *shProg = (program != 0)
- ? _mesa_lookup_shader_program_err(ctx, program, "glActiveProgramEXT")
- : NULL;
-
- _mesa_active_program(ctx, shProg, "glActiveProgramEXT");
- return;
-}
-
-GLuint GLAPIENTRY
-_mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string)
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLuint shader = create_shader(ctx, type);
- GLuint program = 0;
-
- if (shader) {
- shader_source(ctx, shader, _mesa_strdup(string));
- compile_shader(ctx, shader);
-
- program = create_shader_program(ctx);
- if (program) {
- struct gl_shader_program *shProg;
- struct gl_shader *sh;
- GLint compiled = GL_FALSE;
-
- shProg = _mesa_lookup_shader_program(ctx, program);
- sh = _mesa_lookup_shader(ctx, shader);
-
- get_shaderiv(ctx, shader, GL_COMPILE_STATUS, &compiled);
- if (compiled) {
- attach_shader(ctx, program, shader);
- link_program(ctx, program);
- detach_shader(ctx, program, shader);
-
-#if 0
- /* Possibly... */
- if (active-user-defined-varyings-in-linked-program) {
- append-error-to-info-log;
- shProg->LinkStatus = GL_FALSE;
- }
-#endif
- }
-
- shProg->InfoLog = talloc_strdup_append(shProg->InfoLog, sh->InfoLog);
- }
-
- delete_shader(ctx, shader);
- }
-
- return program;
-}
-
-/**
- * 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
-
- SET_UseShaderProgramEXT(exec, _mesa_UseShaderProgramEXT);
- SET_ActiveProgramEXT(exec, _mesa_ActiveProgramEXT);
- SET_CreateShaderProgramEXT(exec, _mesa_CreateShaderProgramEXT);
-
- /* GL_EXT_gpu_shader4 / GL 3.0 */
- SET_BindFragDataLocationEXT(exec, _mesa_BindFragDataLocation);
- SET_GetFragDataLocationEXT(exec, _mesa_GetFragDataLocation);
-
-#endif /* FEATURE_GL */
-}
-
diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
deleted file mode 100644
index e4b4776..0000000
--- a/src/mesa/main/shaderapi.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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"
-
-struct _glapi_table;
-struct gl_context;
-struct gl_shader_program;
-
-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(struct gl_context *ctx, struct gl_shader_program *shProg);
-
-extern void
-_mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
- const char *caller);
-
-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 GLint GLAPIENTRY
-_mesa_GetFragDataLocation(GLuint program, const GLchar *name);
-
-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_BindFragDataLocation(GLuint program, GLuint colorNumber,
- const GLchar *name);
-
-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);
-void
-_mesa_use_shader_program(struct gl_context *ctx, GLenum type,
- struct gl_shader_program *shProg);
-
-extern void GLAPIENTRY
-_mesa_UseShaderProgramEXT(GLenum type, GLuint program);
-
-extern void GLAPIENTRY
-_mesa_ActiveProgramEXT(GLuint program);
-
-extern GLuint GLAPIENTRY
-_mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string);
-
-#endif /* SHADERAPI_H */
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
deleted file mode 100644
index 216bbce..0000000
--- a/src/mesa/main/shaderobj.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * 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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *ctx,
- struct gl_shader_program *shProg)
-{
- GLuint i;
- gl_shader_type sh;
-
- 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 (sh = 0; sh < MESA_SHADER_TYPES; sh++) {
- if (shProg->_LinkedShaders[sh] != NULL) {
- ctx->Driver.DeleteShader(ctx, shProg->_LinkedShaders[sh]);
- shProg->_LinkedShaders[sh] = NULL;
- }
- }
-}
-
-
-/**
- * Free/delete a shader program object.
- * Called via ctx->Driver.DeleteShaderProgram().
- */
-static void
-_mesa_delete_shader_program(struct gl_context *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(struct gl_context *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(struct gl_context *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/src/mesa/main/shared.c b/src/mesa/main/shared.c
deleted file mode 100644
index 3abee01..0000000
--- a/src/mesa/main/shared.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * 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 shared.c
- * Shared-context state
- */
-
-
-
-#include "imports.h"
-#include "mtypes.h"
-#include "hash.h"
-#if FEATURE_ATI_fragment_shader
-#include "atifragshader.h"
-#endif
-#include "bufferobj.h"
-#include "shared.h"
-#include "program/program.h"
-#include "dlist.h"
-#include "shaderobj.h"
-#include "syncobj.h"
-
-/**
- * Allocate and initialize a shared context state structure.
- * Initializes the display list, texture objects and vertex programs hash
- * tables, allocates the texture objects. If it runs out of memory, frees
- * everything already allocated before returning NULL.
- *
- * \return pointer to a gl_shared_state structure on success, or NULL on
- * failure.
- */
-struct gl_shared_state *
-_mesa_alloc_shared_state(struct gl_context *ctx)
-{
- struct gl_shared_state *shared;
- GLuint i;
-
- shared = CALLOC_STRUCT(gl_shared_state);
- if (!shared)
- return NULL;
-
- _glthread_INIT_MUTEX(shared->Mutex);
-
- shared->DisplayList = _mesa_NewHashTable();
- shared->TexObjects = _mesa_NewHashTable();
- shared->Programs = _mesa_NewHashTable();
-
-#if FEATURE_ARB_vertex_program
- shared->DefaultVertexProgram = (struct gl_vertex_program *)
- ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
-#endif
-
-#if FEATURE_ARB_fragment_program
- shared->DefaultFragmentProgram = (struct gl_fragment_program *)
- ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
-#endif
-
-#if FEATURE_ATI_fragment_shader
- shared->ATIShaders = _mesa_NewHashTable();
- shared->DefaultFragmentShader = _mesa_new_ati_fragment_shader(ctx, 0);
-#endif
-
-#if FEATURE_ARB_shader_objects
- shared->ShaderObjects = _mesa_NewHashTable();
-#endif
-
-#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
- shared->BufferObjects = _mesa_NewHashTable();
-#endif
-
- /* Allocate the default buffer object */
- shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0, 0);
-
- /* Create default texture objects */
- for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
- /* NOTE: the order of these enums matches the TEXTURE_x_INDEX values */
- static const GLenum targets[NUM_TEXTURE_TARGETS] = {
- GL_TEXTURE_2D_ARRAY_EXT,
- GL_TEXTURE_1D_ARRAY_EXT,
- GL_TEXTURE_CUBE_MAP,
- GL_TEXTURE_3D,
- GL_TEXTURE_RECTANGLE_NV,
- GL_TEXTURE_2D,
- GL_TEXTURE_1D
- };
- shared->DefaultTex[i] = ctx->Driver.NewTextureObject(ctx, 0, targets[i]);
- }
-
- /* sanity check */
- assert(shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount == 1);
-
- /* Mutex and timestamp for texobj state validation */
- _glthread_INIT_MUTEX(shared->TexMutex);
- shared->TextureStateStamp = 0;
-
-#if FEATURE_EXT_framebuffer_object
- shared->FrameBuffers = _mesa_NewHashTable();
- shared->RenderBuffers = _mesa_NewHashTable();
-#endif
-
- make_empty_list(& shared->SyncObjects);
-
- return shared;
-}
-
-
-/**
- * Callback for deleting a display list. Called by _mesa_HashDeleteAll().
- */
-static void
-delete_displaylist_cb(GLuint id, void *data, void *userData)
-{
- struct gl_display_list *list = (struct gl_display_list *) data;
- struct gl_context *ctx = (struct gl_context *) userData;
- _mesa_delete_list(ctx, list);
-}
-
-
-/**
- * Callback for deleting a texture object. Called by _mesa_HashDeleteAll().
- */
-static void
-delete_texture_cb(GLuint id, void *data, void *userData)
-{
- struct gl_texture_object *texObj = (struct gl_texture_object *) data;
- struct gl_context *ctx = (struct gl_context *) userData;
- ctx->Driver.DeleteTexture(ctx, texObj);
-}
-
-
-/**
- * Callback for deleting a program object. Called by _mesa_HashDeleteAll().
- */
-static void
-delete_program_cb(GLuint id, void *data, void *userData)
-{
- struct gl_program *prog = (struct gl_program *) data;
- struct gl_context *ctx = (struct gl_context *) userData;
- if(prog != &_mesa_DummyProgram) {
- ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */
- prog->RefCount = 0; /* now going away */
- ctx->Driver.DeleteProgram(ctx, prog);
- }
-}
-
-
-#if FEATURE_ATI_fragment_shader
-/**
- * Callback for deleting an ATI fragment shader object.
- * Called by _mesa_HashDeleteAll().
- */
-static void
-delete_fragshader_cb(GLuint id, void *data, void *userData)
-{
- struct ati_fragment_shader *shader = (struct ati_fragment_shader *) data;
- struct gl_context *ctx = (struct gl_context *) userData;
- _mesa_delete_ati_fragment_shader(ctx, shader);
-}
-#endif
-
-
-/**
- * Callback for deleting a buffer object. Called by _mesa_HashDeleteAll().
- */
-static void
-delete_bufferobj_cb(GLuint id, void *data, void *userData)
-{
- struct gl_buffer_object *bufObj = (struct gl_buffer_object *) data;
- struct gl_context *ctx = (struct gl_context *) userData;
- if (_mesa_bufferobj_mapped(bufObj)) {
- ctx->Driver.UnmapBuffer(ctx, 0, bufObj);
- bufObj->Pointer = NULL;
- }
- _mesa_reference_buffer_object(ctx, &bufObj, NULL);
-}
-
-
-/**
- * Callback for freeing shader program data. Call it before delete_shader_cb
- * to avoid memory access error.
- */
-static void
-free_shader_program_data_cb(GLuint id, void *data, void *userData)
-{
- struct gl_context *ctx = (struct gl_context *) userData;
- struct gl_shader_program *shProg = (struct gl_shader_program *) data;
-
- if (shProg->Type == GL_SHADER_PROGRAM_MESA) {
- _mesa_free_shader_program_data(ctx, shProg);
- }
-}
-
-
-/**
- * Callback for deleting shader and shader programs objects.
- * Called by _mesa_HashDeleteAll().
- */
-static void
-delete_shader_cb(GLuint id, void *data, void *userData)
-{
- struct gl_context *ctx = (struct gl_context *) userData;
- struct gl_shader *sh = (struct gl_shader *) data;
- if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER) {
- ctx->Driver.DeleteShader(ctx, sh);
- }
- else {
- struct gl_shader_program *shProg = (struct gl_shader_program *) data;
- ASSERT(shProg->Type == GL_SHADER_PROGRAM_MESA);
- ctx->Driver.DeleteShaderProgram(ctx, shProg);
- }
-}
-
-
-/**
- * Callback for deleting a framebuffer object. Called by _mesa_HashDeleteAll()
- */
-static void
-delete_framebuffer_cb(GLuint id, void *data, void *userData)
-{
- struct gl_framebuffer *fb = (struct gl_framebuffer *) data;
- /* The fact that the framebuffer is in the hashtable means its refcount
- * is one, but we're removing from the hashtable now. So clear refcount.
- */
- /*assert(fb->RefCount == 1);*/
- fb->RefCount = 0;
-
- /* NOTE: Delete should always be defined but there are two reports
- * of it being NULL (bugs 13507, 14293). Work-around for now.
- */
- if (fb->Delete)
- fb->Delete(fb);
-}
-
-
-/**
- * Callback for deleting a renderbuffer object. Called by _mesa_HashDeleteAll()
- */
-static void
-delete_renderbuffer_cb(GLuint id, void *data, void *userData)
-{
- struct gl_renderbuffer *rb = (struct gl_renderbuffer *) data;
- rb->RefCount = 0; /* see comment for FBOs above */
- if (rb->Delete)
- rb->Delete(rb);
-}
-
-
-/**
- * Deallocate a shared state object and all children structures.
- *
- * \param ctx GL context.
- * \param shared shared state pointer.
- *
- * Frees the display lists, the texture objects (calling the driver texture
- * deletion callback to free its private data) and the vertex programs, as well
- * as their hash tables.
- *
- * \sa alloc_shared_state().
- */
-static void
-free_shared_state(struct gl_context *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
- */
- _mesa_HashDeleteAll(shared->DisplayList, delete_displaylist_cb, ctx);
- _mesa_DeleteHashTable(shared->DisplayList);
-
-#if FEATURE_ARB_shader_objects
- _mesa_HashWalk(shared->ShaderObjects, free_shader_program_data_cb, ctx);
- _mesa_HashDeleteAll(shared->ShaderObjects, delete_shader_cb, ctx);
- _mesa_DeleteHashTable(shared->ShaderObjects);
-#endif
-
- _mesa_HashDeleteAll(shared->Programs, delete_program_cb, ctx);
- _mesa_DeleteHashTable(shared->Programs);
-
-#if FEATURE_ARB_vertex_program
- _mesa_reference_vertprog(ctx, &shared->DefaultVertexProgram, NULL);
-#endif
-
-#if FEATURE_ARB_fragment_program
- _mesa_reference_fragprog(ctx, &shared->DefaultFragmentProgram, NULL);
-#endif
-
-#if FEATURE_ATI_fragment_shader
- _mesa_HashDeleteAll(shared->ATIShaders, delete_fragshader_cb, ctx);
- _mesa_DeleteHashTable(shared->ATIShaders);
- _mesa_delete_ati_fragment_shader(ctx, shared->DefaultFragmentShader);
-#endif
-
-#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
- _mesa_HashDeleteAll(shared->BufferObjects, delete_bufferobj_cb, ctx);
- _mesa_DeleteHashTable(shared->BufferObjects);
-#endif
-
-#if FEATURE_EXT_framebuffer_object
- _mesa_HashDeleteAll(shared->FrameBuffers, delete_framebuffer_cb, ctx);
- _mesa_DeleteHashTable(shared->FrameBuffers);
- _mesa_HashDeleteAll(shared->RenderBuffers, delete_renderbuffer_cb, ctx);
- _mesa_DeleteHashTable(shared->RenderBuffers);
-#endif
-
-#if FEATURE_ARB_vertex_buffer_object
- _mesa_reference_buffer_object(ctx, &shared->NullBufferObj, NULL);
-#endif
-
- {
- struct simple_node *node;
- struct simple_node *temp;
-
- foreach_s(node, temp, & shared->SyncObjects) {
- _mesa_unref_sync_object(ctx, (struct gl_sync_object *) node);
- }
- }
-
- /*
- * Free texture objects (after FBOs since some textures might have
- * been bound to FBOs).
- */
- ASSERT(ctx->Driver.DeleteTexture);
- /* the default textures */
- for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
- ctx->Driver.DeleteTexture(ctx, shared->DefaultTex[i]);
- }
-
- /* all other textures */
- _mesa_HashDeleteAll(shared->TexObjects, delete_texture_cb, ctx);
- _mesa_DeleteHashTable(shared->TexObjects);
-
- _glthread_DESTROY_MUTEX(shared->Mutex);
- _glthread_DESTROY_MUTEX(shared->TexMutex);
-
- free(shared);
-}
-
-
-/**
- * Decrement shared state object reference count and potentially free it
- * and all children structures.
- *
- * \param ctx GL context.
- * \param shared shared state pointer.
- *
- * \sa free_shared_state().
- */
-void
-_mesa_release_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
-{
- GLint RefCount;
-
- _glthread_LOCK_MUTEX(shared->Mutex);
- RefCount = --shared->RefCount;
- _glthread_UNLOCK_MUTEX(shared->Mutex);
-
- assert(RefCount >= 0);
-
- if (RefCount == 0) {
- /* free shared state */
- free_shared_state( ctx, shared );
- }
-}
diff --git a/src/mesa/main/shared.h b/src/mesa/main/shared.h
deleted file mode 100644
index 768d69f..0000000
--- a/src/mesa/main/shared.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * 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.
- */
-
-#ifndef SHARED_H
-#define SHARED_H
-
-struct gl_context;
-
-struct gl_shared_state *
-_mesa_alloc_shared_state(struct gl_context *ctx);
-
-
-void
-_mesa_release_shared_state(struct gl_context *ctx, struct gl_shared_state *shared);
-
-
-#endif
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
deleted file mode 100644
index cce1b46..0000000
--- a/src/mesa/main/state.c
+++ /dev/null
@@ -1,732 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.3
- *
- * 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 state.c
- * State management.
- *
- * This file manages recalculation of derived values in struct gl_context.
- */
-
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "context.h"
-#include "debug.h"
-#include "macros.h"
-#include "ffvertex_prog.h"
-#include "framebuffer.h"
-#include "light.h"
-#include "matrix.h"
-#include "pixel.h"
-#include "program/program.h"
-#include "program/prog_parameter.h"
-#include "state.h"
-#include "stencil.h"
-#include "texenvprogram.h"
-#include "texobj.h"
-#include "texstate.h"
-
-
-static void
-update_separate_specular(struct gl_context *ctx)
-{
- if (NEED_SECONDARY_COLOR(ctx))
- ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
- else
- ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
-}
-
-
-/**
- * Compute the index of the last array element that can be safely accessed
- * in a vertex array. We can really only do this when the array lives in
- * a VBO.
- * The array->_MaxElement field will be updated.
- * Later in glDrawArrays/Elements/etc we can do some bounds checking.
- */
-static void
-compute_max_element(struct gl_client_array *array)
-{
- assert(array->Enabled);
- if (array->BufferObj->Name) {
- GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr;
- GLsizeiptrARB obj_size = (GLsizeiptrARB) array->BufferObj->Size;
-
- if (offset < obj_size) {
- array->_MaxElement = (obj_size - offset +
- array->StrideB -
- array->_ElementSize) / array->StrideB;
- } else {
- array->_MaxElement = 0;
- }
- }
- else {
- /* user-space array, no idea how big it is */
- array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
- }
-}
-
-
-/**
- * Helper for update_arrays().
- * \return min(current min, array->_MaxElement).
- */
-static GLuint
-update_min(GLuint min, struct gl_client_array *array)
-{
- compute_max_element(array);
- return MIN2(min, array->_MaxElement);
-}
-
-
-/**
- * Update ctx->Array._MaxElement (the max legal index into all enabled arrays).
- * Need to do this upon new array state or new buffer object state.
- */
-static void
-update_arrays( struct gl_context *ctx )
-{
- struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
- GLuint i, min = ~0;
-
- /* find min of _MaxElement values for all enabled arrays */
-
- /* 0 */
- if (ctx->VertexProgram._Current
- && arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]);
- }
- else if (arrayObj->Vertex.Enabled) {
- min = update_min(min, &arrayObj->Vertex);
- }
-
- /* 1 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT]);
- }
- /* no conventional vertex weight array */
-
- /* 2 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]);
- }
- else if (arrayObj->Normal.Enabled) {
- min = update_min(min, &arrayObj->Normal);
- }
-
- /* 3 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]);
- }
- else if (arrayObj->Color.Enabled) {
- min = update_min(min, &arrayObj->Color);
- }
-
- /* 4 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]);
- }
- else if (arrayObj->SecondaryColor.Enabled) {
- min = update_min(min, &arrayObj->SecondaryColor);
- }
-
- /* 5 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_FOG]);
- }
- else if (arrayObj->FogCoord.Enabled) {
- min = update_min(min, &arrayObj->FogCoord);
- }
-
- /* 6 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]);
- }
- else if (arrayObj->Index.Enabled) {
- min = update_min(min, &arrayObj->Index);
- }
-
- /* 7 */
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]);
- }
-
- /* 8..15 */
- for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++) {
- if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[i].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[i]);
- }
- else if (i - VERT_ATTRIB_TEX0 < ctx->Const.MaxTextureCoordUnits
- && arrayObj->TexCoord[i - VERT_ATTRIB_TEX0].Enabled) {
- min = update_min(min, &arrayObj->TexCoord[i - VERT_ATTRIB_TEX0]);
- }
- }
-
- /* 16..31 */
- if (ctx->VertexProgram._Current) {
- for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) {
- if (arrayObj->VertexAttrib[i].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[i]);
- }
- }
- }
-
- if (arrayObj->EdgeFlag.Enabled) {
- min = update_min(min, &arrayObj->EdgeFlag);
- }
-
- /* _MaxElement is one past the last legal array element */
- arrayObj->_MaxElement = min;
-}
-
-
-/**
- * Update the following fields:
- * ctx->VertexProgram._Enabled
- * ctx->FragmentProgram._Enabled
- * ctx->ATIFragmentShader._Enabled
- * This needs to be done before texture state validation.
- */
-static void
-update_program_enables(struct gl_context *ctx)
-{
- /* These _Enabled flags indicate if the program is enabled AND valid. */
- ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
- && ctx->VertexProgram.Current->Base.Instructions;
- ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
- && ctx->FragmentProgram.Current->Base.Instructions;
- ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
- && ctx->ATIFragmentShader.Current->Instructions[0];
-}
-
-
-/**
- * Update vertex/fragment program state. In particular, update these fields:
- * ctx->VertexProgram._Current
- * ctx->VertexProgram._TnlProgram,
- * These point to the highest priority enabled vertex/fragment program or are
- * NULL if fixed-function processing is to be done.
- *
- * This function needs to be called after texture state validation in case
- * we're generating a fragment program from fixed-function texture state.
- *
- * \return bitfield which will indicate _NEW_PROGRAM state if a new vertex
- * or fragment program is being used.
- */
-static GLbitfield
-update_program(struct gl_context *ctx)
-{
- const struct gl_shader_program *vsProg = ctx->Shader.CurrentVertexProgram;
- const struct gl_shader_program *gsProg = ctx->Shader.CurrentGeometryProgram;
- const struct gl_shader_program *fsProg = ctx->Shader.CurrentFragmentProgram;
- 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;
-
- /*
- * Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current
- * pointers to the programs that should be used for rendering. If either
- * is NULL, use fixed-function code paths.
- *
- * These programs may come from several sources. The priority is as
- * follows:
- * 1. OpenGL 2.0/ARB vertex/fragment shaders
- * 2. ARB/NV vertex/fragment programs
- * 3. Programs derived from fixed-function state.
- *
- * Note: it's possible for a vertex shader to get used with a fragment
- * program (and vice versa) here, but in practice that shouldn't ever
- * come up, or matter.
- */
-
- if (fsProg && fsProg->LinkStatus && fsProg->FragmentProgram) {
- /* Use shader programs */
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
- fsProg->FragmentProgram);
- }
- else if (ctx->FragmentProgram._Enabled) {
- /* use user-defined vertex program */
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
- ctx->FragmentProgram.Current);
- }
- else if (ctx->FragmentProgram._MaintainTexEnvProgram) {
- /* Use fragment program generated from fixed-function state.
- */
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
- _mesa_get_fixed_func_fragment_program(ctx));
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
- ctx->FragmentProgram._Current);
- }
- else {
- /* no fragment program */
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
- }
-
- if (gsProg && gsProg->LinkStatus && gsProg->GeometryProgram) {
- /* Use shader programs */
- _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current,
- gsProg->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.
- */
- if (vsProg && vsProg->LinkStatus && vsProg->VertexProgram) {
- /* Use shader programs */
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
- vsProg->VertexProgram);
- }
- else if (ctx->VertexProgram._Enabled) {
- /* use user-defined vertex program */
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
- ctx->VertexProgram.Current);
- }
- else if (ctx->VertexProgram._MaintainTnlProgram) {
- /* Use vertex program generated from fixed-function state.
- */
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
- _mesa_get_fixed_func_vertex_program(ctx));
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram,
- ctx->VertexProgram._Current);
- }
- else {
- /* no vertex program */
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
- }
-
- /* Let the driver know what's happening:
- */
- if (ctx->FragmentProgram._Current != prevFP) {
- new_state |= _NEW_PROGRAM;
- if (ctx->Driver.BindProgram) {
- ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
- (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) {
- ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
- (struct gl_program *) ctx->VertexProgram._Current);
- }
- }
-
- return new_state;
-}
-
-
-/**
- * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
- */
-static GLbitfield
-update_program_constants(struct gl_context *ctx)
-{
- GLbitfield new_state = 0x0;
-
- if (ctx->FragmentProgram._Current) {
- const struct gl_program_parameter_list *params =
- ctx->FragmentProgram._Current->Base.Parameters;
- if (params && params->StateFlags & ctx->NewState) {
- new_state |= _NEW_PROGRAM_CONSTANTS;
- }
- }
-
- 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;
- if (params && params->StateFlags & ctx->NewState) {
- new_state |= _NEW_PROGRAM_CONSTANTS;
- }
- }
-
- return new_state;
-}
-
-
-
-
-static void
-update_viewport_matrix(struct gl_context *ctx)
-{
- const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF;
-
- ASSERT(depthMax > 0);
-
- /* Compute scale and bias values. This is really driver-specific
- * and should be maintained elsewhere if at all.
- * NOTE: RasterPos uses this.
- */
- _math_matrix_viewport(&ctx->Viewport._WindowMap,
- ctx->Viewport.X, ctx->Viewport.Y,
- ctx->Viewport.Width, ctx->Viewport.Height,
- ctx->Viewport.Near, ctx->Viewport.Far,
- depthMax);
-}
-
-
-/**
- * Update derived multisample state.
- */
-static void
-update_multisample(struct gl_context *ctx)
-{
- ctx->Multisample._Enabled = GL_FALSE;
- if (ctx->Multisample.Enabled &&
- ctx->DrawBuffer &&
- ctx->DrawBuffer->Visual.sampleBuffers)
- ctx->Multisample._Enabled = GL_TRUE;
-}
-
-
-/**
- * Update derived color/blend/logicop state.
- */
-static void
-update_color(struct gl_context *ctx)
-{
- /* This is needed to support 1.1's RGB logic ops AND
- * 1.0's blending logicops.
- */
- ctx->Color._LogicOpEnabled = RGBA_LOGICOP_ENABLED(ctx);
-}
-
-
-/*
- * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
- * in ctx->_TriangleCaps if needed.
- */
-static void
-update_polygon(struct gl_context *ctx)
-{
- ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
-
- if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
- ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
-
- if ( ctx->Polygon.OffsetPoint
- || ctx->Polygon.OffsetLine
- || ctx->Polygon.OffsetFill)
- ctx->_TriangleCaps |= DD_TRI_OFFSET;
-}
-
-
-/**
- * Update the ctx->_TriangleCaps bitfield.
- * XXX that bitfield should really go away someday!
- * This function must be called after other update_*() functions since
- * there are dependencies on some other derived values.
- */
-#if 0
-static void
-update_tricaps(struct gl_context *ctx, GLbitfield new_state)
-{
- ctx->_TriangleCaps = 0;
-
- /*
- * Points
- */
- if (1/*new_state & _NEW_POINT*/) {
- if (ctx->Point.SmoothFlag)
- ctx->_TriangleCaps |= DD_POINT_SMOOTH;
- if (ctx->Point._Attenuated)
- ctx->_TriangleCaps |= DD_POINT_ATTEN;
- }
-
- /*
- * Lines
- */
- if (1/*new_state & _NEW_LINE*/) {
- if (ctx->Line.SmoothFlag)
- ctx->_TriangleCaps |= DD_LINE_SMOOTH;
- if (ctx->Line.StippleFlag)
- ctx->_TriangleCaps |= DD_LINE_STIPPLE;
- }
-
- /*
- * Polygons
- */
- if (1/*new_state & _NEW_POLYGON*/) {
- if (ctx->Polygon.SmoothFlag)
- ctx->_TriangleCaps |= DD_TRI_SMOOTH;
- if (ctx->Polygon.StippleFlag)
- ctx->_TriangleCaps |= DD_TRI_STIPPLE;
- if (ctx->Polygon.FrontMode != GL_FILL
- || ctx->Polygon.BackMode != GL_FILL)
- ctx->_TriangleCaps |= DD_TRI_UNFILLED;
- if (ctx->Polygon.CullFlag
- && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
- ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
- if (ctx->Polygon.OffsetPoint ||
- ctx->Polygon.OffsetLine ||
- ctx->Polygon.OffsetFill)
- ctx->_TriangleCaps |= DD_TRI_OFFSET;
- }
-
- /*
- * Lighting and shading
- */
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
- ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
- if (ctx->Light.ShadeModel == GL_FLAT)
- ctx->_TriangleCaps |= DD_FLATSHADE;
- if (NEED_SECONDARY_COLOR(ctx))
- ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
-
- /*
- * Stencil
- */
- if (ctx->Stencil._TestTwoSide)
- ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
-}
-#endif
-
-
-/**
- * Compute derived GL state.
- * If __struct gl_contextRec::NewState is non-zero then this function \b must
- * be called before rendering anything.
- *
- * Calls dd_function_table::UpdateState to perform any internal state
- * management necessary.
- *
- * \sa _mesa_update_modelview_project(), _mesa_update_texture(),
- * _mesa_update_buffer_bounds(),
- * _mesa_update_lighting() and _mesa_update_tnl_spaces().
- */
-void
-_mesa_update_state_locked( struct gl_context *ctx )
-{
- GLbitfield new_state = ctx->NewState;
- GLbitfield prog_flags = _NEW_PROGRAM;
- GLbitfield new_prog_state = 0x0;
-
- if (new_state == _NEW_CURRENT_ATTRIB)
- goto out;
-
- if (MESA_VERBOSE & VERBOSE_STATE)
- _mesa_print_state("_mesa_update_state", new_state);
-
- /* Determine which state flags effect vertex/fragment program state */
- if (ctx->FragmentProgram._MaintainTexEnvProgram) {
- prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG |
- _NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE |
- _NEW_PROGRAM);
- }
- if (ctx->VertexProgram._MaintainTnlProgram) {
- prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
- _NEW_TRANSFORM | _NEW_POINT |
- _NEW_FOG | _NEW_LIGHT |
- _MESA_NEW_NEED_EYE_COORDS);
- }
-
- /*
- * Now update derived state info
- */
-
- if (new_state & prog_flags)
- update_program_enables( ctx );
-
- if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
- _mesa_update_modelview_project( ctx, new_state );
-
- if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
- _mesa_update_texture( ctx, new_state );
-
- if (new_state & _NEW_BUFFERS)
- _mesa_update_framebuffer(ctx);
-
- if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
- _mesa_update_draw_buffer_bounds( ctx );
-
- if (new_state & _NEW_POLYGON)
- update_polygon( ctx );
-
- if (new_state & _NEW_LIGHT)
- _mesa_update_lighting( ctx );
-
- if (new_state & (_NEW_STENCIL | _NEW_BUFFERS))
- _mesa_update_stencil( ctx );
-
- if (new_state & _MESA_NEW_TRANSFER_STATE)
- _mesa_update_pixel( ctx, new_state );
-
- if (new_state & _DD_NEW_SEPARATE_SPECULAR)
- update_separate_specular( ctx );
-
- if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT))
- update_viewport_matrix(ctx);
-
- if (new_state & _NEW_MULTISAMPLE)
- update_multisample( ctx );
-
- if (new_state & _NEW_COLOR)
- update_color( ctx );
-
-#if 0
- if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT
- | _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR))
- update_tricaps( ctx, new_state );
-#endif
-
- /* ctx->_NeedEyeCoords is now up to date.
- *
- * If the truth value of this variable has changed, update for the
- * new lighting space and recompute the positions of lights and the
- * normal transform.
- *
- * If the lighting space hasn't changed, may still need to recompute
- * light positions & normal transforms for other reasons.
- */
- if (new_state & _MESA_NEW_NEED_EYE_COORDS)
- _mesa_update_tnl_spaces( ctx, new_state );
-
- if (new_state & prog_flags) {
- /* When we generate programs from fixed-function vertex/fragment state
- * this call may generate/bind a new program. If so, we need to
- * propogate the _NEW_PROGRAM flag to the driver.
- */
- new_prog_state |= update_program( ctx );
- }
-
- if (new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT))
- update_arrays( ctx );
-
- out:
- new_prog_state |= update_program_constants(ctx);
-
- /*
- * Give the driver a chance to act upon the new_state flags.
- * The driver might plug in different span functions, for example.
- * Also, this is where the driver can invalidate the state of any
- * active modules (such as swrast_setup, swrast, tnl, etc).
- *
- * Set ctx->NewState to zero to avoid recursion if
- * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?)
- */
- new_state = ctx->NewState | new_prog_state;
- ctx->NewState = 0;
- ctx->Driver.UpdateState(ctx, new_state);
- ctx->Array.NewState = 0;
-}
-
-
-/* This is the usual entrypoint for state updates:
- */
-void
-_mesa_update_state( struct gl_context *ctx )
-{
- _mesa_lock_context_textures(ctx);
- _mesa_update_state_locked(ctx);
- _mesa_unlock_context_textures(ctx);
-}
-
-
-
-
-/**
- * Want to figure out which fragment program inputs are actually
- * constant/current values from ctx->Current. These should be
- * referenced as a tracked state variable rather than a fragment
- * program input, to save the overhead of putting a constant value in
- * every submitted vertex, transferring it to hardware, interpolating
- * it across the triangle, etc...
- *
- * When there is a VP bound, just use vp->outputs. But when we're
- * generating vp from fixed function state, basically want to
- * calculate:
- *
- * vp_out_2_fp_in( vp_in_2_vp_out( varying_inputs ) |
- * potential_vp_outputs )
- *
- * Where potential_vp_outputs is calculated by looking at enabled
- * texgen, etc.
- *
- * The generated fragment program should then only declare inputs that
- * may vary or otherwise differ from the ctx->Current values.
- * Otherwise, the fp should track them as state values instead.
- */
-void
-_mesa_set_varying_vp_inputs( struct gl_context *ctx,
- GLbitfield varying_inputs )
-{
- if (ctx->varying_vp_inputs != varying_inputs) {
- ctx->varying_vp_inputs = varying_inputs;
- ctx->NewState |= _NEW_ARRAY;
- /*printf("%s %x\n", __FUNCTION__, varying_inputs);*/
- }
-}
-
-
-/**
- * Used by drivers to tell core Mesa that the driver is going to
- * install/ use its own vertex program. In particular, this will
- * prevent generated fragment programs from using state vars instead
- * of ordinary varyings/inputs.
- */
-void
-_mesa_set_vp_override(struct gl_context *ctx, GLboolean flag)
-{
- if (ctx->VertexProgram._Overriden != flag) {
- ctx->VertexProgram._Overriden = flag;
-
- /* Set one of the bits which will trigger fragment program
- * regeneration:
- */
- ctx->NewState |= _NEW_PROGRAM;
- }
-}
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
deleted file mode 100644
index f0eb43d..0000000
--- a/src/mesa/main/state.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.3
- *
- * 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 STATE_H
-#define STATE_H
-
-#include "mtypes.h"
-
-extern void
-_mesa_update_state(struct gl_context *ctx);
-
-/* As above but can only be called between _mesa_lock_context_textures() and
- * _mesa_unlock_context_textures().
- */
-extern void
-_mesa_update_state_locked(struct gl_context *ctx);
-
-
-extern void
-_mesa_set_varying_vp_inputs(struct gl_context *ctx, GLbitfield varying_inputs);
-
-
-extern void
-_mesa_set_vp_override(struct gl_context *ctx, GLboolean flag);
-
-
-#endif
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
deleted file mode 100644
index 93e2e97..0000000
--- a/src/mesa/main/stencil.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-/**
- * \file stencil.c
- * Stencil operations.
- *
- * Note: There's some conflict between GL_EXT_stencil_two_side and
- * OpenGL 2.0's two-sided stencil feature.
- *
- * With GL_EXT_stencil_two_side, calling glStencilOp/Func/Mask() only the
- * front OR back face state (as set by glActiveStencilFaceEXT) is set.
- *
- * But with OpenGL 2.0, calling glStencilOp/Func/Mask() sets BOTH the
- * front AND back state.
- *
- * Also, note that GL_ATI_separate_stencil is different as well:
- * glStencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, ...) vs.
- * glStencilFuncSeparate(GLenum face, GLenum func, ...).
- *
- * This problem is solved by keeping three sets of stencil state:
- * state[0] = GL_FRONT state.
- * state[1] = OpenGL 2.0 / GL_ATI_separate_stencil GL_BACK state.
- * state[2] = GL_EXT_stencil_two_side GL_BACK state.
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "stencil.h"
-#include "mtypes.h"
-
-
-static GLboolean
-validate_stencil_op(struct gl_context *ctx, GLenum op)
-{
- switch (op) {
- case GL_KEEP:
- case GL_ZERO:
- case GL_REPLACE:
- case GL_INCR:
- case GL_DECR:
- case GL_INVERT:
- return GL_TRUE;
- case GL_INCR_WRAP_EXT:
- case GL_DECR_WRAP_EXT:
- if (ctx->Extensions.EXT_stencil_wrap) {
- return GL_TRUE;
- }
- /* FALL-THROUGH */
- default:
- return GL_FALSE;
- }
-}
-
-
-static GLboolean
-validate_stencil_func(struct gl_context *ctx, GLenum func)
-{
- switch (func) {
- case GL_NEVER:
- case GL_LESS:
- case GL_LEQUAL:
- case GL_GREATER:
- case GL_GEQUAL:
- case GL_EQUAL:
- case GL_NOTEQUAL:
- case GL_ALWAYS:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
-/**
- * Set the clear value for the stencil buffer.
- *
- * \param s clear value.
- *
- * \sa glClearStencil().
- *
- * Updates gl_stencil_attrib::Clear. On change
- * flushes the vertices and notifies the driver via
- * the dd_function_table::ClearStencil callback.
- */
-void GLAPIENTRY
-_mesa_ClearStencil( GLint s )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Stencil.Clear == (GLuint) s)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.Clear = (GLuint) s;
-
- if (ctx->Driver.ClearStencil) {
- ctx->Driver.ClearStencil( ctx, s );
- }
-}
-
-
-/**
- * Set the function and reference value for stencil testing.
- *
- * \param frontfunc front test function.
- * \param backfunc back test function.
- * \param ref front and back reference value.
- * \param mask front and back bitmask.
- *
- * \sa glStencilFunc().
- *
- * Verifies the parameters and updates the respective values in
- * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
- * driver via the dd_function_table::StencilFunc callback.
- */
-void GLAPIENTRY
-_mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask )
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!validate_stencil_func(ctx, frontfunc)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glStencilFuncSeparateATI(frontfunc)");
- return;
- }
- if (!validate_stencil_func(ctx, backfunc)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glStencilFuncSeparateATI(backfunc)");
- return;
- }
-
- ref = CLAMP( ref, 0, stencilMax );
-
- /* set both front and back state */
- if (ctx->Stencil.Function[0] == frontfunc &&
- ctx->Stencil.Function[1] == backfunc &&
- ctx->Stencil.ValueMask[0] == mask &&
- ctx->Stencil.ValueMask[1] == mask &&
- ctx->Stencil.Ref[0] == ref &&
- ctx->Stencil.Ref[1] == ref)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.Function[0] = frontfunc;
- ctx->Stencil.Function[1] = backfunc;
- ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref;
- ctx->Stencil.ValueMask[0] = ctx->Stencil.ValueMask[1] = mask;
- if (ctx->Driver.StencilFuncSeparate) {
- ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT,
- frontfunc, ref, mask);
- ctx->Driver.StencilFuncSeparate(ctx, GL_BACK,
- backfunc, ref, mask);
- }
-}
-
-
-/**
- * Set the function and reference value for stencil testing.
- *
- * \param func test function.
- * \param ref reference value.
- * \param mask bitmask.
- *
- * \sa glStencilFunc().
- *
- * Verifies the parameters and updates the respective values in
- * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
- * driver via the dd_function_table::StencilFunc callback.
- */
-void GLAPIENTRY
-_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
- const GLint face = ctx->Stencil.ActiveFace;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!validate_stencil_func(ctx, func)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFunc(func)");
- return;
- }
-
- ref = CLAMP( ref, 0, stencilMax );
-
- if (face != 0) {
- if (ctx->Stencil.Function[face] == func &&
- ctx->Stencil.ValueMask[face] == mask &&
- ctx->Stencil.Ref[face] == ref)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.Function[face] = func;
- ctx->Stencil.Ref[face] = ref;
- ctx->Stencil.ValueMask[face] = mask;
-
- /* Only propagate the change to the driver if EXT_stencil_two_side
- * is enabled.
- */
- if (ctx->Driver.StencilFuncSeparate && ctx->Stencil.TestTwoSide) {
- ctx->Driver.StencilFuncSeparate(ctx, GL_BACK, func, ref, mask);
- }
- }
- else {
- /* set both front and back state */
- if (ctx->Stencil.Function[0] == func &&
- ctx->Stencil.Function[1] == func &&
- ctx->Stencil.ValueMask[0] == mask &&
- ctx->Stencil.ValueMask[1] == mask &&
- ctx->Stencil.Ref[0] == ref &&
- ctx->Stencil.Ref[1] == ref)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.Function[0] = ctx->Stencil.Function[1] = func;
- ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref;
- ctx->Stencil.ValueMask[0] = ctx->Stencil.ValueMask[1] = mask;
- if (ctx->Driver.StencilFuncSeparate) {
- ctx->Driver.StencilFuncSeparate(ctx,
- ((ctx->Stencil.TestTwoSide)
- ? GL_FRONT : GL_FRONT_AND_BACK),
- func, ref, mask);
- }
- }
-}
-
-
-/**
- * Set the stencil writing mask.
- *
- * \param mask bit-mask to enable/disable writing of individual bits in the
- * stencil planes.
- *
- * \sa glStencilMask().
- *
- * Updates gl_stencil_attrib::WriteMask. On change flushes the vertices and
- * notifies the driver via the dd_function_table::StencilMask callback.
- */
-void GLAPIENTRY
-_mesa_StencilMask( GLuint mask )
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLint face = ctx->Stencil.ActiveFace;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (face != 0) {
- /* Only modify the EXT_stencil_two_side back-face state.
- */
- if (ctx->Stencil.WriteMask[face] == mask)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.WriteMask[face] = mask;
-
- /* Only propagate the change to the driver if EXT_stencil_two_side
- * is enabled.
- */
- if (ctx->Driver.StencilMaskSeparate && ctx->Stencil.TestTwoSide) {
- ctx->Driver.StencilMaskSeparate(ctx, GL_BACK, mask);
- }
- }
- else {
- /* set both front and back state */
- if (ctx->Stencil.WriteMask[0] == mask &&
- ctx->Stencil.WriteMask[1] == mask)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask;
- if (ctx->Driver.StencilMaskSeparate) {
- ctx->Driver.StencilMaskSeparate(ctx,
- ((ctx->Stencil.TestTwoSide)
- ? GL_FRONT : GL_FRONT_AND_BACK),
- mask);
- }
- }
-}
-
-
-/**
- * Set the stencil test actions.
- *
- * \param fail action to take when stencil test fails.
- * \param zfail action to take when stencil test passes, but depth test fails.
- * \param zpass action to take when stencil test passes and the depth test
- * passes (or depth testing is not enabled).
- *
- * \sa glStencilOp().
- *
- * Verifies the parameters and updates the respective fields in
- * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
- * driver via the dd_function_table::StencilOp callback.
- */
-void GLAPIENTRY
-_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLint face = ctx->Stencil.ActiveFace;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!validate_stencil_op(ctx, fail)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(sfail)");
- return;
- }
- if (!validate_stencil_op(ctx, zfail)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(zfail)");
- return;
- }
- if (!validate_stencil_op(ctx, zpass)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(zpass)");
- return;
- }
-
- if (face != 0) {
- /* only set active face state */
- if (ctx->Stencil.ZFailFunc[face] == zfail &&
- ctx->Stencil.ZPassFunc[face] == zpass &&
- ctx->Stencil.FailFunc[face] == fail)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.ZFailFunc[face] = zfail;
- ctx->Stencil.ZPassFunc[face] = zpass;
- ctx->Stencil.FailFunc[face] = fail;
-
- /* Only propagate the change to the driver if EXT_stencil_two_side
- * is enabled.
- */
- if (ctx->Driver.StencilOpSeparate && ctx->Stencil.TestTwoSide) {
- ctx->Driver.StencilOpSeparate(ctx, GL_BACK, fail, zfail, zpass);
- }
- }
- else {
- /* set both front and back state */
- if (ctx->Stencil.ZFailFunc[0] == zfail &&
- ctx->Stencil.ZFailFunc[1] == zfail &&
- ctx->Stencil.ZPassFunc[0] == zpass &&
- ctx->Stencil.ZPassFunc[1] == zpass &&
- ctx->Stencil.FailFunc[0] == fail &&
- ctx->Stencil.FailFunc[1] == fail)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.ZFailFunc[0] = ctx->Stencil.ZFailFunc[1] = zfail;
- ctx->Stencil.ZPassFunc[0] = ctx->Stencil.ZPassFunc[1] = zpass;
- ctx->Stencil.FailFunc[0] = ctx->Stencil.FailFunc[1] = fail;
- if (ctx->Driver.StencilOpSeparate) {
- ctx->Driver.StencilOpSeparate(ctx,
- ((ctx->Stencil.TestTwoSide)
- ? GL_FRONT : GL_FRONT_AND_BACK),
- fail, zfail, zpass);
- }
- }
-}
-
-
-
-#if _HAVE_FULL_GL
-/* GL_EXT_stencil_two_side */
-void GLAPIENTRY
-_mesa_ActiveStencilFaceEXT(GLenum face)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!ctx->Extensions.EXT_stencil_two_side) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glActiveStencilFaceEXT");
- return;
- }
-
- if (face == GL_FRONT || face == GL_BACK) {
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.ActiveFace = (face == GL_FRONT) ? 0 : 2;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glActiveStencilFaceEXT(face)");
- }
-}
-#endif
-
-
-
-/**
- * OpenGL 2.0 function.
- * \todo Make StencilOp() call this function. And eventually remove the
- * ctx->Driver.StencilOp function and use ctx->Driver.StencilOpSeparate
- * instead.
- */
-void GLAPIENTRY
-_mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass)
-{
- GLboolean set = GL_FALSE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!validate_stencil_op(ctx, sfail)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(sfail)");
- return;
- }
- if (!validate_stencil_op(ctx, zfail)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zfail)");
- return;
- }
- if (!validate_stencil_op(ctx, zpass)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)");
- return;
- }
- if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(face)");
- return;
- }
-
- if (face != GL_BACK) {
- /* set front */
- if (ctx->Stencil.ZFailFunc[0] != zfail ||
- ctx->Stencil.ZPassFunc[0] != zpass ||
- ctx->Stencil.FailFunc[0] != sfail){
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.ZFailFunc[0] = zfail;
- ctx->Stencil.ZPassFunc[0] = zpass;
- ctx->Stencil.FailFunc[0] = sfail;
- set = GL_TRUE;
- }
- }
- if (face != GL_FRONT) {
- /* set back */
- if (ctx->Stencil.ZFailFunc[1] != zfail ||
- ctx->Stencil.ZPassFunc[1] != zpass ||
- ctx->Stencil.FailFunc[1] != sfail) {
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.ZFailFunc[1] = zfail;
- ctx->Stencil.ZPassFunc[1] = zpass;
- ctx->Stencil.FailFunc[1] = sfail;
- set = GL_TRUE;
- }
- }
- if (set && ctx->Driver.StencilOpSeparate) {
- ctx->Driver.StencilOpSeparate(ctx, face, sfail, zfail, zpass);
- }
-}
-
-
-/* OpenGL 2.0 */
-void GLAPIENTRY
-_mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(face)");
- return;
- }
- if (!validate_stencil_func(ctx, func)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(func)");
- return;
- }
-
- ref = CLAMP(ref, 0, stencilMax);
-
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
-
- if (face != GL_BACK) {
- /* set front */
- ctx->Stencil.Function[0] = func;
- ctx->Stencil.Ref[0] = ref;
- ctx->Stencil.ValueMask[0] = mask;
- }
- if (face != GL_FRONT) {
- /* set back */
- ctx->Stencil.Function[1] = func;
- ctx->Stencil.Ref[1] = ref;
- ctx->Stencil.ValueMask[1] = mask;
- }
- if (ctx->Driver.StencilFuncSeparate) {
- ctx->Driver.StencilFuncSeparate(ctx, face, func, ref, mask);
- }
-}
-
-
-/* OpenGL 2.0 */
-void GLAPIENTRY
-_mesa_StencilMaskSeparate(GLenum face, GLuint mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilaMaskSeparate(face)");
- return;
- }
-
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
-
- if (face != GL_BACK) {
- ctx->Stencil.WriteMask[0] = mask;
- }
- if (face != GL_FRONT) {
- ctx->Stencil.WriteMask[1] = mask;
- }
- if (ctx->Driver.StencilMaskSeparate) {
- ctx->Driver.StencilMaskSeparate(ctx, face, mask);
- }
-}
-
-
-/**
- * Update derived stencil state.
- */
-void
-_mesa_update_stencil(struct gl_context *ctx)
-{
- const GLint face = ctx->Stencil._BackFace;
-
- ctx->Stencil._Enabled = (ctx->Stencil.Enabled &&
- ctx->DrawBuffer->Visual.stencilBits > 0);
-
- ctx->Stencil._TestTwoSide =
- ctx->Stencil._Enabled &&
- (ctx->Stencil.Function[0] != ctx->Stencil.Function[face] ||
- ctx->Stencil.FailFunc[0] != ctx->Stencil.FailFunc[face] ||
- ctx->Stencil.ZPassFunc[0] != ctx->Stencil.ZPassFunc[face] ||
- ctx->Stencil.ZFailFunc[0] != ctx->Stencil.ZFailFunc[face] ||
- ctx->Stencil.Ref[0] != ctx->Stencil.Ref[face] ||
- ctx->Stencil.ValueMask[0] != ctx->Stencil.ValueMask[face] ||
- ctx->Stencil.WriteMask[0] != ctx->Stencil.WriteMask[face]);
-}
-
-
-/**
- * Initialize the context stipple state.
- *
- * \param ctx GL context.
- *
- * Initializes __struct gl_contextRec::Stencil attribute group.
- */
-void
-_mesa_init_stencil(struct gl_context *ctx)
-{
- ctx->Stencil.Enabled = GL_FALSE;
- ctx->Stencil.TestTwoSide = GL_FALSE;
- ctx->Stencil.ActiveFace = 0; /* 0 = GL_FRONT, 2 = GL_BACK */
- ctx->Stencil.Function[0] = GL_ALWAYS;
- ctx->Stencil.Function[1] = GL_ALWAYS;
- ctx->Stencil.Function[2] = GL_ALWAYS;
- ctx->Stencil.FailFunc[0] = GL_KEEP;
- ctx->Stencil.FailFunc[1] = GL_KEEP;
- ctx->Stencil.FailFunc[2] = GL_KEEP;
- ctx->Stencil.ZPassFunc[0] = GL_KEEP;
- ctx->Stencil.ZPassFunc[1] = GL_KEEP;
- ctx->Stencil.ZPassFunc[2] = GL_KEEP;
- ctx->Stencil.ZFailFunc[0] = GL_KEEP;
- ctx->Stencil.ZFailFunc[1] = GL_KEEP;
- ctx->Stencil.ZFailFunc[2] = GL_KEEP;
- ctx->Stencil.Ref[0] = 0;
- ctx->Stencil.Ref[1] = 0;
- ctx->Stencil.Ref[2] = 0;
- ctx->Stencil.ValueMask[0] = ~0U;
- ctx->Stencil.ValueMask[1] = ~0U;
- ctx->Stencil.ValueMask[2] = ~0U;
- ctx->Stencil.WriteMask[0] = ~0U;
- ctx->Stencil.WriteMask[1] = ~0U;
- ctx->Stencil.WriteMask[2] = ~0U;
- ctx->Stencil.Clear = 0;
- ctx->Stencil._BackFace = 1;
-}
diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h
deleted file mode 100644
index b772bfd..0000000
--- a/src/mesa/main/stencil.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * \file stencil.h
- * Stencil operations.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#ifndef STENCIL_H
-#define STENCIL_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-extern void GLAPIENTRY
-_mesa_ClearStencil( GLint s );
-
-
-extern void GLAPIENTRY
-_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask );
-
-
-extern void GLAPIENTRY
-_mesa_StencilMask( GLuint mask );
-
-
-extern void GLAPIENTRY
-_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass );
-
-
-extern void GLAPIENTRY
-_mesa_ActiveStencilFaceEXT(GLenum face);
-
-
-extern void GLAPIENTRY
-_mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
-
-
-extern void GLAPIENTRY
-_mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
-
-
-extern void GLAPIENTRY
-_mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-
-extern void GLAPIENTRY
-_mesa_StencilMaskSeparate(GLenum face, GLuint mask);
-
-
-extern void
-_mesa_update_stencil(struct gl_context *ctx);
-
-
-extern void
-_mesa_init_stencil( struct gl_context * ctx );
-
-#endif
diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c
deleted file mode 100644
index 2c8bcbe..0000000
--- a/src/mesa/main/syncobj.c
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \file syncobj.c
- * Sync object management.
- *
- * Unlike textures and other objects that are shared between contexts, sync
- * objects are not bound to the context. As a result, the reference counting
- * and delete behavior of sync objects is slightly different. References to
- * sync objects are added:
- *
- * - By \c glFencSynce. This sets the initial reference count to 1.
- * - At the start of \c glClientWaitSync. The reference is held for the
- * duration of the wait call.
- *
- * References are removed:
- *
- * - By \c glDeleteSync.
- * - At the end of \c glClientWaitSync.
- *
- * Additionally, drivers may call \c _mesa_ref_sync_object and
- * \c _mesa_unref_sync_object as needed to implement \c ServerWaitSync.
- *
- * As with shader objects, sync object names become invalid as soon as
- * \c glDeleteSync is called. For this reason \c glDeleteSync sets the
- * \c DeletePending flag. All functions validate object handles by testing
- * this flag.
- *
- * \note
- * Only \c GL_ARB_sync objects are shared between contexts. If support is ever
- * added for either \c GL_NV_fence or \c GL_APPLE_fence different semantics
- * will need to be implemented.
- *
- * \author Ian Romanick <ian.d.romanick@intel.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "get.h"
-#include "dispatch.h"
-
-#if FEATURE_ARB_sync
-#include "syncobj.h"
-
-static struct gl_sync_object *
-_mesa_new_sync_object(struct gl_context *ctx, GLenum type)
-{
- struct gl_sync_object *s = MALLOC_STRUCT(gl_sync_object);
- (void) ctx;
- (void) type;
-
- return s;
-}
-
-
-static void
-_mesa_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
-{
- (void) ctx;
- free(syncObj);
-}
-
-
-static void
-_mesa_fence_sync(struct gl_context *ctx, struct gl_sync_object *syncObj,
- GLenum condition, GLbitfield flags)
-{
- (void) ctx;
- (void) condition;
- (void) flags;
-
- syncObj->StatusFlag = 1;
-}
-
-
-static void
-_mesa_check_sync(struct gl_context *ctx, struct gl_sync_object *syncObj)
-{
- (void) ctx;
- (void) syncObj;
-
- /* No-op for software rendering. Hardware drivers will need to determine
- * whether the state of the sync object has changed.
- */
-}
-
-
-static void
-_mesa_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj,
- GLbitfield flags, GLuint64 timeout)
-{
- (void) ctx;
- (void) syncObj;
- (void) flags;
- (void) timeout;
-
- /* No-op for software rendering. Hardware drivers will need to wait until
- * the state of the sync object changes or the timeout expires.
- */
-}
-
-
-void
-_mesa_init_sync_object_functions(struct dd_function_table *driver)
-{
- driver->NewSyncObject = _mesa_new_sync_object;
- driver->FenceSync = _mesa_fence_sync;
- driver->DeleteSyncObject = _mesa_delete_sync_object;
- driver->CheckSync = _mesa_check_sync;
-
- /* Use the same no-op wait function for both.
- */
- driver->ClientWaitSync = _mesa_wait_sync;
- driver->ServerWaitSync = _mesa_wait_sync;
-}
-
-
-void
-_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.
- */
-void
-_mesa_init_sync(struct gl_context *ctx)
-{
- (void) ctx;
-}
-
-
-/**
- * Free the context state related to sync objects.
- */
-void
-_mesa_free_sync_data(struct gl_context *ctx)
-{
- (void) ctx;
-}
-
-
-static int
-_mesa_validate_sync(struct gl_sync_object *syncObj)
-{
- return (syncObj != NULL)
- && (syncObj->Type == GL_SYNC_FENCE)
- && !syncObj->DeletePending;
-}
-
-
-void
-_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
-{
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
- syncObj->RefCount++;
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-}
-
-
-void
-_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
-{
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
- syncObj->RefCount--;
- if (syncObj->RefCount == 0) {
- remove_from_list(& syncObj->link);
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-
- ctx->Driver.DeleteSyncObject(ctx, syncObj);
- } else {
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
- }
-}
-
-
-GLboolean GLAPIENTRY
-_mesa_IsSync(GLsync sync)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync;
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
-
- return _mesa_validate_sync(syncObj) ? GL_TRUE : GL_FALSE;
-}
-
-
-void GLAPIENTRY
-_mesa_DeleteSync(GLsync sync)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- /* From the GL_ARB_sync spec:
- *
- * DeleteSync will silently ignore a <sync> value of zero. An
- * INVALID_VALUE error is generated if <sync> is neither zero nor the
- * name of a sync object.
- */
- if (sync == 0) {
- return;
- }
-
- if (!_mesa_validate_sync(syncObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteSync");
- return;
- }
-
- /* If there are no client-waits or server-waits pending on this sync, delete
- * the underlying object.
- */
- syncObj->DeletePending = GL_TRUE;
- _mesa_unref_sync_object(ctx, syncObj);
-}
-
-
-GLsync GLAPIENTRY
-_mesa_FenceSync(GLenum condition, GLbitfield flags)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_sync_object *syncObj;
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
-
- if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glFenceSync(condition=0x%x)",
- condition);
- return 0;
- }
-
- if (flags != 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glFenceSync(flags=0x%x)",
- condition);
- return 0;
- }
-
- syncObj = ctx->Driver.NewSyncObject(ctx, GL_SYNC_FENCE);
- if (syncObj != NULL) {
- syncObj->Type = GL_SYNC_FENCE;
- /* The name is not currently used, and it is never visible to
- * applications. If sync support is extended to provide support for
- * NV_fence, this field will be used. We'll also need to add an object
- * ID hashtable.
- */
- syncObj->Name = 1;
- syncObj->RefCount = 1;
- syncObj->DeletePending = GL_FALSE;
- syncObj->SyncCondition = condition;
- syncObj->Flags = flags;
- syncObj->StatusFlag = 0;
-
- ctx->Driver.FenceSync(ctx, syncObj, condition, flags);
-
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
- insert_at_tail(& ctx->Shared->SyncObjects, & syncObj->link);
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-
- return (GLsync) syncObj;
- }
-
- return NULL;
-}
-
-
-GLenum GLAPIENTRY
-_mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync;
- GLenum ret;
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_WAIT_FAILED);
-
- if (!_mesa_validate_sync(syncObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glClientWaitSync");
- return GL_WAIT_FAILED;
- }
-
- if ((flags & ~GL_SYNC_FLUSH_COMMANDS_BIT) != 0) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glClientWaitSync(flags=0x%x)", flags);
- return GL_WAIT_FAILED;
- }
-
- _mesa_ref_sync_object(ctx, syncObj);
-
- /* From the GL_ARB_sync spec:
- *
- * ClientWaitSync returns one of four status values. A return value of
- * ALREADY_SIGNALED indicates that <sync> was signaled at the time
- * ClientWaitSync was called. ALREADY_SIGNALED will always be returned
- * if <sync> was signaled, even if the value of <timeout> is zero.
- */
- ctx->Driver.CheckSync(ctx, syncObj);
- if (syncObj->StatusFlag) {
- ret = GL_ALREADY_SIGNALED;
- } else {
- ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout);
-
- ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED;
- }
-
- _mesa_unref_sync_object(ctx, syncObj);
- return ret;
-}
-
-
-void GLAPIENTRY
-_mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!_mesa_validate_sync(syncObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glWaitSync");
- return;
- }
-
- if (flags != 0) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glWaitSync(flags=0x%x)", flags);
- return;
- }
-
- /* From the GL_ARB_sync spec:
- *
- * If the value of <timeout> is zero, then WaitSync does nothing.
- */
- if (timeout == 0) {
- return;
- }
-
- ctx->Driver.ServerWaitSync(ctx, syncObj, flags, timeout);
-}
-
-
-void GLAPIENTRY
-_mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length,
- GLint *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync;
- GLsizei size = 0;
- GLint v[1];
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!_mesa_validate_sync(syncObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetSynciv");
- return;
- }
-
- switch (pname) {
- case GL_OBJECT_TYPE:
- v[0] = syncObj->Type;
- size = 1;
- break;
-
- case GL_SYNC_CONDITION:
- v[0] = syncObj->SyncCondition;
- size = 1;
- break;
-
- case GL_SYNC_STATUS:
- /* Update the state of the sync by dipping into the driver. Note that
- * this call won't block. It just updates state in the common object
- * data from the current driver state.
- */
- ctx->Driver.CheckSync(ctx, syncObj);
-
- v[0] = (syncObj->StatusFlag) ? GL_SIGNALED : GL_UNSIGNALED;
- size = 1;
- break;
-
- case GL_SYNC_FLAGS:
- v[0] = syncObj->Flags;
- size = 1;
- break;
-
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetSynciv(pname=0x%x)\n", pname);
- return;
- }
-
- if (size > 0) {
- const GLsizei copy_count = MIN2(size, bufSize);
-
- memcpy(values, v, sizeof(GLint) * copy_count);
- }
-
- if (length != NULL) {
- *length = size;
- }
-}
-
-#endif /* FEATURE_ARB_sync */
diff --git a/src/mesa/main/syncobj.h b/src/mesa/main/syncobj.h
deleted file mode 100644
index 51de9bf..0000000
--- a/src/mesa/main/syncobj.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \file syncobj.h
- * Sync object management.
- *
- * \author Ian Romanick <ian.d.romanick@intel.com>
- */
-
-#ifndef SYNCOBJ_H
-#define SYNCOBJ_H
-
-#include "glheader.h"
-#include "mfeatures.h"
-
-struct _glapi_table;
-struct dd_function_table;
-struct gl_context;
-struct gl_sync_object;
-
-#if FEATURE_ARB_sync
-
-extern void
-_mesa_init_sync_object_functions(struct dd_function_table *driver);
-
-extern void
-_mesa_init_sync_dispatch(struct _glapi_table *disp);
-
-extern void
-_mesa_init_sync(struct gl_context *);
-
-extern void
-_mesa_free_sync_data(struct gl_context *);
-
-extern void
-_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj);
-
-extern void
-_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj);
-
-extern GLboolean GLAPIENTRY
-_mesa_IsSync(GLsync sync);
-
-extern void GLAPIENTRY
-_mesa_DeleteSync(GLsync sync);
-
-extern GLsync GLAPIENTRY
-_mesa_FenceSync(GLenum condition, GLbitfield flags);
-
-extern GLenum GLAPIENTRY
-_mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
-
-extern void GLAPIENTRY
-_mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
-
-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(struct gl_context *ctx)
-{
-}
-
-static INLINE void
-_mesa_free_sync_data(struct gl_context *ctx)
-{
-}
-
-static INLINE void
-_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
-{
- ASSERT_NO_FEATURE();
-}
-
-static INLINE void
-_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
-{
- ASSERT_NO_FEATURE();
-}
-
-#endif /* FEATURE_ARB_sync */
-
-#endif /* SYNCOBJ_H */
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
deleted file mode 100644
index e3d2a78..0000000
--- a/src/mesa/main/texcompress.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.1
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- * Copyright (c) 2008 VMware, 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
- * 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 texcompress.c
- * Helper functions for texture compression.
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "formats.h"
-#include "texcompress.h"
-
-
-/**
- * Return list of (and count of) all specific texture compression
- * formats that are supported.
- *
- * \param ctx the GL context
- * \param formats the resulting format list (may be NULL).
- * \param all if true return all formats, even those with some kind
- * of restrictions/limitations (See GL_ARB_texture_compression
- * spec for more info).
- *
- * \return number of formats.
- */
-GLuint
-_mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats, GLboolean all)
-{
- GLuint n = 0;
- if (ctx->Extensions.TDFX_texture_compression_FXT1) {
- if (formats) {
- formats[n++] = GL_COMPRESSED_RGB_FXT1_3DFX;
- formats[n++] = GL_COMPRESSED_RGBA_FXT1_3DFX;
- }
- else {
- n += 2;
- }
- }
- if (ctx->Extensions.EXT_texture_compression_s3tc) {
- if (formats) {
- formats[n++] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
- /* This format has some restrictions/limitations and so should
- * not be returned via the GL_COMPRESSED_TEXTURE_FORMATS query.
- * Specifically, all transparent pixels become black. NVIDIA
- * omits this format too.
- */
- if (all)
- formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
- formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
- }
- else {
- n += 3;
- if (all)
- n += 1;
- }
- }
- if (ctx->Extensions.S3_s3tc) {
- if (formats) {
- formats[n++] = GL_RGB_S3TC;
- formats[n++] = GL_RGB4_S3TC;
- formats[n++] = GL_RGBA_S3TC;
- formats[n++] = GL_RGBA4_S3TC;
- }
- else {
- n += 4;
- }
- }
-#if FEATURE_EXT_texture_sRGB
- if (ctx->Extensions.EXT_texture_sRGB) {
- if (formats) {
- formats[n++] = GL_COMPRESSED_SRGB_S3TC_DXT1_EXT;
- formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
- formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
- formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
- }
- else {
- n += 4;
- }
- }
-#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
-}
-
-
-/**
- * Convert a compressed MESA_FORMAT_x to a GLenum.
- */
-gl_format
-_mesa_glenum_to_compressed_format(GLenum format)
-{
- switch (format) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return MESA_FORMAT_RGB_FXT1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return MESA_FORMAT_RGBA_FXT1;
-
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_RGB_S3TC:
- return MESA_FORMAT_RGB_DXT1;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_RGB4_S3TC:
- return MESA_FORMAT_RGBA_DXT1;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_RGBA_S3TC:
- return MESA_FORMAT_RGBA_DXT3;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_RGBA4_S3TC:
- return MESA_FORMAT_RGBA_DXT5;
-
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- return MESA_FORMAT_SRGB_DXT1;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- return MESA_FORMAT_SRGBA_DXT1;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- return MESA_FORMAT_SRGBA_DXT3;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- return MESA_FORMAT_SRGBA_DXT5;
-
- default:
- return MESA_FORMAT_NONE;
- }
-}
-
-
-/**
- * Given a compressed MESA_FORMAT_x value, return the corresponding
- * GLenum for that format.
- * This is needed for glGetTexLevelParameter(GL_TEXTURE_INTERNAL_FORMAT)
- * which must return the specific texture format used when the user might
- * have originally specified a generic compressed format in their
- * glTexImage2D() call.
- * For non-compressed textures, we always return the user-specified
- * internal format unchanged.
- */
-GLenum
-_mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat)
-{
- switch (mesaFormat) {
-#if FEATURE_texture_fxt1
- case MESA_FORMAT_RGB_FXT1:
- return GL_COMPRESSED_RGB_FXT1_3DFX;
- case MESA_FORMAT_RGBA_FXT1:
- return GL_COMPRESSED_RGBA_FXT1_3DFX;
-#endif
-#if FEATURE_texture_s3tc
- case MESA_FORMAT_RGB_DXT1:
- return GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
- case MESA_FORMAT_RGBA_DXT1:
- return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- case MESA_FORMAT_RGBA_DXT3:
- return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
- case MESA_FORMAT_RGBA_DXT5:
- return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
-#if FEATURE_EXT_texture_sRGB
- case MESA_FORMAT_SRGB_DXT1:
- return GL_COMPRESSED_SRGB_S3TC_DXT1_EXT;
- case MESA_FORMAT_SRGBA_DXT1:
- return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
- case MESA_FORMAT_SRGBA_DXT3:
- return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
- case MESA_FORMAT_SRGBA_DXT5:
- return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
-#endif
-#endif
- default:
- _mesa_problem(ctx, "Unexpected mesa texture format in"
- " _mesa_compressed_format_to_glenum()");
- return 0;
- }
-}
-
-
-/*
- * Return the address of the pixel at (col, row, img) in a
- * compressed texture image.
- * \param col, row, img - image position (3D), should be a multiple of the
- * format's block size.
- * \param format - compressed image format
- * \param width - image width (stride) in pixels
- * \param image - the image address
- * \return address of pixel at (row, col, img)
- */
-GLubyte *
-_mesa_compressed_image_address(GLint col, GLint row, GLint img,
- gl_format mesaFormat,
- GLsizei width, const GLubyte *image)
-{
- /* XXX only 2D images implemented, not 3D */
- const GLuint blockSize = _mesa_get_format_bytes(mesaFormat);
- GLuint bw, bh;
- GLint offset;
-
- _mesa_get_format_block_size(mesaFormat, &bw, &bh);
-
- ASSERT(col % bw == 0);
- ASSERT(row % bh == 0);
-
- offset = ((width + bw - 1) / bw) * (row / bh) + col / bw;
- offset *= blockSize;
-
- return (GLubyte *) image + offset;
-}
diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h
deleted file mode 100644
index 19b08bb..0000000
--- a/src/mesa/main/texcompress.h
+++ /dev/null
@@ -1,59 +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 TEXCOMPRESS_H
-#define TEXCOMPRESS_H
-
-#include "formats.h"
-#include "glheader.h"
-#include "mfeatures.h"
-
-struct gl_context;
-
-#if _HAVE_FULL_GL
-
-extern GLuint
-_mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats, GLboolean all);
-
-extern gl_format
-_mesa_glenum_to_compressed_format(GLenum format);
-
-extern GLenum
-_mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat);
-
-extern GLubyte *
-_mesa_compressed_image_address(GLint col, GLint row, GLint img,
- gl_format mesaFormat,
- GLsizei width, const GLubyte *image);
-
-#else /* _HAVE_FULL_GL */
-
-/* no-op macros */
-#define _mesa_get_compressed_formats( c, f ) 0
-#define _mesa_compressed_image_address(c, r, i, f, w, i2 ) 0
-#define _mesa_compress_teximage( c, w, h, sF, s, sRS, dF, d, drs ) ((void)0)
-
-#endif /* _HAVE_FULL_GL */
-
-#endif /* TEXCOMPRESS_H */
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
deleted file mode 100644
index 33f46d4..0000000
--- a/src/mesa/main/texcompress_fxt1.c
+++ /dev/null
@@ -1,1650 +0,0 @@
-/*
- * 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 texcompress_fxt1.c
- * GL_3DFX_texture_compression_FXT1 support.
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "image.h"
-#include "macros.h"
-#include "mipmap.h"
-#include "texcompress.h"
-#include "texcompress_fxt1.h"
-#include "texstore.h"
-
-
-#if FEATURE_texture_fxt1
-
-
-static void
-fxt1_encode (GLuint width, GLuint height, GLint comps,
- const void *source, GLint srcRowStride,
- void *dest, GLint destRowStride);
-
-void
-fxt1_decode_1 (const void *texture, GLint stride,
- GLint i, GLint j, GLchan *rgba);
-
-
-/**
- * Store user's image in rgb_fxt1 format.
- */
-GLboolean
-_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
-{
- const GLchan *pixels;
- GLint srcRowStride;
- GLubyte *dst;
- const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
- const GLchan *tempImage = NULL;
-
- ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1);
- ASSERT(dstXoffset % 8 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- if (srcFormat != GL_RGB ||
- srcType != CHAN_TYPE ||
- ctx->_ImageTransferState ||
- srcPacking->SwapBytes) {
- /* convert image to RGB/GLchan */
- tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
- pixels = tempImage;
- srcRowStride = 3 * srcWidth;
- srcFormat = GL_RGB;
- }
- else {
- pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
- }
-
- dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
-
- fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride,
- dst, dstRowStride);
-
- if (tempImage)
- free((void*) tempImage);
-
- return GL_TRUE;
-}
-
-
-/**
- * Store user's image in rgba_fxt1 format.
- */
-GLboolean
-_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
-{
- const GLchan *pixels;
- GLint srcRowStride;
- GLubyte *dst;
- GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
- const GLchan *tempImage = NULL;
-
- ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1);
- ASSERT(dstXoffset % 8 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- if (srcFormat != GL_RGBA ||
- srcType != CHAN_TYPE ||
- ctx->_ImageTransferState ||
- srcPacking->SwapBytes) {
- /* convert image to RGBA/GLchan */
- tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
- pixels = tempImage;
- srcRowStride = 4 * srcWidth;
- srcFormat = GL_RGBA;
- }
- else {
- pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
- }
-
- dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
-
- fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride,
- dst, dstRowStride);
-
- if (tempImage)
- free((void*) tempImage);
-
- return GL_TRUE;
-}
-
-
-void
-_mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- (void) k;
- fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba);
- texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
- texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
- texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
- texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
-}
-
-
-void
-_mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- (void) k;
- fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba);
- texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
- texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
- texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
- texel[ACOMP] = 1.0F;
-}
-
-
-
-/***************************************************************************\
- * FXT1 encoder
- *
- * The encoder was built by reversing the decoder,
- * and is vaguely based on Texus2 by 3dfx. Note that this code
- * is merely a proof of concept, since it is highly UNoptimized;
- * moreover, it is sub-optimal due to initial conditions passed
- * to Lloyd's algorithm (the interpolation modes are even worse).
-\***************************************************************************/
-
-
-#define MAX_COMP 4 /* ever needed maximum number of components in texel */
-#define MAX_VECT 4 /* ever needed maximum number of base vectors to find */
-#define N_TEXELS 32 /* number of texels in a block (always 32) */
-#define LL_N_REP 50 /* number of iterations in lloyd's vq */
-#define LL_RMS_D 10 /* fault tolerance (maximum delta) */
-#define LL_RMS_E 255 /* fault tolerance (maximum error) */
-#define ALPHA_TS 2 /* alpha threshold: (255 - ALPHA_TS) deemed opaque */
-#define ISTBLACK(v) (*((GLuint *)(v)) == 0)
-
-
-/*
- * Define a 64-bit unsigned integer type and macros
- */
-#if 1
-
-#define FX64_NATIVE 1
-
-typedef uint64_t Fx64;
-
-#define FX64_MOV32(a, b) a = b
-#define FX64_OR32(a, b) a |= b
-#define FX64_SHL(a, c) a <<= c
-
-#else
-
-#define FX64_NATIVE 0
-
-typedef struct {
- GLuint lo, hi;
-} Fx64;
-
-#define FX64_MOV32(a, b) a.lo = b
-#define FX64_OR32(a, b) a.lo |= b
-
-#define FX64_SHL(a, c) \
- do { \
- if ((c) >= 32) { \
- a.hi = a.lo << ((c) - 32); \
- a.lo = 0; \
- } else { \
- a.hi = (a.hi << (c)) | (a.lo >> (32 - (c))); \
- a.lo <<= (c); \
- } \
- } while (0)
-
-#endif
-
-
-#define F(i) (GLfloat)1 /* can be used to obtain an oblong metric: 0.30 / 0.59 / 0.11 */
-#define SAFECDOT 1 /* for paranoids */
-
-#define MAKEIVEC(NV, NC, IV, B, V0, V1) \
- do { \
- /* compute interpolation vector */ \
- GLfloat d2 = 0.0F; \
- GLfloat rd2; \
- \
- for (i = 0; i < NC; i++) { \
- IV[i] = (V1[i] - V0[i]) * F(i); \
- d2 += IV[i] * IV[i]; \
- } \
- rd2 = (GLfloat)NV / d2; \
- B = 0; \
- for (i = 0; i < NC; i++) { \
- IV[i] *= F(i); \
- B -= IV[i] * V0[i]; \
- IV[i] *= rd2; \
- } \
- B = B * rd2 + 0.5f; \
- } while (0)
-
-#define CALCCDOT(TEXEL, NV, NC, IV, B, V)\
- do { \
- GLfloat dot = 0.0F; \
- for (i = 0; i < NC; i++) { \
- dot += V[i] * IV[i]; \
- } \
- TEXEL = (GLint)(dot + B); \
- if (SAFECDOT) { \
- if (TEXEL < 0) { \
- TEXEL = 0; \
- } else if (TEXEL > NV) { \
- TEXEL = NV; \
- } \
- } \
- } while (0)
-
-
-static GLint
-fxt1_bestcol (GLfloat vec[][MAX_COMP], GLint nv,
- GLubyte input[MAX_COMP], GLint nc)
-{
- GLint i, j, best = -1;
- GLfloat err = 1e9; /* big enough */
-
- for (j = 0; j < nv; j++) {
- GLfloat e = 0.0F;
- for (i = 0; i < nc; i++) {
- e += (vec[j][i] - input[i]) * (vec[j][i] - input[i]);
- }
- if (e < err) {
- err = e;
- best = j;
- }
- }
-
- return best;
-}
-
-
-static GLint
-fxt1_worst (GLfloat vec[MAX_COMP],
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
- GLint i, k, worst = -1;
- GLfloat err = -1.0F; /* small enough */
-
- for (k = 0; k < n; k++) {
- GLfloat e = 0.0F;
- for (i = 0; i < nc; i++) {
- e += (vec[i] - input[k][i]) * (vec[i] - input[k][i]);
- }
- if (e > err) {
- err = e;
- worst = k;
- }
- }
-
- return worst;
-}
-
-
-static GLint
-fxt1_variance (GLdouble variance[MAX_COMP],
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
- GLint i, k, best = 0;
- GLint sx, sx2;
- GLdouble var, maxvar = -1; /* small enough */
- GLdouble teenth = 1.0 / n;
-
- for (i = 0; i < nc; i++) {
- sx = sx2 = 0;
- for (k = 0; k < n; k++) {
- GLint t = input[k][i];
- sx += t;
- sx2 += t * t;
- }
- var = sx2 * teenth - sx * sx * teenth * teenth;
- if (maxvar < var) {
- maxvar = var;
- best = i;
- }
- if (variance) {
- variance[i] = var;
- }
- }
-
- return best;
-}
-
-
-static GLint
-fxt1_choose (GLfloat vec[][MAX_COMP], GLint nv,
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
-#if 0
- /* Choose colors from a grid.
- */
- GLint i, j;
-
- for (j = 0; j < nv; j++) {
- GLint m = j * (n - 1) / (nv - 1);
- for (i = 0; i < nc; i++) {
- vec[j][i] = input[m][i];
- }
- }
-#else
- /* Our solution here is to find the darkest and brightest colors in
- * the 8x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- GLint i, j, k;
- GLint minSum = 2000; /* big enough */
- GLint maxSum = -1; /* small enough */
- GLint minCol = 0; /* phoudoin: silent compiler! */
- GLint maxCol = 0; /* phoudoin: silent compiler! */
-
- struct {
- GLint flag;
- GLint key;
- GLint freq;
- GLint idx;
- } hist[N_TEXELS];
- GLint lenh = 0;
-
- memset(hist, 0, sizeof(hist));
-
- for (k = 0; k < n; k++) {
- GLint l;
- GLint key = 0;
- GLint sum = 0;
- for (i = 0; i < nc; i++) {
- key <<= 8;
- key |= input[k][i];
- sum += input[k][i];
- }
- for (l = 0; l < n; l++) {
- if (!hist[l].flag) {
- /* alloc new slot */
- hist[l].flag = !0;
- hist[l].key = key;
- hist[l].freq = 1;
- hist[l].idx = k;
- lenh = l + 1;
- break;
- } else if (hist[l].key == key) {
- hist[l].freq++;
- break;
- }
- }
- if (minSum > sum) {
- minSum = sum;
- minCol = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxCol = k;
- }
- }
-
- if (lenh <= nv) {
- for (j = 0; j < lenh; j++) {
- for (i = 0; i < nc; i++) {
- vec[j][i] = (GLfloat)input[hist[j].idx][i];
- }
- }
- for (; j < nv; j++) {
- for (i = 0; i < nc; i++) {
- vec[j][i] = vec[0][i];
- }
- }
- return 0;
- }
-
- for (j = 0; j < nv; j++) {
- for (i = 0; i < nc; i++) {
- vec[j][i] = ((nv - 1 - j) * input[minCol][i] + j * input[maxCol][i] + (nv - 1) / 2) / (GLfloat)(nv - 1);
- }
- }
-#endif
-
- return !0;
-}
-
-
-static GLint
-fxt1_lloyd (GLfloat vec[][MAX_COMP], GLint nv,
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
- /* Use the generalized lloyd's algorithm for VQ:
- * find 4 color vectors.
- *
- * for each sample color
- * sort to nearest vector.
- *
- * replace each vector with the centroid of its matching colors.
- *
- * repeat until RMS doesn't improve.
- *
- * if a color vector has no samples, or becomes the same as another
- * vector, replace it with the color which is farthest from a sample.
- *
- * vec[][MAX_COMP] initial vectors and resulting colors
- * nv number of resulting colors required
- * input[N_TEXELS][MAX_COMP] input texels
- * nc number of components in input / vec
- * n number of input samples
- */
-
- GLint sum[MAX_VECT][MAX_COMP]; /* used to accumulate closest texels */
- GLint cnt[MAX_VECT]; /* how many times a certain vector was chosen */
- GLfloat error, lasterror = 1e9;
-
- GLint i, j, k, rep;
-
- /* the quantizer */
- for (rep = 0; rep < LL_N_REP; rep++) {
- /* reset sums & counters */
- for (j = 0; j < nv; j++) {
- for (i = 0; i < nc; i++) {
- sum[j][i] = 0;
- }
- cnt[j] = 0;
- }
- error = 0;
-
- /* scan whole block */
- for (k = 0; k < n; k++) {
-#if 1
- GLint best = -1;
- GLfloat err = 1e9; /* big enough */
- /* determine best vector */
- for (j = 0; j < nv; j++) {
- GLfloat e = (vec[j][0] - input[k][0]) * (vec[j][0] - input[k][0]) +
- (vec[j][1] - input[k][1]) * (vec[j][1] - input[k][1]) +
- (vec[j][2] - input[k][2]) * (vec[j][2] - input[k][2]);
- if (nc == 4) {
- e += (vec[j][3] - input[k][3]) * (vec[j][3] - input[k][3]);
- }
- if (e < err) {
- err = e;
- best = j;
- }
- }
-#else
- GLint best = fxt1_bestcol(vec, nv, input[k], nc, &err);
-#endif
- assert(best >= 0);
- /* add in closest color */
- for (i = 0; i < nc; i++) {
- sum[best][i] += input[k][i];
- }
- /* mark this vector as used */
- cnt[best]++;
- /* accumulate error */
- error += err;
- }
-
- /* check RMS */
- if ((error < LL_RMS_E) ||
- ((error < lasterror) && ((lasterror - error) < LL_RMS_D))) {
- return !0; /* good match */
- }
- lasterror = error;
-
- /* move each vector to the barycenter of its closest colors */
- for (j = 0; j < nv; j++) {
- if (cnt[j]) {
- GLfloat div = 1.0F / cnt[j];
- for (i = 0; i < nc; i++) {
- vec[j][i] = div * sum[j][i];
- }
- } else {
- /* this vec has no samples or is identical with a previous vec */
- GLint worst = fxt1_worst(vec[j], input, nc, n);
- for (i = 0; i < nc; i++) {
- vec[j][i] = input[worst][i];
- }
- }
- }
- }
-
- return 0; /* could not converge fast enough */
-}
-
-
-static void
-fxt1_quantize_CHROMA (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 4; /* 4 base vectors to find */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLfloat vec[MAX_VECT][MAX_COMP];
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- if (fxt1_choose(vec, n_vect, input, n_comp, N_TEXELS) != 0) {
- fxt1_lloyd(vec, n_vect, input, n_comp, N_TEXELS);
- }
-
- FX64_MOV32(hi, 4); /* cc-chroma = "010" + unused bit */
- for (j = n_vect - 1; j >= 0; j--) {
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
- }
- }
- ((Fx64 *)cc)[1] = hi;
-
- lohi = lolo = 0;
- /* right microtile */
- for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) {
- lohi <<= 2;
- lohi |= fxt1_bestcol(vec, n_vect, input[k], n_comp);
- }
- /* left microtile */
- for (; k >= 0; k--) {
- lolo <<= 2;
- lolo |= fxt1_bestcol(vec, n_vect, input[k], n_comp);
- }
- cc[1] = lohi;
- cc[0] = lolo;
-}
-
-
-static void
-fxt1_quantize_ALPHA0 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP],
- GLubyte reord[N_TEXELS][MAX_COMP], GLint n)
-{
- const GLint n_vect = 3; /* 3 base vectors to find */
- const GLint n_comp = 4; /* 4 components: R, G, B, A */
- GLfloat vec[MAX_VECT][MAX_COMP];
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- /* the last vector indicates zero */
- for (i = 0; i < n_comp; i++) {
- vec[n_vect][i] = 0;
- }
-
- /* the first n texels in reord are guaranteed to be non-zero */
- if (fxt1_choose(vec, n_vect, reord, n_comp, n) != 0) {
- fxt1_lloyd(vec, n_vect, reord, n_comp, n);
- }
-
- FX64_MOV32(hi, 6); /* alpha = "011" + lerp = 0 */
- for (j = n_vect - 1; j >= 0; j--) {
- /* add in alphas */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][ACOMP] / 8.0F));
- }
- for (j = n_vect - 1; j >= 0; j--) {
- for (i = 0; i < n_comp - 1; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
- }
- }
- ((Fx64 *)cc)[1] = hi;
-
- lohi = lolo = 0;
- /* right microtile */
- for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) {
- lohi <<= 2;
- lohi |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp);
- }
- /* left microtile */
- for (; k >= 0; k--) {
- lolo <<= 2;
- lolo |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp);
- }
- cc[1] = lohi;
- cc[0] = lolo;
-}
-
-
-static void
-fxt1_quantize_ALPHA1 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 3; /* highest vector number in each microtile */
- const GLint n_comp = 4; /* 4 components: R, G, B, A */
- GLfloat vec[1 + 1 + 1][MAX_COMP]; /* 1.5 extrema for each sub-block */
- GLfloat b, iv[MAX_COMP]; /* interpolation vector */
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- GLint minSum;
- GLint maxSum;
- GLint minColL = 0, maxColL = 0;
- GLint minColR = 0, maxColR = 0;
- GLint sumL = 0, sumR = 0;
- GLint nn_comp;
- /* Our solution here is to find the darkest and brightest colors in
- * the 4x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- nn_comp = n_comp;
- while ((minColL == maxColL) && nn_comp) {
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- GLint sum = 0;
- for (i = 0; i < nn_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColL = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColL = k;
- }
- sumL += sum;
- }
-
- nn_comp--;
- }
-
- nn_comp = n_comp;
- while ((minColR == maxColR) && nn_comp) {
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = N_TEXELS / 2; k < N_TEXELS; k++) {
- GLint sum = 0;
- for (i = 0; i < nn_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColR = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColR = k;
- }
- sumR += sum;
- }
-
- nn_comp--;
- }
-
- /* choose the common vector (yuck!) */
- {
- GLint j1, j2;
- GLint v1 = 0, v2 = 0;
- GLfloat err = 1e9; /* big enough */
- GLfloat tv[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
- for (i = 0; i < n_comp; i++) {
- tv[0][i] = input[minColL][i];
- tv[1][i] = input[maxColL][i];
- tv[2][i] = input[minColR][i];
- tv[3][i] = input[maxColR][i];
- }
- for (j1 = 0; j1 < 2; j1++) {
- for (j2 = 2; j2 < 4; j2++) {
- GLfloat e = 0.0F;
- for (i = 0; i < n_comp; i++) {
- e += (tv[j1][i] - tv[j2][i]) * (tv[j1][i] - tv[j2][i]);
- }
- if (e < err) {
- err = e;
- v1 = j1;
- v2 = j2;
- }
- }
- }
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = tv[1 - v1][i];
- vec[1][i] = (tv[v1][i] * sumL + tv[v2][i] * sumR) / (sumL + sumR);
- vec[2][i] = tv[5 - v2][i];
- }
- }
-
- /* left microtile */
- cc[0] = 0;
- if (minColL != maxColL) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
-
- /* add in texels */
- lolo = 0;
- for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lolo <<= 2;
- lolo |= texel;
- }
-
- cc[0] = lolo;
- }
-
- /* right microtile */
- cc[1] = 0;
- if (minColR != maxColR) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[1]);
-
- /* add in texels */
- lohi = 0;
- for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lohi <<= 2;
- lohi |= texel;
- }
-
- cc[1] = lohi;
- }
-
- FX64_MOV32(hi, 7); /* alpha = "011" + lerp = 1 */
- for (j = n_vect - 1; j >= 0; j--) {
- /* add in alphas */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][ACOMP] / 8.0F));
- }
- for (j = n_vect - 1; j >= 0; j--) {
- for (i = 0; i < n_comp - 1; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
- }
- }
- ((Fx64 *)cc)[1] = hi;
-}
-
-
-static void
-fxt1_quantize_HI (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP],
- GLubyte reord[N_TEXELS][MAX_COMP], GLint n)
-{
- const GLint n_vect = 6; /* highest vector number */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLfloat b = 0.0F; /* phoudoin: silent compiler! */
- GLfloat iv[MAX_COMP]; /* interpolation vector */
- GLint i, k;
- GLuint hihi; /* high quadword: hi dword */
-
- GLint minSum = 2000; /* big enough */
- GLint maxSum = -1; /* small enough */
- GLint minCol = 0; /* phoudoin: silent compiler! */
- GLint maxCol = 0; /* phoudoin: silent compiler! */
-
- /* Our solution here is to find the darkest and brightest colors in
- * the 8x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- for (k = 0; k < n; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += reord[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minCol = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxCol = k;
- }
- }
-
- hihi = 0; /* cc-hi = "00" */
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- hihi <<= 5;
- hihi |= reord[maxCol][i] >> 3;
- }
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- hihi <<= 5;
- hihi |= reord[minCol][i] >> 3;
- }
- cc[3] = hihi;
- cc[0] = cc[1] = cc[2] = 0;
-
- /* compute interpolation vector */
- if (minCol != maxCol) {
- MAKEIVEC(n_vect, n_comp, iv, b, reord[minCol], reord[maxCol]);
- }
-
- /* add in texels */
- for (k = N_TEXELS - 1; k >= 0; k--) {
- GLint t = k * 3;
- GLuint *kk = (GLuint *)((char *)cc + t / 8);
- GLint texel = n_vect + 1; /* transparent black */
-
- if (!ISTBLACK(input[k])) {
- if (minCol != maxCol) {
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- kk[0] |= texel << (t & 7);
- }
- } else {
- /* add in texel */
- kk[0] |= texel << (t & 7);
- }
- }
-}
-
-
-static void
-fxt1_quantize_MIXED1 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 2; /* highest vector number in each microtile */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLubyte vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
- GLfloat b, iv[MAX_COMP]; /* interpolation vector */
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- GLint minSum;
- GLint maxSum;
- GLint minColL = 0, maxColL = -1;
- GLint minColR = 0, maxColR = -1;
-
- /* Our solution here is to find the darkest and brightest colors in
- * the 4x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- if (!ISTBLACK(input[k])) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColL = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColL = k;
- }
- }
- }
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (; k < N_TEXELS; k++) {
- if (!ISTBLACK(input[k])) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColR = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColR = k;
- }
- }
- }
-
- /* left microtile */
- if (maxColL == -1) {
- /* all transparent black */
- cc[0] = ~0u;
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = 0;
- vec[1][i] = 0;
- }
- } else {
- cc[0] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = input[minColL][i];
- vec[1][i] = input[maxColL][i];
- }
- if (minColL != maxColL) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
-
- /* add in texels */
- lolo = 0;
- for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
- GLint texel = n_vect + 1; /* transparent black */
- if (!ISTBLACK(input[k])) {
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- }
- /* add in texel */
- lolo <<= 2;
- lolo |= texel;
- }
- cc[0] = lolo;
- }
- }
-
- /* right microtile */
- if (maxColR == -1) {
- /* all transparent black */
- cc[1] = ~0u;
- for (i = 0; i < n_comp; i++) {
- vec[2][i] = 0;
- vec[3][i] = 0;
- }
- } else {
- cc[1] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[2][i] = input[minColR][i];
- vec[3][i] = input[maxColR][i];
- }
- if (minColR != maxColR) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[3]);
-
- /* add in texels */
- lohi = 0;
- for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
- GLint texel = n_vect + 1; /* transparent black */
- if (!ISTBLACK(input[k])) {
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- }
- /* add in texel */
- lohi <<= 2;
- lohi |= texel;
- }
- cc[1] = lohi;
- }
- }
-
- FX64_MOV32(hi, 9 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */
- for (j = 2 * 2 - 1; j >= 0; j--) {
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, vec[j][i] >> 3);
- }
- }
- ((Fx64 *)cc)[1] = hi;
-}
-
-
-static void
-fxt1_quantize_MIXED0 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 3; /* highest vector number in each microtile */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLubyte vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
- GLfloat b, iv[MAX_COMP]; /* interpolation vector */
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- GLint minColL = 0, maxColL = 0;
- GLint minColR = 0, maxColR = 0;
-#if 0
- GLint minSum;
- GLint maxSum;
-
- /* Our solution here is to find the darkest and brightest colors in
- * the 4x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColL = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColL = k;
- }
- }
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (; k < N_TEXELS; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColR = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColR = k;
- }
- }
-#else
- GLint minVal;
- GLint maxVal;
- GLint maxVarL = fxt1_variance(NULL, input, n_comp, N_TEXELS / 2);
- GLint maxVarR = fxt1_variance(NULL, &input[N_TEXELS / 2], n_comp, N_TEXELS / 2);
-
- /* Scan the channel with max variance for lo & hi
- * and use those as the two representative colors.
- */
- minVal = 2000; /* big enough */
- maxVal = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- GLint t = input[k][maxVarL];
- if (minVal > t) {
- minVal = t;
- minColL = k;
- }
- if (maxVal < t) {
- maxVal = t;
- maxColL = k;
- }
- }
- minVal = 2000; /* big enough */
- maxVal = -1; /* small enough */
- for (; k < N_TEXELS; k++) {
- GLint t = input[k][maxVarR];
- if (minVal > t) {
- minVal = t;
- minColR = k;
- }
- if (maxVal < t) {
- maxVal = t;
- maxColR = k;
- }
- }
-#endif
-
- /* left microtile */
- cc[0] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = input[minColL][i];
- vec[1][i] = input[maxColL][i];
- }
- if (minColL != maxColL) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
-
- /* add in texels */
- lolo = 0;
- for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lolo <<= 2;
- lolo |= texel;
- }
-
- /* funky encoding for LSB of green */
- if ((GLint)((lolo >> 1) & 1) != (((vec[1][GCOMP] ^ vec[0][GCOMP]) >> 2) & 1)) {
- for (i = 0; i < n_comp; i++) {
- vec[1][i] = input[minColL][i];
- vec[0][i] = input[maxColL][i];
- }
- lolo = ~lolo;
- }
-
- cc[0] = lolo;
- }
-
- /* right microtile */
- cc[1] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[2][i] = input[minColR][i];
- vec[3][i] = input[maxColR][i];
- }
- if (minColR != maxColR) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[3]);
-
- /* add in texels */
- lohi = 0;
- for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lohi <<= 2;
- lohi |= texel;
- }
-
- /* funky encoding for LSB of green */
- if ((GLint)((lohi >> 1) & 1) != (((vec[3][GCOMP] ^ vec[2][GCOMP]) >> 2) & 1)) {
- for (i = 0; i < n_comp; i++) {
- vec[3][i] = input[minColR][i];
- vec[2][i] = input[maxColR][i];
- }
- lohi = ~lohi;
- }
-
- cc[1] = lohi;
- }
-
- FX64_MOV32(hi, 8 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */
- for (j = 2 * 2 - 1; j >= 0; j--) {
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, vec[j][i] >> 3);
- }
- }
- ((Fx64 *)cc)[1] = hi;
-}
-
-
-static void
-fxt1_quantize (GLuint *cc, const GLubyte *lines[], GLint comps)
-{
- GLint trualpha;
- GLubyte reord[N_TEXELS][MAX_COMP];
-
- GLubyte input[N_TEXELS][MAX_COMP];
- GLint i, k, l;
-
- if (comps == 3) {
- /* make the whole block opaque */
- memset(input, -1, sizeof(input));
- }
-
- /* 8 texels each line */
- for (l = 0; l < 4; l++) {
- for (k = 0; k < 4; k++) {
- for (i = 0; i < comps; i++) {
- input[k + l * 4][i] = *lines[l]++;
- }
- }
- for (; k < 8; k++) {
- for (i = 0; i < comps; i++) {
- input[k + l * 4 + 12][i] = *lines[l]++;
- }
- }
- }
-
- /* block layout:
- * 00, 01, 02, 03, 08, 09, 0a, 0b
- * 10, 11, 12, 13, 18, 19, 1a, 1b
- * 04, 05, 06, 07, 0c, 0d, 0e, 0f
- * 14, 15, 16, 17, 1c, 1d, 1e, 1f
- */
-
- /* [dBorca]
- * stupidity flows forth from this
- */
- l = N_TEXELS;
- trualpha = 0;
- if (comps == 4) {
- /* skip all transparent black texels */
- l = 0;
- for (k = 0; k < N_TEXELS; k++) {
- /* test all components against 0 */
- if (!ISTBLACK(input[k])) {
- /* texel is not transparent black */
- COPY_4UBV(reord[l], input[k]);
- if (reord[l][ACOMP] < (255 - ALPHA_TS)) {
- /* non-opaque texel */
- trualpha = !0;
- }
- l++;
- }
- }
- }
-
-#if 0
- if (trualpha) {
- fxt1_quantize_ALPHA0(cc, input, reord, l);
- } else if (l == 0) {
- cc[0] = cc[1] = cc[2] = -1;
- cc[3] = 0;
- } else if (l < N_TEXELS) {
- fxt1_quantize_HI(cc, input, reord, l);
- } else {
- fxt1_quantize_CHROMA(cc, input);
- }
- (void)fxt1_quantize_ALPHA1;
- (void)fxt1_quantize_MIXED1;
- (void)fxt1_quantize_MIXED0;
-#else
- if (trualpha) {
- fxt1_quantize_ALPHA1(cc, input);
- } else if (l == 0) {
- cc[0] = cc[1] = cc[2] = ~0u;
- cc[3] = 0;
- } else if (l < N_TEXELS) {
- fxt1_quantize_MIXED1(cc, input);
- } else {
- fxt1_quantize_MIXED0(cc, input);
- }
- (void)fxt1_quantize_ALPHA0;
- (void)fxt1_quantize_HI;
- (void)fxt1_quantize_CHROMA;
-#endif
-}
-
-
-static void
-fxt1_encode (GLuint width, GLuint height, GLint comps,
- const void *source, GLint srcRowStride,
- void *dest, GLint destRowStride)
-{
- GLuint x, y;
- const GLubyte *data;
- GLuint *encoded = (GLuint *)dest;
- void *newSource = NULL;
-
- assert(comps == 3 || comps == 4);
-
- /* Replicate image if width is not M8 or height is not M4 */
- if ((width & 7) | (height & 3)) {
- GLint newWidth = (width + 7) & ~7;
- GLint newHeight = (height + 3) & ~3;
- newSource = malloc(comps * newWidth * newHeight * sizeof(GLchan));
- if (!newSource) {
- GET_CURRENT_CONTEXT(ctx);
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture compression");
- goto cleanUp;
- }
- _mesa_upscale_teximage2d(width, height, newWidth, newHeight,
- comps, (const GLchan *) source,
- srcRowStride, (GLchan *) newSource);
- source = newSource;
- width = newWidth;
- height = newHeight;
- srcRowStride = comps * newWidth;
- }
-
- /* convert from 16/32-bit channels to GLubyte if needed */
- if (CHAN_TYPE != GL_UNSIGNED_BYTE) {
- const GLuint n = width * height * comps;
- const GLchan *src = (const GLchan *) source;
- GLubyte *dest = (GLubyte *) malloc(n * sizeof(GLubyte));
- GLuint i;
- if (!dest) {
- GET_CURRENT_CONTEXT(ctx);
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture compression");
- goto cleanUp;
- }
- for (i = 0; i < n; i++) {
- dest[i] = CHAN_TO_UBYTE(src[i]);
- }
- if (newSource != NULL) {
- free(newSource);
- }
- newSource = dest; /* we'll free this buffer before returning */
- source = dest; /* the new, GLubyte incoming image */
- }
-
- data = (const GLubyte *) source;
- destRowStride = (destRowStride - width * 2) / 4;
- for (y = 0; y < height; y += 4) {
- GLuint offs = 0 + (y + 0) * srcRowStride;
- for (x = 0; x < width; x += 8) {
- const GLubyte *lines[4];
- lines[0] = &data[offs];
- lines[1] = lines[0] + srcRowStride;
- lines[2] = lines[1] + srcRowStride;
- lines[3] = lines[2] + srcRowStride;
- offs += 8 * comps;
- fxt1_quantize(encoded, lines, comps);
- /* 128 bits per 8x4 block */
- encoded += 4;
- }
- encoded += destRowStride;
- }
-
- cleanUp:
- if (newSource != NULL) {
- free(newSource);
- }
-}
-
-
-/***************************************************************************\
- * FXT1 decoder
- *
- * The decoder is based on GL_3DFX_texture_compression_FXT1
- * specification and serves as a concept for the encoder.
-\***************************************************************************/
-
-
-/* lookup table for scaling 5 bit colors up to 8 bits */
-static const GLubyte _rgb_scale_5[] = {
- 0, 8, 16, 25, 33, 41, 49, 58,
- 66, 74, 82, 90, 99, 107, 115, 123,
- 132, 140, 148, 156, 165, 173, 181, 189,
- 197, 206, 214, 222, 230, 239, 247, 255
-};
-
-/* lookup table for scaling 6 bit colors up to 8 bits */
-static const GLubyte _rgb_scale_6[] = {
- 0, 4, 8, 12, 16, 20, 24, 28,
- 32, 36, 40, 45, 49, 53, 57, 61,
- 65, 69, 73, 77, 81, 85, 89, 93,
- 97, 101, 105, 109, 113, 117, 121, 125,
- 130, 134, 138, 142, 146, 150, 154, 158,
- 162, 166, 170, 174, 178, 182, 186, 190,
- 194, 198, 202, 206, 210, 215, 219, 223,
- 227, 231, 235, 239, 243, 247, 251, 255
-};
-
-
-#define CC_SEL(cc, which) (((GLuint *)(cc))[(which) / 32] >> ((which) & 31))
-#define UP5(c) _rgb_scale_5[(c) & 31]
-#define UP6(c, b) _rgb_scale_6[(((c) & 31) << 1) | ((b) & 1)]
-#define LERP(n, t, c0, c1) (((n) - (t)) * (c0) + (t) * (c1) + (n) / 2) / (n)
-
-
-static void
-fxt1_decode_1HI (const GLubyte *code, GLint t, GLchan *rgba)
-{
- const GLuint *cc;
-
- t *= 3;
- cc = (const GLuint *)(code + t / 8);
- t = (cc[0] >> (t & 7)) & 7;
-
- if (t == 7) {
- rgba[RCOMP] = rgba[GCOMP] = rgba[BCOMP] = rgba[ACOMP] = 0;
- } else {
- GLubyte r, g, b;
- cc = (const GLuint *)(code + 12);
- if (t == 0) {
- b = UP5(CC_SEL(cc, 0));
- g = UP5(CC_SEL(cc, 5));
- r = UP5(CC_SEL(cc, 10));
- } else if (t == 6) {
- b = UP5(CC_SEL(cc, 15));
- g = UP5(CC_SEL(cc, 20));
- r = UP5(CC_SEL(cc, 25));
- } else {
- b = LERP(6, t, UP5(CC_SEL(cc, 0)), UP5(CC_SEL(cc, 15)));
- g = LERP(6, t, UP5(CC_SEL(cc, 5)), UP5(CC_SEL(cc, 20)));
- r = LERP(6, t, UP5(CC_SEL(cc, 10)), UP5(CC_SEL(cc, 25)));
- }
- rgba[RCOMP] = UBYTE_TO_CHAN(r);
- rgba[GCOMP] = UBYTE_TO_CHAN(g);
- rgba[BCOMP] = UBYTE_TO_CHAN(b);
- rgba[ACOMP] = CHAN_MAX;
- }
-}
-
-
-static void
-fxt1_decode_1CHROMA (const GLubyte *code, GLint t, GLchan *rgba)
-{
- const GLuint *cc;
- GLuint kk;
-
- cc = (const GLuint *)code;
- if (t & 16) {
- cc++;
- t &= 15;
- }
- t = (cc[0] >> (t * 2)) & 3;
-
- t *= 15;
- cc = (const GLuint *)(code + 8 + t / 8);
- kk = cc[0] >> (t & 7);
- rgba[BCOMP] = UBYTE_TO_CHAN( UP5(kk) );
- rgba[GCOMP] = UBYTE_TO_CHAN( UP5(kk >> 5) );
- rgba[RCOMP] = UBYTE_TO_CHAN( UP5(kk >> 10) );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-
-static void
-fxt1_decode_1MIXED (const GLubyte *code, GLint t, GLchan *rgba)
-{
- const GLuint *cc;
- GLuint col[2][3];
- GLint glsb, selb;
-
- cc = (const GLuint *)code;
- if (t & 16) {
- t &= 15;
- t = (cc[1] >> (t * 2)) & 3;
- /* col 2 */
- col[0][BCOMP] = (*(const GLuint *)(code + 11)) >> 6;
- col[0][GCOMP] = CC_SEL(cc, 99);
- col[0][RCOMP] = CC_SEL(cc, 104);
- /* col 3 */
- col[1][BCOMP] = CC_SEL(cc, 109);
- col[1][GCOMP] = CC_SEL(cc, 114);
- col[1][RCOMP] = CC_SEL(cc, 119);
- glsb = CC_SEL(cc, 126);
- selb = CC_SEL(cc, 33);
- } else {
- t = (cc[0] >> (t * 2)) & 3;
- /* col 0 */
- col[0][BCOMP] = CC_SEL(cc, 64);
- col[0][GCOMP] = CC_SEL(cc, 69);
- col[0][RCOMP] = CC_SEL(cc, 74);
- /* col 1 */
- col[1][BCOMP] = CC_SEL(cc, 79);
- col[1][GCOMP] = CC_SEL(cc, 84);
- col[1][RCOMP] = CC_SEL(cc, 89);
- glsb = CC_SEL(cc, 125);
- selb = CC_SEL(cc, 1);
- }
-
- if (CC_SEL(cc, 124) & 1) {
- /* alpha[0] == 1 */
-
- if (t == 3) {
- /* zero */
- rgba[RCOMP] = rgba[BCOMP] = rgba[GCOMP] = rgba[ACOMP] = 0;
- } else {
- GLubyte r, g, b;
- if (t == 0) {
- b = UP5(col[0][BCOMP]);
- g = UP5(col[0][GCOMP]);
- r = UP5(col[0][RCOMP]);
- } else if (t == 2) {
- b = UP5(col[1][BCOMP]);
- g = UP6(col[1][GCOMP], glsb);
- r = UP5(col[1][RCOMP]);
- } else {
- b = (UP5(col[0][BCOMP]) + UP5(col[1][BCOMP])) / 2;
- g = (UP5(col[0][GCOMP]) + UP6(col[1][GCOMP], glsb)) / 2;
- r = (UP5(col[0][RCOMP]) + UP5(col[1][RCOMP])) / 2;
- }
- rgba[RCOMP] = UBYTE_TO_CHAN(r);
- rgba[GCOMP] = UBYTE_TO_CHAN(g);
- rgba[BCOMP] = UBYTE_TO_CHAN(b);
- rgba[ACOMP] = CHAN_MAX;
- }
- } else {
- /* alpha[0] == 0 */
- GLubyte r, g, b;
- if (t == 0) {
- b = UP5(col[0][BCOMP]);
- g = UP6(col[0][GCOMP], glsb ^ selb);
- r = UP5(col[0][RCOMP]);
- } else if (t == 3) {
- b = UP5(col[1][BCOMP]);
- g = UP6(col[1][GCOMP], glsb);
- r = UP5(col[1][RCOMP]);
- } else {
- b = LERP(3, t, UP5(col[0][BCOMP]), UP5(col[1][BCOMP]));
- g = LERP(3, t, UP6(col[0][GCOMP], glsb ^ selb),
- UP6(col[1][GCOMP], glsb));
- r = LERP(3, t, UP5(col[0][RCOMP]), UP5(col[1][RCOMP]));
- }
- rgba[RCOMP] = UBYTE_TO_CHAN(r);
- rgba[GCOMP] = UBYTE_TO_CHAN(g);
- rgba[BCOMP] = UBYTE_TO_CHAN(b);
- rgba[ACOMP] = CHAN_MAX;
- }
-}
-
-
-static void
-fxt1_decode_1ALPHA (const GLubyte *code, GLint t, GLchan *rgba)
-{
- const GLuint *cc;
- GLubyte r, g, b, a;
-
- cc = (const GLuint *)code;
- if (CC_SEL(cc, 124) & 1) {
- /* lerp == 1 */
- GLuint col0[4];
-
- if (t & 16) {
- t &= 15;
- t = (cc[1] >> (t * 2)) & 3;
- /* col 2 */
- col0[BCOMP] = (*(const GLuint *)(code + 11)) >> 6;
- col0[GCOMP] = CC_SEL(cc, 99);
- col0[RCOMP] = CC_SEL(cc, 104);
- col0[ACOMP] = CC_SEL(cc, 119);
- } else {
- t = (cc[0] >> (t * 2)) & 3;
- /* col 0 */
- col0[BCOMP] = CC_SEL(cc, 64);
- col0[GCOMP] = CC_SEL(cc, 69);
- col0[RCOMP] = CC_SEL(cc, 74);
- col0[ACOMP] = CC_SEL(cc, 109);
- }
-
- if (t == 0) {
- b = UP5(col0[BCOMP]);
- g = UP5(col0[GCOMP]);
- r = UP5(col0[RCOMP]);
- a = UP5(col0[ACOMP]);
- } else if (t == 3) {
- b = UP5(CC_SEL(cc, 79));
- g = UP5(CC_SEL(cc, 84));
- r = UP5(CC_SEL(cc, 89));
- a = UP5(CC_SEL(cc, 114));
- } else {
- b = LERP(3, t, UP5(col0[BCOMP]), UP5(CC_SEL(cc, 79)));
- g = LERP(3, t, UP5(col0[GCOMP]), UP5(CC_SEL(cc, 84)));
- r = LERP(3, t, UP5(col0[RCOMP]), UP5(CC_SEL(cc, 89)));
- a = LERP(3, t, UP5(col0[ACOMP]), UP5(CC_SEL(cc, 114)));
- }
- } else {
- /* lerp == 0 */
-
- if (t & 16) {
- cc++;
- t &= 15;
- }
- t = (cc[0] >> (t * 2)) & 3;
-
- if (t == 3) {
- /* zero */
- r = g = b = a = 0;
- } else {
- GLuint kk;
- cc = (const GLuint *)code;
- a = UP5(cc[3] >> (t * 5 + 13));
- t *= 15;
- cc = (const GLuint *)(code + 8 + t / 8);
- kk = cc[0] >> (t & 7);
- b = UP5(kk);
- g = UP5(kk >> 5);
- r = UP5(kk >> 10);
- }
- }
- rgba[RCOMP] = UBYTE_TO_CHAN(r);
- rgba[GCOMP] = UBYTE_TO_CHAN(g);
- rgba[BCOMP] = UBYTE_TO_CHAN(b);
- rgba[ACOMP] = UBYTE_TO_CHAN(a);
-}
-
-
-void
-fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */
- GLint i, GLint j, GLchan *rgba)
-{
- static void (*decode_1[]) (const GLubyte *, GLint, GLchan *) = {
- fxt1_decode_1HI, /* cc-high = "00?" */
- fxt1_decode_1HI, /* cc-high = "00?" */
- fxt1_decode_1CHROMA, /* cc-chroma = "010" */
- fxt1_decode_1ALPHA, /* alpha = "011" */
- fxt1_decode_1MIXED, /* mixed = "1??" */
- fxt1_decode_1MIXED, /* mixed = "1??" */
- fxt1_decode_1MIXED, /* mixed = "1??" */
- fxt1_decode_1MIXED /* mixed = "1??" */
- };
-
- const GLubyte *code = (const GLubyte *)texture +
- ((j / 4) * (stride / 8) + (i / 8)) * 16;
- GLint mode = CC_SEL(code, 125);
- GLint t = i & 7;
-
- if (t & 4) {
- t += 12;
- }
- t += (j & 3) * 4;
-
- decode_1[mode](code, t, rgba);
-}
-
-
-#endif /* FEATURE_texture_fxt1 */
diff --git a/src/mesa/main/texcompress_fxt1.h b/src/mesa/main/texcompress_fxt1.h
deleted file mode 100644
index 38048b2..0000000
--- a/src/mesa/main/texcompress_fxt1.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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 TEXCOMPRESS_FXT1_H
-#define TEXCOMPRESS_FXT1_H
-
-#include "glheader.h"
-#include "texstore.h"
-
-struct gl_texture_image;
-
-#if FEATURE_texture_fxt1
-
-extern GLboolean
-_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
-
-extern void
-_mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-#else /* FEATURE_texture_fxt1 */
-
-/* these are used only in texstore_funcs[] */
-#define _mesa_texstore_rgb_fxt1 NULL
-#define _mesa_texstore_rgba_fxt1 NULL
-
-/* these are used only in texfetch_funcs[] */
-#define _mesa_fetch_texel_2d_f_rgba_fxt1 NULL
-#define _mesa_fetch_texel_2d_f_rgb_fxt1 NULL
-
-#endif /* FEATURE_texture_fxt1 */
-
-#endif /* TEXCOMPRESS_FXT1_H */
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
deleted file mode 100644
index 0e893a5..0000000
--- a/src/mesa/main/texcompress_s3tc.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.3
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- * Copyright (c) 2008 VMware, 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
- * 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 texcompress_s3tc.c
- * GL_EXT_texture_compression_s3tc support.
- */
-
-#ifndef USE_EXTERNAL_DXTN_LIB
-#define USE_EXTERNAL_DXTN_LIB 1
-#endif
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "dlopen.h"
-#include "image.h"
-#include "macros.h"
-#include "texcompress.h"
-#include "texcompress_s3tc.h"
-#include "texstore.h"
-
-
-#if FEATURE_texture_s3tc
-
-
-#if defined(_WIN32) || defined(WIN32)
-#define DXTN_LIBNAME "dxtn.dll"
-#define RTLD_LAZY 0
-#define RTLD_GLOBAL 0
-#elif defined(__DJGPP__)
-#define DXTN_LIBNAME "dxtn.dxe"
-#else
-#define DXTN_LIBNAME "libtxc_dxtn.so"
-#endif
-
-#if FEATURE_EXT_texture_sRGB
-/**
- * Convert an 8-bit sRGB value from non-linear space to a
- * linear RGB value in [0, 1].
- * Implemented with a 256-entry lookup table.
- */
-static INLINE GLfloat
-nonlinear_to_linear(GLubyte cs8)
-{
- static GLfloat table[256];
- static GLboolean tableReady = GL_FALSE;
- if (!tableReady) {
- /* compute lookup table now */
- GLuint i;
- for (i = 0; i < 256; i++) {
- const GLfloat cs = UBYTE_TO_FLOAT(i);
- if (cs <= 0.04045) {
- table[i] = cs / 12.92f;
- }
- else {
- table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4);
- }
- }
- tableReady = GL_TRUE;
- }
- return table[cs8];
-}
-#endif /* FEATURE_EXT_texture_sRGB */
-
-typedef void (*dxtFetchTexelFuncExt)( GLint srcRowstride, GLubyte *pixdata, GLint col, GLint row, GLvoid *texelOut );
-
-dxtFetchTexelFuncExt fetch_ext_rgb_dxt1 = NULL;
-dxtFetchTexelFuncExt fetch_ext_rgba_dxt1 = NULL;
-dxtFetchTexelFuncExt fetch_ext_rgba_dxt3 = NULL;
-dxtFetchTexelFuncExt fetch_ext_rgba_dxt5 = NULL;
-
-typedef void (*dxtCompressTexFuncExt)(GLint srccomps, GLint width,
- GLint height, const GLchan *srcPixData,
- GLenum destformat, GLubyte *dest,
- GLint dstRowStride);
-
-static dxtCompressTexFuncExt ext_tx_compress_dxtn = NULL;
-
-static void *dxtlibhandle = NULL;
-
-
-void
-_mesa_init_texture_s3tc( struct gl_context *ctx )
-{
- /* called during context initialization */
- ctx->Mesa_DXTn = GL_FALSE;
-#if USE_EXTERNAL_DXTN_LIB
- if (!dxtlibhandle) {
- dxtlibhandle = _mesa_dlopen(DXTN_LIBNAME, 0);
- if (!dxtlibhandle) {
- _mesa_warning(ctx, "couldn't open " DXTN_LIBNAME ", software DXTn "
- "compression/decompression unavailable");
- }
- else {
- /* the fetch functions are not per context! Might be problematic... */
- fetch_ext_rgb_dxt1 = (dxtFetchTexelFuncExt)
- _mesa_dlsym(dxtlibhandle, "fetch_2d_texel_rgb_dxt1");
- fetch_ext_rgba_dxt1 = (dxtFetchTexelFuncExt)
- _mesa_dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt1");
- fetch_ext_rgba_dxt3 = (dxtFetchTexelFuncExt)
- _mesa_dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt3");
- fetch_ext_rgba_dxt5 = (dxtFetchTexelFuncExt)
- _mesa_dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt5");
- ext_tx_compress_dxtn = (dxtCompressTexFuncExt)
- _mesa_dlsym(dxtlibhandle, "tx_compress_dxtn");
-
- if (!fetch_ext_rgb_dxt1 ||
- !fetch_ext_rgba_dxt1 ||
- !fetch_ext_rgba_dxt3 ||
- !fetch_ext_rgba_dxt5 ||
- !ext_tx_compress_dxtn) {
- _mesa_warning(ctx, "couldn't reference all symbols in "
- DXTN_LIBNAME ", software DXTn compression/decompression "
- "unavailable");
- fetch_ext_rgb_dxt1 = NULL;
- fetch_ext_rgba_dxt1 = NULL;
- fetch_ext_rgba_dxt3 = NULL;
- fetch_ext_rgba_dxt5 = NULL;
- ext_tx_compress_dxtn = NULL;
- _mesa_dlclose(dxtlibhandle);
- dxtlibhandle = NULL;
- }
- }
- }
- if (dxtlibhandle) {
- ctx->Mesa_DXTn = GL_TRUE;
- }
-#else
- (void) ctx;
-#endif
-}
-
-/**
- * Store user's image in rgb_dxt1 format.
- */
-GLboolean
-_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
-{
- const GLchan *pixels;
- GLint srcRowStride;
- GLubyte *dst;
- const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
- const GLchan *tempImage = NULL;
-
- ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1 ||
- dstFormat == MESA_FORMAT_SRGB_DXT1);
- ASSERT(dstXoffset % 4 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- if (srcFormat != GL_RGB ||
- srcType != CHAN_TYPE ||
- ctx->_ImageTransferState ||
- srcPacking->SwapBytes) {
- /* convert image to RGB/GLchan */
- tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
- pixels = tempImage;
- srcRowStride = 3 * srcWidth;
- srcFormat = GL_RGB;
- }
- else {
- pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
- }
-
- dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
-
- if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels,
- GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
- dst, dstRowStride);
- }
- else {
- _mesa_warning(ctx, "external dxt library not available: texstore_rgb_dxt1");
- }
-
- if (tempImage)
- free((void *) tempImage);
-
- return GL_TRUE;
-}
-
-
-/**
- * Store user's image in rgba_dxt1 format.
- */
-GLboolean
-_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
-{
- const GLchan *pixels;
- GLint srcRowStride;
- GLubyte *dst;
- const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
- const GLchan *tempImage = NULL;
-
- ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1 ||
- dstFormat == MESA_FORMAT_SRGBA_DXT1);
- ASSERT(dstXoffset % 4 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- if (srcFormat != GL_RGBA ||
- srcType != CHAN_TYPE ||
- ctx->_ImageTransferState ||
- srcPacking->SwapBytes) {
- /* convert image to RGBA/GLchan */
- tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
- pixels = tempImage;
- srcRowStride = 4 * srcWidth;
- srcFormat = GL_RGBA;
- }
- else {
- pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
- }
-
- dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
- if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
- GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
- dst, dstRowStride);
- }
- else {
- _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt1");
- }
-
- if (tempImage)
- free((void*) tempImage);
-
- return GL_TRUE;
-}
-
-
-/**
- * Store user's image in rgba_dxt3 format.
- */
-GLboolean
-_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
-{
- const GLchan *pixels;
- GLint srcRowStride;
- GLubyte *dst;
- const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
- const GLchan *tempImage = NULL;
-
- ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3 ||
- dstFormat == MESA_FORMAT_SRGBA_DXT3);
- ASSERT(dstXoffset % 4 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- if (srcFormat != GL_RGBA ||
- srcType != CHAN_TYPE ||
- ctx->_ImageTransferState ||
- srcPacking->SwapBytes) {
- /* convert image to RGBA/GLchan */
- tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
- pixels = tempImage;
- srcRowStride = 4 * srcWidth;
- }
- else {
- pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
- }
-
- dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
- if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
- GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
- dst, dstRowStride);
- }
- else {
- _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt3");
- }
-
- if (tempImage)
- free((void *) tempImage);
-
- return GL_TRUE;
-}
-
-
-/**
- * Store user's image in rgba_dxt5 format.
- */
-GLboolean
-_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
-{
- const GLchan *pixels;
- GLint srcRowStride;
- GLubyte *dst;
- const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
- const GLchan *tempImage = NULL;
-
- ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5 ||
- dstFormat == MESA_FORMAT_SRGBA_DXT5);
- ASSERT(dstXoffset % 4 == 0);
- ASSERT(dstYoffset % 4 == 0);
- ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset;
- (void) dstImageOffsets;
-
- if (srcFormat != GL_RGBA ||
- srcType != CHAN_TYPE ||
- ctx->_ImageTransferState ||
- srcPacking->SwapBytes) {
- /* convert image to RGBA/GLchan */
- tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
- pixels = tempImage;
- srcRowStride = 4 * srcWidth;
- }
- else {
- pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
- }
-
- dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat,
- texWidth, (GLubyte *) dstAddr);
- if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
- GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
- dst, dstRowStride);
- }
- else {
- _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt5");
- }
-
- if (tempImage)
- free((void *) tempImage);
-
- return GL_TRUE;
-}
-
-
-static void
-fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- (void) k;
- if (fetch_ext_rgb_dxt1) {
- ASSERT (sizeof(GLchan) == sizeof(GLubyte));
- fetch_ext_rgb_dxt1(texImage->RowStride,
- (GLubyte *)(texImage)->Data, i, j, texel);
- }
- else
- _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1");
-}
-
-
-void
-_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba);
- texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
- texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
- texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
- texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
-}
-
-
-static void
-fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- (void) k;
- if (fetch_ext_rgba_dxt1) {
- fetch_ext_rgba_dxt1(texImage->RowStride,
- (GLubyte *)(texImage)->Data, i, j, texel);
- }
- else
- _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n");
-}
-
-
-void
-_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba);
- texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
- texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
- texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
- texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
-}
-
-
-static void
-fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- (void) k;
- if (fetch_ext_rgba_dxt3) {
- ASSERT (sizeof(GLchan) == sizeof(GLubyte));
- fetch_ext_rgba_dxt3(texImage->RowStride, (GLubyte *)(texImage)->Data,
- i, j, texel);
- }
- else
- _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt3\n");
-}
-
-
-void
-_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba);
- texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
- texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
- texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
- texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
-}
-
-
-static void
-fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- (void) k;
- if (fetch_ext_rgba_dxt5) {
- fetch_ext_rgba_dxt5(texImage->RowStride, (GLubyte *)(texImage)->Data,
- i, j, texel);
- }
- else
- _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt5\n");
-}
-
-
-void
-_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba);
- texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
- texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
- texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
- texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
-}
-
-#if FEATURE_EXT_texture_sRGB
-void
-_mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba);
- texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]);
- texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]);
- texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
- texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
-}
-
-void
-_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba);
- texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]);
- texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]);
- texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
- texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
-}
-
-void
-_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba);
- texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]);
- texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]);
- texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
- texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
-}
-
-void
-_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- /* just sample as GLchan and convert to float here */
- GLchan rgba[4];
- fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba);
- texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]);
- texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]);
- texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
- texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
-}
-#endif /* FEATURE_EXT_texture_sRGB */
-
-
-#endif /* FEATURE_texture_s3tc */
diff --git a/src/mesa/main/texcompress_s3tc.h b/src/mesa/main/texcompress_s3tc.h
deleted file mode 100644
index 74a0343..0000000
--- a/src/mesa/main/texcompress_s3tc.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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 TEXCOMPRESS_S3TC_H
-#define TEXCOMPRESS_S3TC_H
-
-#include "compiler.h"
-#include "glheader.h"
-#include "mfeatures.h"
-#include "texstore.h"
-
-struct gl_context;
-struct gl_texture_image;
-
-#if FEATURE_texture_s3tc
-
-extern GLboolean
-_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
-
-extern void
-_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_srgb_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_init_texture_s3tc(struct gl_context *ctx);
-
-#else /* FEATURE_texture_s3tc */
-
-/* these are used only in texstore_funcs[] */
-#define _mesa_texstore_rgb_dxt1 NULL
-#define _mesa_texstore_rgba_dxt1 NULL
-#define _mesa_texstore_rgba_dxt3 NULL
-#define _mesa_texstore_rgba_dxt5 NULL
-
-/* these are used only in texfetch_funcs[] */
-#define _mesa_fetch_texel_2d_f_rgb_dxt1 NULL
-#define _mesa_fetch_texel_2d_f_rgba_dxt1 NULL
-#define _mesa_fetch_texel_2d_f_rgba_dxt3 NULL
-#define _mesa_fetch_texel_2d_f_rgba_dxt5 NULL
-#define _mesa_fetch_texel_2d_f_srgb_dxt1 NULL
-#define _mesa_fetch_texel_2d_f_srgba_dxt1 NULL
-#define _mesa_fetch_texel_2d_f_srgba_dxt3 NULL
-#define _mesa_fetch_texel_2d_f_srgba_dxt5 NULL
-
-static INLINE void
-_mesa_init_texture_s3tc(struct gl_context *ctx)
-{
-}
-
-#endif /* FEATURE_texture_s3tc */
-
-#endif /* TEXCOMPRESS_S3TC_H */
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
deleted file mode 100644
index 508dbf4..0000000
--- a/src/mesa/main/texenv.c
+++ /dev/null
@@ -1,1036 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-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 texenv.c
- *
- * glTexEnv-related functions
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/enums.h"
-#include "main/macros.h"
-#include "main/texenv.h"
-#include "main/texstate.h"
-
-
-#define TE_ERROR(errCode, msg, value) \
- _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value));
-
-
-/** Set texture env mode */
-static void
-set_env_mode(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
- GLenum mode)
-{
- GLboolean legal;
-
- if (texUnit->EnvMode == mode)
- return;
-
- switch (mode) {
- case GL_MODULATE:
- case GL_BLEND:
- case GL_DECAL:
- case GL_REPLACE:
- legal = GL_TRUE;
- break;
- case GL_REPLACE_EXT:
- mode = GL_REPLACE; /* GL_REPLACE_EXT != GL_REPLACE */
- legal = GL_TRUE;
- break;
- case GL_ADD:
- legal = ctx->Extensions.EXT_texture_env_add;
- break;
- case GL_COMBINE:
- legal = (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine);
- break;
- case GL_COMBINE4_NV:
- legal = ctx->Extensions.NV_texture_env_combine4;
- break;
- default:
- legal = GL_FALSE;
- }
-
- if (legal) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->EnvMode = mode;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- }
-}
-
-
-static void
-set_env_color(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
- const GLfloat *color)
-{
- GLfloat tmp[4];
- tmp[0] = CLAMP(color[0], 0.0F, 1.0F);
- tmp[1] = CLAMP(color[1], 0.0F, 1.0F);
- tmp[2] = CLAMP(color[2], 0.0F, 1.0F);
- tmp[3] = CLAMP(color[3], 0.0F, 1.0F);
- if (TEST_EQ_4V(tmp, texUnit->EnvColor))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->EnvColor, tmp);
-}
-
-
-/** Set an RGB or A combiner mode/function */
-static void
-set_combiner_mode(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
- GLenum pname, GLenum mode)
-{
- GLboolean legal;
-
- if (!ctx->Extensions.EXT_texture_env_combine &&
- !ctx->Extensions.ARB_texture_env_combine) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
-
- switch (mode) {
- case GL_REPLACE:
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_INTERPOLATE:
- legal = GL_TRUE;
- break;
- case GL_SUBTRACT:
- legal = ctx->Extensions.ARB_texture_env_combine;
- break;
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- legal = (ctx->Extensions.EXT_texture_env_dot3 &&
- pname == GL_COMBINE_RGB);
- break;
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- legal = (ctx->Extensions.ARB_texture_env_dot3 &&
- pname == GL_COMBINE_RGB);
- break;
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- legal = ctx->Extensions.ATI_texture_env_combine3;
- break;
- case GL_BUMP_ENVMAP_ATI:
- legal = (ctx->Extensions.ATI_envmap_bumpmap &&
- pname == GL_COMBINE_RGB);
- break;
- default:
- legal = GL_FALSE;
- }
-
- if (!legal) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
-
- switch (pname) {
- case GL_COMBINE_RGB:
- if (texUnit->Combine.ModeRGB == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.ModeRGB = mode;
- break;
-
- case GL_COMBINE_ALPHA:
- if (texUnit->Combine.ModeA == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.ModeA = mode;
- break;
- default:
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- }
-}
-
-
-
-/** Set an RGB or A combiner source term */
-static void
-set_combiner_source(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
- GLenum pname, GLenum param)
-{
- GLuint term;
- GLboolean alpha, legal;
-
- if (!ctx->Extensions.EXT_texture_env_combine &&
- !ctx->Extensions.ARB_texture_env_combine) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
-
- /*
- * Translate pname to (term, alpha).
- *
- * The enums were given sequential values for a reason.
- */
- switch (pname) {
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- case GL_SOURCE3_RGB_NV:
- term = pname - GL_SOURCE0_RGB;
- alpha = GL_FALSE;
- break;
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- case GL_SOURCE3_ALPHA_NV:
- 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);
-
- /*
- * Error-check param (the source term)
- */
- switch (param) {
- case GL_TEXTURE:
- case GL_CONSTANT:
- case GL_PRIMARY_COLOR:
- case GL_PREVIOUS:
- legal = GL_TRUE;
- break;
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- case GL_TEXTURE3:
- case GL_TEXTURE4:
- case GL_TEXTURE5:
- case GL_TEXTURE6:
- case GL_TEXTURE7:
- legal = (ctx->Extensions.ARB_texture_env_crossbar &&
- param - GL_TEXTURE0 < ctx->Const.MaxTextureUnits);
- break;
- case GL_ZERO:
- legal = (ctx->Extensions.ATI_texture_env_combine3 ||
- ctx->Extensions.NV_texture_env_combine4);
- break;
- case GL_ONE:
- legal = ctx->Extensions.ATI_texture_env_combine3;
- break;
- default:
- legal = GL_FALSE;
- }
-
- if (!legal) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", param);
- return;
- }
-
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-
- if (alpha)
- texUnit->Combine.SourceA[term] = param;
- else
- texUnit->Combine.SourceRGB[term] = param;
-}
-
-
-/** Set an RGB or A combiner operand term */
-static void
-set_combiner_operand(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
- GLenum pname, GLenum param)
-{
- GLuint term;
- GLboolean alpha, legal;
-
- if (!ctx->Extensions.EXT_texture_env_combine &&
- !ctx->Extensions.ARB_texture_env_combine) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
-
- /* The enums were given sequential values for a reason.
- */
- switch (pname) {
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- case GL_OPERAND3_RGB_NV:
- term = pname - GL_OPERAND0_RGB;
- alpha = GL_FALSE;
- break;
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- case GL_OPERAND3_ALPHA_NV:
- 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);
-
- /*
- * Error-check param (the source operand)
- */
- switch (param) {
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- /* 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_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:
- legal = GL_FALSE;
- }
-
- if (!legal) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", param);
- return;
- }
-
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-
- if (alpha)
- texUnit->Combine.OperandA[term] = param;
- else
- texUnit->Combine.OperandRGB[term] = param;
-}
-
-
-static void
-set_combiner_scale(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
- GLenum pname, GLfloat scale)
-{
- GLuint shift;
-
- if (!ctx->Extensions.EXT_texture_env_combine &&
- !ctx->Extensions.ARB_texture_env_combine) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
-
- if (scale == 1.0F) {
- shift = 0;
- }
- else if (scale == 2.0F) {
- shift = 1;
- }
- else if (scale == 4.0F) {
- shift = 2;
- }
- else {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" );
- return;
- }
-
- switch (pname) {
- case GL_RGB_SCALE:
- if (texUnit->Combine.ScaleShiftRGB == shift)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.ScaleShiftRGB = shift;
- break;
- case GL_ALPHA_SCALE:
- if (texUnit->Combine.ScaleShiftA == shift)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.ScaleShiftA = shift;
- break;
- default:
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- }
-}
-
-
-
-void GLAPIENTRY
-_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
-{
- GLuint maxUnit;
- GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
- ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
- if (ctx->Texture.CurrentUnit >= maxUnit) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexEnvfv(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- if (target == GL_TEXTURE_ENV) {
- switch (pname) {
- case GL_TEXTURE_ENV_MODE:
- set_env_mode(ctx, texUnit, (GLenum) (GLint) param[0]);
- break;
- case GL_TEXTURE_ENV_COLOR:
- set_env_color(ctx, texUnit, param);
- break;
- case GL_COMBINE_RGB:
- case GL_COMBINE_ALPHA:
- set_combiner_mode(ctx, texUnit, pname, (GLenum) (GLint) param[0]);
- break;
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- case GL_SOURCE3_RGB_NV:
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- case GL_SOURCE3_ALPHA_NV:
- set_combiner_source(ctx, texUnit, pname, (GLenum) (GLint) param[0]);
- break;
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- case GL_OPERAND3_RGB_NV:
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- case GL_OPERAND3_ALPHA_NV:
- set_combiner_operand(ctx, texUnit, pname, (GLenum) (GLint) param[0]);
- break;
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- set_combiner_scale(ctx, texUnit, pname, param[0]);
- break;
- case GL_BUMP_TARGET_ATI:
- if (!ctx->Extensions.ATI_envmap_bumpmap) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
- return;
- }
- if (((GLenum) (GLint) param[0] < GL_TEXTURE0) ||
- ((GLenum) (GLint) param[0] > GL_TEXTURE31)) {
- /* spec doesn't say this but it seems logical */
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param=0x%x)", (GLenum) (GLint) param[0]);
- return;
- }
- if (!((1 << ((GLenum) (GLint) param[0] - GL_TEXTURE0)) & ctx->Const.SupportedBumpUnits)) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", (GLenum) (GLint) param[0]);
- return;
- }
- else {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->BumpTarget = (GLenum) (GLint) param[0];
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
- return;
- }
- }
- else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
- /* GL_EXT_texture_lod_bias */
- if (!ctx->Extensions.EXT_texture_lod_bias) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target );
- return;
- }
- if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
- if (texUnit->LodBias == param[0])
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->LodBias = param[0];
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- }
- else if (target == GL_POINT_SPRITE_NV) {
- /* GL_ARB_point_sprite / GL_NV_point_sprite */
- if (!ctx->Extensions.NV_point_sprite
- && !ctx->Extensions.ARB_point_sprite) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target );
- return;
- }
- if (pname == GL_COORD_REPLACE_NV) {
- const GLenum value = (GLenum) param[0];
- if (value == GL_TRUE || value == GL_FALSE) {
- /* It's kind of weird to set point state via glTexEnv,
- * but that's what the spec calls for.
- */
- const GLboolean state = (GLboolean) value;
- if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state;
- }
- else {
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", value);
- return;
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
- return;
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target );
- return;
- }
-
- if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n",
- _mesa_lookup_enum_by_nr(target),
- _mesa_lookup_enum_by_nr(pname),
- *param,
- _mesa_lookup_enum_by_nr((GLenum) (GLint) *param));
-
- /* Tell device driver about the new texture environment */
- if (ctx->Driver.TexEnv) {
- (*ctx->Driver.TexEnv)( ctx, target, pname, param );
- }
-}
-
-
-void GLAPIENTRY
-_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param )
-{
- GLfloat p[4];
- p[0] = param;
- p[1] = p[2] = p[3] = 0.0;
- _mesa_TexEnvfv( target, pname, p );
-}
-
-
-
-void GLAPIENTRY
-_mesa_TexEnvi( GLenum target, GLenum pname, GLint param )
-{
- GLfloat p[4];
- p[0] = (GLfloat) param;
- p[1] = p[2] = p[3] = 0.0;
- _mesa_TexEnvfv( target, pname, p );
-}
-
-
-void GLAPIENTRY
-_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
-{
- GLfloat p[4];
- if (pname == GL_TEXTURE_ENV_COLOR) {
- p[0] = INT_TO_FLOAT( param[0] );
- p[1] = INT_TO_FLOAT( param[1] );
- p[2] = INT_TO_FLOAT( param[2] );
- p[3] = INT_TO_FLOAT( param[3] );
- }
- else {
- p[0] = (GLfloat) param[0];
- p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */
- }
- _mesa_TexEnvfv( target, pname, p );
-}
-
-
-
-/**
- * Helper for glGetTexEnvi/f()
- * \return value of queried pname or -1 if error.
- */
-static GLint
-get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
- GLenum pname)
-{
- switch (pname) {
- case GL_TEXTURE_ENV_MODE:
- return texUnit->EnvMode;
- break;
- case GL_COMBINE_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- return texUnit->Combine.ModeRGB;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_COMBINE_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- return texUnit->Combine.ModeA;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned rgb_idx = pname - GL_SOURCE0_RGB;
- return texUnit->Combine.SourceRGB[rgb_idx];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE3_RGB_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- return texUnit->Combine.SourceRGB[3];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA;
- return texUnit->Combine.SourceA[alpha_idx];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE3_ALPHA_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- return texUnit->Combine.SourceA[3];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned op_rgb = pname - GL_OPERAND0_RGB;
- return texUnit->Combine.OperandRGB[op_rgb];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND3_RGB_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- return texUnit->Combine.OperandRGB[3];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned op_alpha = pname - GL_OPERAND0_ALPHA;
- return texUnit->Combine.OperandA[op_alpha];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND3_ALPHA_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- return texUnit->Combine.OperandA[3];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_RGB_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- return 1 << texUnit->Combine.ScaleShiftRGB;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- return 1 << texUnit->Combine.ScaleShiftA;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_BUMP_TARGET_ATI:
- /* spec doesn't say so, but I think this should be queryable */
- if (ctx->Extensions.ATI_envmap_bumpmap) {
- return texUnit->BumpTarget;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
-
- default:
- ;
- }
-
- return -1; /* error */
-}
-
-
-
-void GLAPIENTRY
-_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
-{
- GLuint maxUnit;
- const struct gl_texture_unit *texUnit;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
- ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
- if (ctx->Texture.CurrentUnit >= maxUnit) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnvfv(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- if (target == GL_TEXTURE_ENV) {
- if (pname == GL_TEXTURE_ENV_COLOR) {
- COPY_4FV( params, texUnit->EnvColor );
- }
- else {
- GLint val = get_texenvi(ctx, texUnit, pname);
- if (val >= 0) {
- *params = (GLfloat) val;
- }
- }
- }
- else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
- /* GL_EXT_texture_lod_bias */
- if (!ctx->Extensions.EXT_texture_lod_bias) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
- return;
- }
- if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
- *params = texUnit->LodBias;
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
- return;
- }
- }
- else if (target == GL_POINT_SPRITE_NV) {
- /* GL_ARB_point_sprite / GL_NV_point_sprite */
- if (!ctx->Extensions.NV_point_sprite
- && !ctx->Extensions.ARB_point_sprite) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
- return;
- }
- if (pname == GL_COORD_REPLACE_NV) {
- *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
- return;
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
-{
- GLuint maxUnit;
- const struct gl_texture_unit *texUnit;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
- ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
- if (ctx->Texture.CurrentUnit >= maxUnit) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnviv(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- if (target == GL_TEXTURE_ENV) {
- if (pname == GL_TEXTURE_ENV_COLOR) {
- params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] );
- params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] );
- params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] );
- params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
- }
- else {
- GLint val = get_texenvi(ctx, texUnit, pname);
- if (val >= 0) {
- *params = val;
- }
- }
- }
- else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
- /* GL_EXT_texture_lod_bias */
- if (!ctx->Extensions.EXT_texture_lod_bias) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
- return;
- }
- if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
- *params = (GLint) texUnit->LodBias;
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
- return;
- }
- }
- else if (target == GL_POINT_SPRITE_NV) {
- /* GL_ARB_point_sprite / GL_NV_point_sprite */
- if (!ctx->Extensions.NV_point_sprite
- && !ctx->Extensions.ARB_point_sprite) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
- return;
- }
- if (pname == GL_COORD_REPLACE_NV) {
- *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
- return;
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
- return;
- }
-}
-
-
-/**
- * Why does ATI_envmap_bumpmap require new entrypoints? Should just
- * reuse TexEnv ones...
- */
-void GLAPIENTRY
-_mesa_TexBumpParameterivATI( GLenum pname, const GLint *param )
-{
- GLfloat p[4];
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!ctx->Extensions.ATI_envmap_bumpmap) {
- /* This isn't an "official" error case, but let's tell the user
- * that something's wrong.
- */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBumpParameterivATI");
- return;
- }
-
- if (pname == GL_BUMP_ROT_MATRIX_ATI) {
- /* hope that conversion is correct here */
- p[0] = INT_TO_FLOAT( param[0] );
- p[1] = INT_TO_FLOAT( param[1] );
- p[2] = INT_TO_FLOAT( param[2] );
- p[3] = INT_TO_FLOAT( param[3] );
- }
- else {
- p[0] = (GLfloat) param[0];
- p[1] = p[2] = p[3] = 0.0F; /* init to zero, just to be safe */
- }
- _mesa_TexBumpParameterfvATI( pname, p );
-}
-
-
-void GLAPIENTRY
-_mesa_TexBumpParameterfvATI( GLenum pname, const GLfloat *param )
-{
- struct gl_texture_unit *texUnit;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!ctx->Extensions.ATI_envmap_bumpmap) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBumpParameterfvATI");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- if (pname == GL_BUMP_ROT_MATRIX_ATI) {
- if (TEST_EQ_4V(param, texUnit->RotMatrix))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->RotMatrix, param);
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexBumpParameter(pname)" );
- return;
- }
- /* Drivers might want to know about this, instead of dedicated function
- just shove it into TexEnv where it really belongs anyway */
- if (ctx->Driver.TexEnv) {
- (*ctx->Driver.TexEnv)( ctx, 0, pname, param );
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param )
-{
- const struct gl_texture_unit *texUnit;
- GLuint i;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!ctx->Extensions.ATI_envmap_bumpmap) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterivATI");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- if (pname == GL_BUMP_ROT_MATRIX_SIZE_ATI) {
- /* spec leaves open to support larger matrices.
- Don't think anyone would ever want to use it
- (and apps almost certainly would not understand it and
- thus fail to submit matrices correctly) so hardcode this. */
- *param = 4;
- }
- else if (pname == GL_BUMP_ROT_MATRIX_ATI) {
- /* hope that conversion is correct here */
- param[0] = FLOAT_TO_INT(texUnit->RotMatrix[0]);
- param[1] = FLOAT_TO_INT(texUnit->RotMatrix[1]);
- param[2] = FLOAT_TO_INT(texUnit->RotMatrix[2]);
- param[3] = FLOAT_TO_INT(texUnit->RotMatrix[3]);
- }
- else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
- GLint count = 0;
- for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
- if (ctx->Const.SupportedBumpUnits & (1 << i)) {
- count++;
- }
- }
- *param = count;
- }
- else if (pname == GL_BUMP_TEX_UNITS_ATI) {
- for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
- if (ctx->Const.SupportedBumpUnits & (1 << i)) {
- *param++ = i + GL_TEXTURE0;
- }
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexBumpParameter(pname)" );
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param )
-{
- const struct gl_texture_unit *texUnit;
- GLuint i;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!ctx->Extensions.ATI_envmap_bumpmap) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterfvATI");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- if (pname == GL_BUMP_ROT_MATRIX_SIZE_ATI) {
- /* spec leaves open to support larger matrices.
- Don't think anyone would ever want to use it
- (and apps might not understand it) so hardcode this. */
- *param = 4.0F;
- }
- else if (pname == GL_BUMP_ROT_MATRIX_ATI) {
- param[0] = texUnit->RotMatrix[0];
- param[1] = texUnit->RotMatrix[1];
- param[2] = texUnit->RotMatrix[2];
- param[3] = texUnit->RotMatrix[3];
- }
- else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
- GLint count = 0;
- for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
- if (ctx->Const.SupportedBumpUnits & (1 << i)) {
- count++;
- }
- }
- *param = (GLfloat) count;
- }
- else if (pname == GL_BUMP_TEX_UNITS_ATI) {
- for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
- if (ctx->Const.SupportedBumpUnits & (1 << i)) {
- *param++ = (GLfloat) (i + GL_TEXTURE0);
- }
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexBumpParameter(pname)" );
- return;
- }
-}
diff --git a/src/mesa/main/texenv.h b/src/mesa/main/texenv.h
deleted file mode 100644
index 1e9c5fa..0000000
--- a/src/mesa/main/texenv.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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 TEXENV_H
-#define TEXENV_H
-
-
-#include "main/glheader.h"
-
-
-extern void GLAPIENTRY
-_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params );
-
-extern void GLAPIENTRY
-_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param );
-
-extern void GLAPIENTRY
-_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param );
-
-extern void GLAPIENTRY
-_mesa_TexEnvi( GLenum target, GLenum pname, GLint param );
-
-extern void GLAPIENTRY
-_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param );
-
-extern void GLAPIENTRY
-_mesa_TexBumpParameterivATI( GLenum pname, const GLint *param );
-
-extern void GLAPIENTRY
-_mesa_TexBumpParameterfvATI( GLenum pname, const GLfloat *param );
-
-extern void GLAPIENTRY
-_mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param );
-
-extern void GLAPIENTRY
-_mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param );
-
-#endif /* TEXENV_H */
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
deleted file mode 100644
index a8bffe4..0000000
--- a/src/mesa/main/texenvprogram.c
+++ /dev/null
@@ -1,1617 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 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 "glheader.h"
-#include "imports.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"
-
-
-/*
- * Note on texture units:
- *
- * The number of texture units supported by fixed-function fragment
- * processing is MAX_TEXTURE_COORD_UNITS, not MAX_TEXTURE_IMAGE_UNITS.
- * That's because there's a one-to-one correspondence between texture
- * coordinates and samplers in fixed-function processing.
- *
- * Since fixed-function vertex processing is limited to MAX_TEXTURE_COORD_UNITS
- * sets of texcoords, so is fixed-function fragment processing.
- *
- * We can safely use ctx->Const.MaxTextureUnits for loop bounds.
- */
-
-
-struct texenvprog_cache_item
-{
- GLuint hash;
- void *key;
- struct gl_fragment_program *data;
- struct texenvprog_cache_item *next;
-};
-
-static GLboolean
-texenv_doing_secondary_color(struct gl_context *ctx)
-{
- if (ctx->Light.Enabled &&
- (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR))
- return GL_TRUE;
-
- if (ctx->Fog.ColorSumEnabled)
- return GL_TRUE;
-
- return GL_FALSE;
-}
-
-/**
- * Up to nine instructions per tex unit, plus fog, specular color.
- */
-#define MAX_INSTRUCTIONS ((MAX_TEXTURE_COORD_UNITS * 9) + 12)
-
-#define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM)
-
-struct mode_opt {
-#ifdef __GNUC__
- __extension__ GLubyte Source:4; /**< SRC_x */
- __extension__ GLubyte Operand:3; /**< OPR_x */
-#else
- GLubyte Source; /**< SRC_x */
- GLubyte Operand; /**< OPR_x */
-#endif
-};
-
-struct state_key {
- GLuint nr_enabled_units:8;
- GLuint enabled_units:8;
- GLuint separate_specular:1;
- 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 {
- GLuint enabled:1;
- GLuint source_index:3; /**< TEXTURE_x_INDEX */
- GLuint shadow:1;
- GLuint ScaleShiftRGB:2;
- GLuint ScaleShiftA:2;
-
- GLuint NumArgsRGB:3; /**< up to MAX_COMBINER_TERMS */
- GLuint ModeRGB:5; /**< MODE_x */
-
- GLuint NumArgsA:3; /**< up to MAX_COMBINER_TERMS */
- GLuint ModeA:5; /**< MODE_x */
-
- GLuint texture_cyl_wrap:1; /**< For gallium test/debug only */
-
- struct mode_opt OptRGB[MAX_COMBINER_TERMS];
- struct mode_opt OptA[MAX_COMBINER_TERMS];
- } unit[MAX_TEXTURE_UNITS];
-};
-
-#define FOG_LINEAR 0
-#define FOG_EXP 1
-#define FOG_EXP2 2
-#define FOG_UNKNOWN 3
-
-static GLuint translate_fog_mode( GLenum mode )
-{
- switch (mode) {
- case GL_LINEAR: return FOG_LINEAR;
- case GL_EXP: return FOG_EXP;
- case GL_EXP2: return FOG_EXP2;
- default: return FOG_UNKNOWN;
- }
-}
-
-#define OPR_SRC_COLOR 0
-#define OPR_ONE_MINUS_SRC_COLOR 1
-#define OPR_SRC_ALPHA 2
-#define OPR_ONE_MINUS_SRC_ALPHA 3
-#define OPR_ZERO 4
-#define OPR_ONE 5
-#define OPR_UNKNOWN 7
-
-static GLuint translate_operand( GLenum operand )
-{
- switch (operand) {
- case GL_SRC_COLOR: return OPR_SRC_COLOR;
- case GL_ONE_MINUS_SRC_COLOR: return OPR_ONE_MINUS_SRC_COLOR;
- case GL_SRC_ALPHA: return OPR_SRC_ALPHA;
- case GL_ONE_MINUS_SRC_ALPHA: return OPR_ONE_MINUS_SRC_ALPHA;
- case GL_ZERO: return OPR_ZERO;
- case GL_ONE: return OPR_ONE;
- default:
- assert(0);
- return OPR_UNKNOWN;
- }
-}
-
-#define SRC_TEXTURE 0
-#define SRC_TEXTURE0 1
-#define SRC_TEXTURE1 2
-#define SRC_TEXTURE2 3
-#define SRC_TEXTURE3 4
-#define SRC_TEXTURE4 5
-#define SRC_TEXTURE5 6
-#define SRC_TEXTURE6 7
-#define SRC_TEXTURE7 8
-#define SRC_CONSTANT 9
-#define SRC_PRIMARY_COLOR 10
-#define SRC_PREVIOUS 11
-#define SRC_ZERO 12
-#define SRC_UNKNOWN 15
-
-static GLuint translate_source( GLenum src )
-{
- switch (src) {
- case GL_TEXTURE: return SRC_TEXTURE;
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- case GL_TEXTURE3:
- case GL_TEXTURE4:
- case GL_TEXTURE5:
- case GL_TEXTURE6:
- case GL_TEXTURE7: return SRC_TEXTURE0 + (src - GL_TEXTURE0);
- case GL_CONSTANT: return SRC_CONSTANT;
- case GL_PRIMARY_COLOR: return SRC_PRIMARY_COLOR;
- case GL_PREVIOUS: return SRC_PREVIOUS;
- case GL_ZERO:
- return SRC_ZERO;
- default:
- assert(0);
- return SRC_UNKNOWN;
- }
-}
-
-#define MODE_REPLACE 0 /* r = a0 */
-#define MODE_MODULATE 1 /* r = a0 * a1 */
-#define MODE_ADD 2 /* r = a0 + a1 */
-#define MODE_ADD_SIGNED 3 /* r = a0 + a1 - 0.5 */
-#define MODE_INTERPOLATE 4 /* r = a0 * a2 + a1 * (1 - a2) */
-#define MODE_SUBTRACT 5 /* r = a0 - a1 */
-#define MODE_DOT3_RGB 6 /* r = a0 . a1 */
-#define MODE_DOT3_RGB_EXT 7 /* r = a0 . a1 */
-#define MODE_DOT3_RGBA 8 /* r = a0 . a1 */
-#define MODE_DOT3_RGBA_EXT 9 /* r = a0 . a1 */
-#define MODE_MODULATE_ADD_ATI 10 /* r = a0 * a2 + a1 */
-#define MODE_MODULATE_SIGNED_ADD_ATI 11 /* r = a0 * a2 + a1 - 0.5 */
-#define MODE_MODULATE_SUBTRACT_ATI 12 /* r = a0 * a2 - a1 */
-#define MODE_ADD_PRODUCTS 13 /* r = a0 * a1 + a2 * a3 */
-#define MODE_ADD_PRODUCTS_SIGNED 14 /* r = a0 * a1 + a2 * a3 - 0.5 */
-#define MODE_BUMP_ENVMAP_ATI 15 /* special */
-#define MODE_UNKNOWN 16
-
-/**
- * Translate GL combiner state into a MODE_x value
- */
-static GLuint translate_mode( GLenum envMode, GLenum mode )
-{
- switch (mode) {
- case GL_REPLACE: return MODE_REPLACE;
- case GL_MODULATE: return MODE_MODULATE;
- case GL_ADD:
- if (envMode == GL_COMBINE4_NV)
- return MODE_ADD_PRODUCTS;
- else
- return MODE_ADD;
- case GL_ADD_SIGNED:
- if (envMode == GL_COMBINE4_NV)
- return MODE_ADD_PRODUCTS_SIGNED;
- else
- return MODE_ADD_SIGNED;
- case GL_INTERPOLATE: return MODE_INTERPOLATE;
- case GL_SUBTRACT: return MODE_SUBTRACT;
- case GL_DOT3_RGB: return MODE_DOT3_RGB;
- case GL_DOT3_RGB_EXT: return MODE_DOT3_RGB_EXT;
- case GL_DOT3_RGBA: return MODE_DOT3_RGBA;
- case GL_DOT3_RGBA_EXT: return MODE_DOT3_RGBA_EXT;
- case GL_MODULATE_ADD_ATI: return MODE_MODULATE_ADD_ATI;
- case GL_MODULATE_SIGNED_ADD_ATI: return MODE_MODULATE_SIGNED_ADD_ATI;
- case GL_MODULATE_SUBTRACT_ATI: return MODE_MODULATE_SUBTRACT_ATI;
- case GL_BUMP_ENVMAP_ATI: return MODE_BUMP_ENVMAP_ATI;
- default:
- assert(0);
- return MODE_UNKNOWN;
- }
-}
-
-
-/**
- * Do we need to clamp the results of the given texture env/combine mode?
- * If the inputs to the mode are in [0,1] we don't always have to clamp
- * the results.
- */
-static GLboolean
-need_saturate( GLuint mode )
-{
- switch (mode) {
- case MODE_REPLACE:
- case MODE_MODULATE:
- case MODE_INTERPOLATE:
- return GL_FALSE;
- case MODE_ADD:
- case MODE_ADD_SIGNED:
- case MODE_SUBTRACT:
- case MODE_DOT3_RGB:
- case MODE_DOT3_RGB_EXT:
- case MODE_DOT3_RGBA:
- case MODE_DOT3_RGBA_EXT:
- case MODE_MODULATE_ADD_ATI:
- case MODE_MODULATE_SIGNED_ADD_ATI:
- case MODE_MODULATE_SUBTRACT_ATI:
- case MODE_ADD_PRODUCTS:
- case MODE_ADD_PRODUCTS_SIGNED:
- case MODE_BUMP_ENVMAP_ATI:
- return GL_TRUE;
- default:
- assert(0);
- return GL_FALSE;
- }
-}
-
-
-
-/**
- * Translate TEXTURE_x_BIT to TEXTURE_x_INDEX.
- */
-static GLuint translate_tex_src_bit( GLbitfield bit )
-{
- ASSERT(bit);
- return _mesa_ffs(bit) - 1;
-}
-
-
-#define VERT_BIT_TEX_ANY (0xff << VERT_ATTRIB_TEX0)
-#define VERT_RESULT_TEX_ANY (0xff << VERT_RESULT_TEX0)
-
-/**
- * Identify all possible varying inputs. The fragment program will
- * never reference non-varying inputs, but will track them via state
- * constants instead.
- *
- * This function figures out all the inputs that the fragment program
- * has access to. The bitmask is later reduced to just those which
- * are actually referenced.
- */
-static GLbitfield get_fp_input_mask( struct gl_context *ctx )
-{
- /* _NEW_PROGRAM */
- const GLboolean vertexShader =
- (ctx->Shader.CurrentVertexProgram &&
- ctx->Shader.CurrentVertexProgram->LinkStatus &&
- ctx->Shader.CurrentVertexProgram->VertexProgram);
- const GLboolean vertexProgram = ctx->VertexProgram._Enabled;
- GLbitfield fp_inputs = 0x0;
-
- if (ctx->VertexProgram._Overriden) {
- /* Somebody's messing with the vertex program and we don't have
- * a clue what's happening. Assume that it could be producing
- * all possible outputs.
- */
- fp_inputs = ~0;
- }
- else if (ctx->RenderMode == GL_FEEDBACK) {
- /* _NEW_RENDERMODE */
- fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0);
- }
- else if (!(vertexProgram || vertexShader) ||
- !ctx->VertexProgram._Current) {
- /* Fixed function vertex logic */
- /* _NEW_ARRAY */
- GLbitfield varying_inputs = ctx->varying_vp_inputs;
-
- /* These get generated in the setup routine regardless of the
- * vertex program:
- */
- /* _NEW_POINT */
- if (ctx->Point.PointSprite)
- varying_inputs |= FRAG_BITS_TEX_ANY;
-
- /* First look at what values may be computed by the generated
- * vertex program:
- */
- /* _NEW_LIGHT */
- if (ctx->Light.Enabled) {
- fp_inputs |= FRAG_BIT_COL0;
-
- if (texenv_doing_secondary_color(ctx))
- fp_inputs |= FRAG_BIT_COL1;
- }
-
- /* _NEW_TEXTURE */
- fp_inputs |= (ctx->Texture._TexGenEnabled |
- ctx->Texture._TexMatEnabled) << FRAG_ATTRIB_TEX0;
-
- /* Then look at what might be varying as a result of enabled
- * arrays, etc:
- */
- if (varying_inputs & VERT_BIT_COLOR0)
- fp_inputs |= FRAG_BIT_COL0;
- if (varying_inputs & VERT_BIT_COLOR1)
- fp_inputs |= FRAG_BIT_COL1;
-
- fp_inputs |= (((varying_inputs & VERT_BIT_TEX_ANY) >> VERT_ATTRIB_TEX0)
- << FRAG_ATTRIB_TEX0);
-
- }
- else {
- /* calculate from vp->outputs */
- struct gl_vertex_program *vprog;
- GLbitfield64 vp_outputs;
-
- /* Choose GLSL vertex shader over ARB vertex program. Need this
- * since vertex shader state validation comes after fragment state
- * validation (see additional comments in state.c).
- */
- if (vertexShader)
- vprog = ctx->Shader.CurrentVertexProgram->VertexProgram;
- else
- vprog = ctx->VertexProgram.Current;
-
- vp_outputs = vprog->Base.OutputsWritten;
-
- /* These get generated in the setup routine regardless of the
- * vertex program:
- */
- /* _NEW_POINT */
- if (ctx->Point.PointSprite)
- vp_outputs |= FRAG_BITS_TEX_ANY;
-
- if (vp_outputs & (1 << VERT_RESULT_COL0))
- fp_inputs |= FRAG_BIT_COL0;
- if (vp_outputs & (1 << VERT_RESULT_COL1))
- fp_inputs |= FRAG_BIT_COL1;
-
- fp_inputs |= (((vp_outputs & VERT_RESULT_TEX_ANY) >> VERT_RESULT_TEX0)
- << FRAG_ATTRIB_TEX0);
- }
-
- return fp_inputs;
-}
-
-
-/**
- * Examine current texture environment state and generate a unique
- * key to identify it.
- */
-static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
-{
- GLuint i, j;
- GLbitfield inputs_referenced = FRAG_BIT_COL0;
- const GLbitfield inputs_available = get_fp_input_mask( ctx );
- GLuint keySize;
-
- memset(key, 0, sizeof(*key));
-
- /* _NEW_TEXTURE */
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
- const struct gl_texture_object *texObj = texUnit->_Current;
- const struct gl_tex_env_combine_state *comb = texUnit->_CurrentCombine;
- GLenum format;
-
- if (!texUnit->_ReallyEnabled || !texUnit->Enabled)
- continue;
-
- format = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
-
- key->unit[i].enabled = 1;
- key->enabled_units |= (1<<i);
- key->nr_enabled_units = i + 1;
- inputs_referenced |= FRAG_BIT_TEX(i);
-
- key->unit[i].source_index =
- translate_tex_src_bit(texUnit->_ReallyEnabled);
-
- key->unit[i].shadow = ((texObj->CompareMode == GL_COMPARE_R_TO_TEXTURE) &&
- ((format == GL_DEPTH_COMPONENT) ||
- (format == GL_DEPTH_STENCIL_EXT)));
-
- key->unit[i].NumArgsRGB = comb->_NumArgsRGB;
- key->unit[i].NumArgsA = comb->_NumArgsA;
-
- key->unit[i].ModeRGB =
- translate_mode(texUnit->EnvMode, comb->ModeRGB);
- key->unit[i].ModeA =
- translate_mode(texUnit->EnvMode, comb->ModeA);
-
- key->unit[i].ScaleShiftRGB = comb->ScaleShiftRGB;
- key->unit[i].ScaleShiftA = comb->ScaleShiftA;
-
- for (j = 0; j < MAX_COMBINER_TERMS; j++) {
- key->unit[i].OptRGB[j].Operand = translate_operand(comb->OperandRGB[j]);
- key->unit[i].OptA[j].Operand = translate_operand(comb->OperandA[j]);
- key->unit[i].OptRGB[j].Source = translate_source(comb->SourceRGB[j]);
- key->unit[i].OptA[j].Source = translate_source(comb->SourceA[j]);
- }
-
- if (key->unit[i].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
- /* requires some special translation */
- key->unit[i].NumArgsRGB = 2;
- key->unit[i].ScaleShiftRGB = 0;
- key->unit[i].OptRGB[0].Operand = OPR_SRC_COLOR;
- key->unit[i].OptRGB[0].Source = SRC_TEXTURE;
- key->unit[i].OptRGB[1].Operand = OPR_SRC_COLOR;
- key->unit[i].OptRGB[1].Source = texUnit->BumpTarget - GL_TEXTURE0 + SRC_TEXTURE0;
- }
-
- /* this is a back-door for enabling cylindrical texture wrap mode */
- if (texObj->Priority == 0.125)
- key->unit[i].texture_cyl_wrap = 1;
- }
-
- /* _NEW_LIGHT | _NEW_FOG */
- if (texenv_doing_secondary_color(ctx)) {
- key->separate_specular = 1;
- inputs_referenced |= FRAG_BIT_COL1;
- }
-
- /* _NEW_FOG */
- if (ctx->Fog.Enabled) {
- key->fog_enabled = 1;
- key->fog_mode = translate_fog_mode(ctx->Fog.Mode);
- 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 */
- keySize = sizeof(*key) - sizeof(key->unit)
- + key->nr_enabled_units * sizeof(key->unit[0]);
-
- return keySize;
-}
-
-
-/**
- * Use uregs to represent registers internally, translate to Mesa's
- * expected formats on emit.
- *
- * NOTE: These are passed by value extensively in this file rather
- * than as usual by pointer reference. If this disturbs you, try
- * remembering they are just 32bits in size.
- *
- * GCC is smart enough to deal with these dword-sized structures in
- * much the same way as if I had defined them as dwords and was using
- * macros to access and set the fields. This is much nicer and easier
- * to evolve.
- */
-struct ureg {
- GLuint file:4;
- GLuint idx:8;
- GLuint negatebase:1;
- GLuint swz:12;
- GLuint pad:7;
-};
-
-static const struct ureg undef = {
- PROGRAM_UNDEFINED,
- ~0,
- 0,
- 0,
- 0
-};
-
-
-/** State used to build the fragment program:
- */
-struct texenv_fragment_program {
- struct gl_fragment_program *program;
- struct state_key *state;
-
- GLbitfield alu_temps; /**< Track texture indirections, see spec. */
- GLbitfield temps_output; /**< Track texture indirections, see spec. */
- GLbitfield temp_in_use; /**< Tracks temporary regs which are in use. */
- GLboolean error;
-
- struct ureg src_texture[MAX_TEXTURE_COORD_UNITS];
- /* Reg containing each texture unit's sampled texture color,
- * else undef.
- */
-
- struct ureg texcoord_tex[MAX_TEXTURE_COORD_UNITS];
- /* Reg containing texcoord for a texture unit,
- * needed for bump mapping, else undef.
- */
-
- struct ureg src_previous; /**< Reg containing color from previous
- * stage. May need to be decl'd.
- */
-
- GLuint last_tex_stage; /**< Number of last enabled texture unit */
-
- struct ureg half;
- struct ureg one;
- struct ureg zero;
-};
-
-
-
-static struct ureg make_ureg(GLuint file, GLuint idx)
-{
- struct ureg reg;
- reg.file = file;
- reg.idx = idx;
- reg.negatebase = 0;
- reg.swz = SWIZZLE_NOOP;
- reg.pad = 0;
- return reg;
-}
-
-static struct ureg swizzle( struct ureg reg, int x, int y, int z, int w )
-{
- reg.swz = MAKE_SWIZZLE4(GET_SWZ(reg.swz, x),
- GET_SWZ(reg.swz, y),
- GET_SWZ(reg.swz, z),
- GET_SWZ(reg.swz, w));
-
- return reg;
-}
-
-static struct ureg swizzle1( struct ureg reg, int x )
-{
- return swizzle(reg, x, x, x, x);
-}
-
-static struct ureg negate( struct ureg reg )
-{
- reg.negatebase ^= 1;
- return reg;
-}
-
-static GLboolean is_undef( struct ureg reg )
-{
- return reg.file == PROGRAM_UNDEFINED;
-}
-
-
-static struct ureg get_temp( struct texenv_fragment_program *p )
-{
- GLint bit;
-
- /* First try and reuse temps which have been used already:
- */
- bit = _mesa_ffs( ~p->temp_in_use & p->alu_temps );
-
- /* Then any unused temporary:
- */
- if (!bit)
- bit = _mesa_ffs( ~p->temp_in_use );
-
- if (!bit) {
- _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__);
- exit(1);
- }
-
- if ((GLuint) bit > p->program->Base.NumTemporaries)
- p->program->Base.NumTemporaries = bit;
-
- p->temp_in_use |= 1<<(bit-1);
- return make_ureg(PROGRAM_TEMPORARY, (bit-1));
-}
-
-static struct ureg get_tex_temp( struct texenv_fragment_program *p )
-{
- int bit;
-
- /* First try to find available temp not previously used (to avoid
- * starting a new texture indirection). According to the spec, the
- * ~p->temps_output isn't necessary, but will keep it there for
- * now:
- */
- bit = _mesa_ffs( ~p->temp_in_use & ~p->alu_temps & ~p->temps_output );
-
- /* Then any unused temporary:
- */
- if (!bit)
- bit = _mesa_ffs( ~p->temp_in_use );
-
- if (!bit) {
- _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__);
- exit(1);
- }
-
- if ((GLuint) bit > p->program->Base.NumTemporaries)
- p->program->Base.NumTemporaries = bit;
-
- p->temp_in_use |= 1<<(bit-1);
- return make_ureg(PROGRAM_TEMPORARY, (bit-1));
-}
-
-
-/** Mark a temp reg as being no longer allocatable. */
-static void reserve_temp( struct texenv_fragment_program *p, struct ureg r )
-{
- if (r.file == PROGRAM_TEMPORARY)
- p->temps_output |= (1 << r.idx);
-}
-
-
-static void release_temps(struct gl_context *ctx, struct texenv_fragment_program *p )
-{
- GLuint max_temp = ctx->Const.FragmentProgram.MaxTemps;
-
- /* KW: To support tex_env_crossbar, don't release the registers in
- * temps_output.
- */
- if (max_temp >= sizeof(int) * 8)
- p->temp_in_use = p->temps_output;
- else
- p->temp_in_use = ~((1<<max_temp)-1) | p->temps_output;
-}
-
-
-static struct ureg register_param5( struct texenv_fragment_program *p,
- GLint s0,
- GLint s1,
- GLint s2,
- GLint s3,
- GLint s4)
-{
- gl_state_index tokens[STATE_LENGTH];
- GLuint idx;
- tokens[0] = s0;
- tokens[1] = s1;
- tokens[2] = s2;
- tokens[3] = s3;
- tokens[4] = s4;
- idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens );
- return make_ureg(PROGRAM_STATE_VAR, idx);
-}
-
-
-#define register_param1(p,s0) register_param5(p,s0,0,0,0,0)
-#define register_param2(p,s0,s1) register_param5(p,s0,s1,0,0,0)
-#define register_param3(p,s0,s1,s2) register_param5(p,s0,s1,s2,0,0)
-#define register_param4(p,s0,s1,s2,s3) register_param5(p,s0,s1,s2,s3,0)
-
-static GLuint frag_to_vert_attrib( GLuint attrib )
-{
- switch (attrib) {
- case FRAG_ATTRIB_COL0: return VERT_ATTRIB_COLOR0;
- case FRAG_ATTRIB_COL1: return VERT_ATTRIB_COLOR1;
- default:
- assert(attrib >= FRAG_ATTRIB_TEX0);
- assert(attrib <= FRAG_ATTRIB_TEX7);
- return attrib - FRAG_ATTRIB_TEX0 + VERT_ATTRIB_TEX0;
- }
-}
-
-
-static struct ureg register_input( struct texenv_fragment_program *p, GLuint input )
-{
- if (p->state->inputs_available & (1<<input)) {
- p->program->Base.InputsRead |= (1 << input);
- return make_ureg(PROGRAM_INPUT, input);
- }
- else {
- GLuint idx = frag_to_vert_attrib( input );
- return register_param3( p, STATE_INTERNAL, STATE_CURRENT_ATTRIB, idx );
- }
-}
-
-
-static void emit_arg( struct prog_src_register *reg,
- struct ureg ureg )
-{
- reg->File = ureg.file;
- reg->Index = ureg.idx;
- reg->Swizzle = ureg.swz;
- reg->Negate = ureg.negatebase ? NEGATE_XYZW : NEGATE_NONE;
- reg->Abs = GL_FALSE;
-}
-
-static void emit_dst( struct prog_dst_register *dst,
- struct ureg ureg, GLuint mask )
-{
- dst->File = ureg.file;
- dst->Index = ureg.idx;
- dst->WriteMask = mask;
- dst->CondMask = COND_TR; /* always pass cond test */
- dst->CondSwizzle = SWIZZLE_NOOP;
-}
-
-static struct prog_instruction *
-emit_op(struct texenv_fragment_program *p,
- enum prog_opcode op,
- struct ureg dest,
- GLuint mask,
- GLboolean saturate,
- struct ureg src0,
- struct ureg src1,
- struct ureg src2 )
-{
- const GLuint nr = p->program->Base.NumInstructions++;
- struct prog_instruction *inst = &p->program->Base.Instructions[nr];
-
- assert(nr < MAX_INSTRUCTIONS);
-
- _mesa_init_instructions(inst, 1);
- inst->Opcode = op;
-
- emit_arg( &inst->SrcReg[0], src0 );
- emit_arg( &inst->SrcReg[1], src1 );
- emit_arg( &inst->SrcReg[2], src2 );
-
- inst->SaturateMode = saturate ? SATURATE_ZERO_ONE : SATURATE_OFF;
-
- emit_dst( &inst->DstReg, dest, mask );
-
-#if 0
- /* Accounting for indirection tracking:
- */
- if (dest.file == PROGRAM_TEMPORARY)
- p->temps_output |= 1 << dest.idx;
-#endif
-
- return inst;
-}
-
-
-static struct ureg emit_arith( struct texenv_fragment_program *p,
- enum prog_opcode op,
- struct ureg dest,
- GLuint mask,
- GLboolean saturate,
- struct ureg src0,
- struct ureg src1,
- struct ureg src2 )
-{
- emit_op(p, op, dest, mask, saturate, src0, src1, src2);
-
- /* Accounting for indirection tracking:
- */
- if (src0.file == PROGRAM_TEMPORARY)
- p->alu_temps |= 1 << src0.idx;
-
- if (!is_undef(src1) && src1.file == PROGRAM_TEMPORARY)
- p->alu_temps |= 1 << src1.idx;
-
- if (!is_undef(src2) && src2.file == PROGRAM_TEMPORARY)
- p->alu_temps |= 1 << src2.idx;
-
- if (dest.file == PROGRAM_TEMPORARY)
- p->alu_temps |= 1 << dest.idx;
-
- p->program->Base.NumAluInstructions++;
- return dest;
-}
-
-static struct ureg emit_texld( struct texenv_fragment_program *p,
- enum prog_opcode op,
- struct ureg dest,
- GLuint destmask,
- GLuint tex_unit,
- GLuint tex_idx,
- GLuint tex_shadow,
- struct ureg coord )
-{
- struct prog_instruction *inst = emit_op( p, op,
- dest, destmask,
- GL_FALSE, /* don't saturate? */
- coord, /* arg 0? */
- undef,
- undef);
-
- inst->TexSrcTarget = tex_idx;
- inst->TexSrcUnit = tex_unit;
- inst->TexShadow = tex_shadow;
-
- p->program->Base.NumTexInstructions++;
-
- /* Accounting for indirection tracking:
- */
- reserve_temp(p, dest);
-
-#if 0
- /* Is this a texture indirection?
- */
- if ((coord.file == PROGRAM_TEMPORARY &&
- (p->temps_output & (1<<coord.idx))) ||
- (dest.file == PROGRAM_TEMPORARY &&
- (p->alu_temps & (1<<dest.idx)))) {
- p->program->Base.NumTexIndirections++;
- p->temps_output = 1<<coord.idx;
- p->alu_temps = 0;
- assert(0); /* KW: texture env crossbar */
- }
-#endif
-
- return dest;
-}
-
-
-static struct ureg register_const4f( struct texenv_fragment_program *p,
- GLfloat s0,
- GLfloat s1,
- GLfloat s2,
- GLfloat s3)
-{
- GLfloat values[4];
- GLuint idx, swizzle;
- struct ureg r;
- values[0] = s0;
- values[1] = s1;
- values[2] = s2;
- values[3] = s3;
- idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4,
- &swizzle );
- r = make_ureg(PROGRAM_CONSTANT, idx);
- r.swz = swizzle;
- return r;
-}
-
-#define register_scalar_const(p, s0) register_const4f(p, s0, s0, s0, s0)
-#define register_const1f(p, s0) register_const4f(p, s0, 0, 0, 1)
-#define register_const2f(p, s0, s1) register_const4f(p, s0, s1, 0, 1)
-#define register_const3f(p, s0, s1, s2) register_const4f(p, s0, s1, s2, 1)
-
-
-static struct ureg get_one( struct texenv_fragment_program *p )
-{
- if (is_undef(p->one))
- p->one = register_scalar_const(p, 1.0);
- return p->one;
-}
-
-static struct ureg get_half( struct texenv_fragment_program *p )
-{
- if (is_undef(p->half))
- p->half = register_scalar_const(p, 0.5);
- return p->half;
-}
-
-static struct ureg get_zero( struct texenv_fragment_program *p )
-{
- if (is_undef(p->zero))
- p->zero = register_scalar_const(p, 0.0);
- return p->zero;
-}
-
-
-static void program_error( struct texenv_fragment_program *p, const char *msg )
-{
- _mesa_problem(NULL, "%s", msg);
- p->error = 1;
-}
-
-static struct ureg get_source( struct texenv_fragment_program *p,
- GLuint src, GLuint unit )
-{
- switch (src) {
- case SRC_TEXTURE:
- assert(!is_undef(p->src_texture[unit]));
- return p->src_texture[unit];
-
- case SRC_TEXTURE0:
- case SRC_TEXTURE1:
- case SRC_TEXTURE2:
- case SRC_TEXTURE3:
- case SRC_TEXTURE4:
- case SRC_TEXTURE5:
- case SRC_TEXTURE6:
- case SRC_TEXTURE7:
- assert(!is_undef(p->src_texture[src - SRC_TEXTURE0]));
- return p->src_texture[src - SRC_TEXTURE0];
-
- case SRC_CONSTANT:
- return register_param2(p, STATE_TEXENV_COLOR, unit);
-
- case SRC_PRIMARY_COLOR:
- return register_input(p, FRAG_ATTRIB_COL0);
-
- case SRC_ZERO:
- return get_zero(p);
-
- case SRC_PREVIOUS:
- if (is_undef(p->src_previous))
- return register_input(p, FRAG_ATTRIB_COL0);
- else
- return p->src_previous;
-
- default:
- assert(0);
- return undef;
- }
-}
-
-static struct ureg emit_combine_source( struct texenv_fragment_program *p,
- GLuint mask,
- GLuint unit,
- GLuint source,
- GLuint operand )
-{
- struct ureg arg, src, one;
-
- src = get_source(p, source, unit);
-
- switch (operand) {
- case OPR_ONE_MINUS_SRC_COLOR:
- /* Get unused tmp,
- * Emit tmp = 1.0 - arg.xyzw
- */
- arg = get_temp( p );
- one = get_one( p );
- return emit_arith( p, OPCODE_SUB, arg, mask, 0, one, src, undef);
-
- case OPR_SRC_ALPHA:
- if (mask == WRITEMASK_W)
- return src;
- else
- return swizzle1( src, SWIZZLE_W );
- case OPR_ONE_MINUS_SRC_ALPHA:
- /* Get unused tmp,
- * Emit tmp = 1.0 - arg.wwww
- */
- arg = get_temp(p);
- one = get_one(p);
- return emit_arith(p, OPCODE_SUB, arg, mask, 0,
- one, swizzle1(src, SWIZZLE_W), undef);
- case OPR_ZERO:
- return get_zero(p);
- case OPR_ONE:
- return get_one(p);
- case OPR_SRC_COLOR:
- return src;
- default:
- assert(0);
- return src;
- }
-}
-
-/**
- * Check if the RGB and Alpha sources and operands match for the given
- * texture unit's combinder state. When the RGB and A sources and
- * operands match, we can emit fewer instructions.
- */
-static GLboolean args_match( const struct state_key *key, GLuint unit )
-{
- GLuint i, numArgs = key->unit[unit].NumArgsRGB;
-
- for (i = 0; i < numArgs; i++) {
- if (key->unit[unit].OptA[i].Source != key->unit[unit].OptRGB[i].Source)
- return GL_FALSE;
-
- switch (key->unit[unit].OptA[i].Operand) {
- case OPR_SRC_ALPHA:
- switch (key->unit[unit].OptRGB[i].Operand) {
- case OPR_SRC_COLOR:
- case OPR_SRC_ALPHA:
- break;
- default:
- return GL_FALSE;
- }
- break;
- case OPR_ONE_MINUS_SRC_ALPHA:
- switch (key->unit[unit].OptRGB[i].Operand) {
- case OPR_ONE_MINUS_SRC_COLOR:
- case OPR_ONE_MINUS_SRC_ALPHA:
- break;
- default:
- return GL_FALSE;
- }
- break;
- default:
- return GL_FALSE; /* impossible */
- }
- }
-
- return GL_TRUE;
-}
-
-static struct ureg emit_combine( struct texenv_fragment_program *p,
- struct ureg dest,
- GLuint mask,
- GLboolean saturate,
- GLuint unit,
- GLuint nr,
- GLuint mode,
- const struct mode_opt *opt)
-{
- struct ureg src[MAX_COMBINER_TERMS];
- struct ureg tmp, half;
- GLuint i;
-
- assert(nr <= MAX_COMBINER_TERMS);
-
- for (i = 0; i < nr; i++)
- src[i] = emit_combine_source( p, mask, unit, opt[i].Source, opt[i].Operand );
-
- switch (mode) {
- case MODE_REPLACE:
- if (mask == WRITEMASK_XYZW && !saturate)
- return src[0];
- else
- return emit_arith( p, OPCODE_MOV, dest, mask, saturate, src[0], undef, undef );
- case MODE_MODULATE:
- return emit_arith( p, OPCODE_MUL, dest, mask, saturate,
- src[0], src[1], undef );
- case MODE_ADD:
- return emit_arith( p, OPCODE_ADD, dest, mask, saturate,
- src[0], src[1], undef );
- case MODE_ADD_SIGNED:
- /* tmp = arg0 + arg1
- * result = tmp - .5
- */
- half = get_half(p);
- tmp = get_temp( p );
- emit_arith( p, OPCODE_ADD, tmp, mask, 0, src[0], src[1], undef );
- emit_arith( p, OPCODE_SUB, dest, mask, saturate, tmp, half, undef );
- return dest;
- case MODE_INTERPOLATE:
- /* Arg0 * (Arg2) + Arg1 * (1-Arg2) -- note arguments are reordered:
- */
- return emit_arith( p, OPCODE_LRP, dest, mask, saturate, src[2], src[0], src[1] );
-
- case MODE_SUBTRACT:
- return emit_arith( p, OPCODE_SUB, dest, mask, saturate, src[0], src[1], undef );
-
- case MODE_DOT3_RGBA:
- case MODE_DOT3_RGBA_EXT:
- case MODE_DOT3_RGB_EXT:
- case MODE_DOT3_RGB: {
- struct ureg tmp0 = get_temp( p );
- struct ureg tmp1 = get_temp( p );
- struct ureg neg1 = register_scalar_const(p, -1);
- struct ureg two = register_scalar_const(p, 2);
-
- /* tmp0 = 2*src0 - 1
- * tmp1 = 2*src1 - 1
- *
- * dst = tmp0 dot3 tmp1
- */
- emit_arith( p, OPCODE_MAD, tmp0, WRITEMASK_XYZW, 0,
- two, src[0], neg1);
-
- if (memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0)
- tmp1 = tmp0;
- else
- emit_arith( p, OPCODE_MAD, tmp1, WRITEMASK_XYZW, 0,
- two, src[1], neg1);
- emit_arith( p, OPCODE_DP3, dest, mask, saturate, tmp0, tmp1, undef);
- return dest;
- }
- case MODE_MODULATE_ADD_ATI:
- /* Arg0 * Arg2 + Arg1 */
- return emit_arith( p, OPCODE_MAD, dest, mask, saturate,
- src[0], src[2], src[1] );
- case MODE_MODULATE_SIGNED_ADD_ATI: {
- /* Arg0 * Arg2 + Arg1 - 0.5 */
- struct ureg tmp0 = get_temp(p);
- half = get_half(p);
- emit_arith( p, OPCODE_MAD, tmp0, mask, 0, src[0], src[2], src[1] );
- emit_arith( p, OPCODE_SUB, dest, mask, saturate, tmp0, half, undef );
- return dest;
- }
- case MODE_MODULATE_SUBTRACT_ATI:
- /* Arg0 * Arg2 - Arg1 */
- emit_arith( p, OPCODE_MAD, dest, mask, 0, src[0], src[2], negate(src[1]) );
- return dest;
- case MODE_ADD_PRODUCTS:
- /* Arg0 * Arg1 + Arg2 * Arg3 */
- {
- struct ureg tmp0 = get_temp(p);
- emit_arith( p, OPCODE_MUL, tmp0, mask, 0, src[0], src[1], undef );
- emit_arith( p, OPCODE_MAD, dest, mask, saturate, src[2], src[3], tmp0 );
- }
- return dest;
- case MODE_ADD_PRODUCTS_SIGNED:
- /* Arg0 * Arg1 + Arg2 * Arg3 - 0.5 */
- {
- struct ureg tmp0 = get_temp(p);
- half = get_half(p);
- emit_arith( p, OPCODE_MUL, tmp0, mask, 0, src[0], src[1], undef );
- emit_arith( p, OPCODE_MAD, tmp0, mask, 0, src[2], src[3], tmp0 );
- emit_arith( p, OPCODE_SUB, dest, mask, saturate, tmp0, half, undef );
- }
- return dest;
- case MODE_BUMP_ENVMAP_ATI:
- /* special - not handled here */
- assert(0);
- return src[0];
- default:
- assert(0);
- return src[0];
- }
-}
-
-
-/**
- * Generate instructions for one texture unit's env/combiner mode.
- */
-static struct ureg
-emit_texenv(struct texenv_fragment_program *p, GLuint unit)
-{
- const struct state_key *key = p->state;
- GLboolean rgb_saturate, alpha_saturate;
- GLuint rgb_shift, alpha_shift;
- struct ureg out, dest;
-
- if (!key->unit[unit].enabled) {
- return get_source(p, SRC_PREVIOUS, 0);
- }
- if (key->unit[unit].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
- /* this isn't really a env stage delivering a color and handled elsewhere */
- return get_source(p, SRC_PREVIOUS, 0);
- }
-
- switch (key->unit[unit].ModeRGB) {
- case MODE_DOT3_RGB_EXT:
- alpha_shift = key->unit[unit].ScaleShiftA;
- rgb_shift = 0;
- break;
- case MODE_DOT3_RGBA_EXT:
- alpha_shift = 0;
- rgb_shift = 0;
- break;
- default:
- rgb_shift = key->unit[unit].ScaleShiftRGB;
- alpha_shift = key->unit[unit].ScaleShiftA;
- break;
- }
-
- /* If we'll do rgb/alpha shifting don't saturate in emit_combine().
- * We don't want to clamp twice.
- */
- if (rgb_shift)
- rgb_saturate = GL_FALSE; /* saturate after rgb shift */
- else if (need_saturate(key->unit[unit].ModeRGB))
- rgb_saturate = GL_TRUE;
- else
- rgb_saturate = GL_FALSE;
-
- if (alpha_shift)
- alpha_saturate = GL_FALSE; /* saturate after alpha shift */
- else if (need_saturate(key->unit[unit].ModeA))
- alpha_saturate = GL_TRUE;
- else
- alpha_saturate = GL_FALSE;
-
- /* 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
- dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
-
- /* Emit the RGB and A combine ops
- */
- if (key->unit[unit].ModeRGB == key->unit[unit].ModeA &&
- args_match(key, unit)) {
- out = emit_combine( p, dest, WRITEMASK_XYZW, rgb_saturate,
- unit,
- key->unit[unit].NumArgsRGB,
- key->unit[unit].ModeRGB,
- key->unit[unit].OptRGB);
- }
- else if (key->unit[unit].ModeRGB == MODE_DOT3_RGBA_EXT ||
- key->unit[unit].ModeRGB == MODE_DOT3_RGBA) {
- out = emit_combine( p, dest, WRITEMASK_XYZW, rgb_saturate,
- unit,
- key->unit[unit].NumArgsRGB,
- key->unit[unit].ModeRGB,
- key->unit[unit].OptRGB);
- }
- else {
- /* Need to do something to stop from re-emitting identical
- * argument calculations here:
- */
- out = emit_combine( p, dest, WRITEMASK_XYZ, rgb_saturate,
- unit,
- key->unit[unit].NumArgsRGB,
- key->unit[unit].ModeRGB,
- key->unit[unit].OptRGB);
- out = emit_combine( p, dest, WRITEMASK_W, alpha_saturate,
- unit,
- key->unit[unit].NumArgsA,
- key->unit[unit].ModeA,
- key->unit[unit].OptA);
- }
-
- /* Deal with the final shift:
- */
- if (alpha_shift || rgb_shift) {
- struct ureg shift;
- GLboolean saturate = GL_TRUE; /* always saturate at this point */
-
- if (rgb_shift == alpha_shift) {
- shift = register_scalar_const(p, (GLfloat)(1<<rgb_shift));
- }
- else {
- shift = register_const4f(p,
- (GLfloat)(1<<rgb_shift),
- (GLfloat)(1<<rgb_shift),
- (GLfloat)(1<<rgb_shift),
- (GLfloat)(1<<alpha_shift));
- }
- return emit_arith( p, OPCODE_MUL, dest, WRITEMASK_XYZW,
- saturate, out, shift, undef );
- }
- else
- return out;
-}
-
-
-/**
- * Generate instruction for getting a texture source term.
- */
-static void load_texture( struct texenv_fragment_program *p, GLuint unit )
-{
- if (is_undef(p->src_texture[unit])) {
- const GLuint texTarget = p->state->unit[unit].source_index;
- struct ureg texcoord;
- struct ureg tmp = get_tex_temp( p );
-
- if (is_undef(p->texcoord_tex[unit])) {
- texcoord = register_input(p, FRAG_ATTRIB_TEX0+unit);
- }
- else {
- /* might want to reuse this reg for tex output actually */
- texcoord = p->texcoord_tex[unit];
- }
-
- /* TODO: Use D0_MASK_XY where possible.
- */
- if (p->state->unit[unit].enabled) {
- GLboolean shadow = GL_FALSE;
-
- if (p->state->unit[unit].shadow) {
- p->program->Base.ShadowSamplers |= 1 << unit;
- shadow = GL_TRUE;
- }
-
- p->src_texture[unit] = emit_texld( p, OPCODE_TXP,
- tmp, WRITEMASK_XYZW,
- unit, texTarget, shadow,
- texcoord );
-
- p->program->Base.SamplersUsed |= (1 << unit);
- /* This identity mapping should already be in place
- * (see _mesa_init_program_struct()) but let's be safe.
- */
- p->program->Base.SamplerUnits[unit] = unit;
- }
- else
- p->src_texture[unit] = get_zero(p);
-
- if (p->state->unit[unit].texture_cyl_wrap) {
- /* set flag which is checked by Mesa->Gallium program translation */
- p->program->Base.InputFlags[0] |= PROG_PARAM_BIT_CYL_WRAP;
- }
-
- }
-}
-
-static GLboolean load_texenv_source( struct texenv_fragment_program *p,
- GLuint src, GLuint unit )
-{
- switch (src) {
- case SRC_TEXTURE:
- load_texture(p, unit);
- break;
-
- case SRC_TEXTURE0:
- case SRC_TEXTURE1:
- case SRC_TEXTURE2:
- case SRC_TEXTURE3:
- case SRC_TEXTURE4:
- case SRC_TEXTURE5:
- case SRC_TEXTURE6:
- case SRC_TEXTURE7:
- load_texture(p, src - SRC_TEXTURE0);
- break;
-
- default:
- /* not a texture src - do nothing */
- break;
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Generate instructions for loading all texture source terms.
- */
-static GLboolean
-load_texunit_sources( struct texenv_fragment_program *p, GLuint unit )
-{
- const struct state_key *key = p->state;
- GLuint i;
-
- for (i = 0; i < key->unit[unit].NumArgsRGB; i++) {
- load_texenv_source( p, key->unit[unit].OptRGB[i].Source, unit );
- }
-
- for (i = 0; i < key->unit[unit].NumArgsA; i++) {
- load_texenv_source( p, key->unit[unit].OptA[i].Source, unit );
- }
-
- return GL_TRUE;
-}
-
-/**
- * Generate instructions for loading bump map textures.
- */
-static GLboolean
-load_texunit_bumpmap( struct texenv_fragment_program *p, GLuint unit )
-{
- const struct state_key *key = p->state;
- GLuint bumpedUnitNr = key->unit[unit].OptRGB[1].Source - SRC_TEXTURE0;
- struct ureg texcDst, bumpMapRes;
- struct ureg constdudvcolor = register_const4f(p, 0.0, 0.0, 0.0, 1.0);
- struct ureg texcSrc = register_input(p, FRAG_ATTRIB_TEX0 + bumpedUnitNr);
- struct ureg rotMat0 = register_param3( p, STATE_INTERNAL, STATE_ROT_MATRIX_0, unit );
- struct ureg rotMat1 = register_param3( p, STATE_INTERNAL, STATE_ROT_MATRIX_1, unit );
-
- load_texenv_source( p, unit + SRC_TEXTURE0, unit );
-
- bumpMapRes = get_source(p, key->unit[unit].OptRGB[0].Source, unit);
- texcDst = get_tex_temp( p );
- p->texcoord_tex[bumpedUnitNr] = texcDst;
-
- /* Apply rot matrix and add coords to be available in next phase.
- * dest = (Arg0.xxxx * rotMat0 + Arg1) + (Arg0.yyyy * rotMat1)
- * note only 2 coords are affected the rest are left unchanged (mul by 0)
- */
- emit_arith( p, OPCODE_MAD, texcDst, WRITEMASK_XYZW, 0,
- swizzle1(bumpMapRes, SWIZZLE_X), rotMat0, texcSrc );
- emit_arith( p, OPCODE_MAD, texcDst, WRITEMASK_XYZW, 0,
- swizzle1(bumpMapRes, SWIZZLE_Y), rotMat1, texcDst );
-
- /* Move 0,0,0,1 into bumpmap src if someone (crossbar) is foolish
- * enough to access this later, should optimize away.
- */
- emit_arith( p, OPCODE_MOV, bumpMapRes, WRITEMASK_XYZW, 0,
- constdudvcolor, undef, undef );
-
- return GL_TRUE;
-}
-
-/**
- * Generate a new fragment program which implements the context's
- * current texture env/combine mode.
- */
-static void
-create_new_program(struct gl_context *ctx, struct state_key *key,
- struct gl_fragment_program *program)
-{
- struct prog_instruction instBuffer[MAX_INSTRUCTIONS];
- struct texenv_fragment_program p;
- GLuint unit;
- struct ureg cf, out;
- int i;
-
- memset(&p, 0, sizeof(p));
- p.state = key;
- p.program = program;
-
- /* During code generation, use locally-allocated instruction buffer,
- * then alloc dynamic storage below.
- */
- p.program->Base.Instructions = instBuffer;
- p.program->Base.Target = GL_FRAGMENT_PROGRAM_ARB;
- p.program->Base.String = NULL;
- p.program->Base.NumTexIndirections = 1; /* is this right? */
- p.program->Base.NumTexInstructions = 0;
- p.program->Base.NumAluInstructions = 0;
- p.program->Base.NumInstructions = 0;
- p.program->Base.NumTemporaries = 0;
- p.program->Base.NumParameters = 0;
- p.program->Base.NumAttributes = 0;
- p.program->Base.NumAddressRegs = 0;
- p.program->Base.Parameters = _mesa_new_parameter_list();
- p.program->Base.InputsRead = 0x0;
-
- if (key->num_draw_buffers == 1)
- p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
- else {
- for (i = 0; i < key->num_draw_buffers; i++)
- p.program->Base.OutputsWritten |= (1 << (FRAG_RESULT_DATA0 + i));
- }
-
- for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
- p.src_texture[unit] = undef;
- p.texcoord_tex[unit] = undef;
- }
-
- p.src_previous = undef;
- p.half = undef;
- p.zero = undef;
- p.one = undef;
-
- p.last_tex_stage = 0;
- release_temps(ctx, &p);
-
- if (key->enabled_units) {
- GLboolean needbumpstage = GL_FALSE;
-
- /* Zeroth pass - bump map textures first */
- for (unit = 0; unit < key->nr_enabled_units; unit++)
- if (key->unit[unit].enabled &&
- key->unit[unit].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
- needbumpstage = GL_TRUE;
- load_texunit_bumpmap( &p, unit );
- }
- if (needbumpstage)
- p.program->Base.NumTexIndirections++;
-
- /* First pass - to support texture_env_crossbar, first identify
- * all referenced texture sources and emit texld instructions
- * for each:
- */
- for (unit = 0; unit < key->nr_enabled_units; unit++)
- if (key->unit[unit].enabled) {
- load_texunit_sources( &p, unit );
- p.last_tex_stage = unit;
- }
-
- /* Second pass - emit combine instructions to build final color:
- */
- for (unit = 0; unit < key->nr_enabled_units; unit++)
- if (key->unit[unit].enabled) {
- p.src_previous = emit_texenv( &p, unit );
- reserve_temp(&p, p.src_previous); /* don't re-use this temp reg */
- release_temps(ctx, &p); /* release all temps */
- }
- }
-
- cf = get_source( &p, SRC_PREVIOUS, 0 );
-
- 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 );
- }
-
- if (key->separate_specular) {
- /* Emit specular add.
- */
- struct ureg s = register_input(&p, FRAG_ATTRIB_COL1);
- emit_arith( &p, OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef );
- emit_arith( &p, OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef );
- }
- else if (memcmp(&cf, &out, sizeof(cf)) != 0) {
- /* Will wind up in here if no texture enabled or a couple of
- * other scenarios (GL_REPLACE for instance).
- */
- emit_arith( &p, OPCODE_MOV, out, WRITEMASK_XYZW, 0, cf, undef, undef );
- }
- }
- /* Finish up:
- */
- emit_arith( &p, OPCODE_END, undef, WRITEMASK_XYZW, 0, undef, undef, undef);
-
- if (key->fog_enabled) {
- /* Pull fog mode from struct gl_context, the value in the state key is
- * a reduced value and not what is expected in FogOption
- */
- p.program->FogOption = ctx->Fog.Mode;
- p.program->Base.InputsRead |= FRAG_BIT_FOGC;
- }
- else {
- p.program->FogOption = GL_NONE;
- }
-
- if (p.program->Base.NumTexIndirections > ctx->Const.FragmentProgram.MaxTexIndirections)
- program_error(&p, "Exceeded max nr indirect texture lookups");
-
- if (p.program->Base.NumTexInstructions > ctx->Const.FragmentProgram.MaxTexInstructions)
- program_error(&p, "Exceeded max TEX instructions");
-
- if (p.program->Base.NumAluInstructions > ctx->Const.FragmentProgram.MaxAluInstructions)
- program_error(&p, "Exceeded max ALU instructions");
-
- ASSERT(p.program->Base.NumInstructions <= MAX_INSTRUCTIONS);
-
- /* Allocate final instruction array */
- p.program->Base.Instructions
- = _mesa_alloc_instructions(p.program->Base.NumInstructions);
- if (!p.program->Base.Instructions) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "generating tex env program");
- return;
- }
- _mesa_copy_instructions(p.program->Base.Instructions, instBuffer,
- p.program->Base.NumInstructions);
-
- if (p.program->FogOption) {
- _mesa_append_fog_code(ctx, p.program);
- p.program->FogOption = GL_NONE;
- }
-
-
- /* Notify driver the fragment program has (actually) changed.
- */
- if (ctx->Driver.ProgramStringNotify) {
- GLboolean ok = ctx->Driver.ProgramStringNotify(ctx,
- GL_FRAGMENT_PROGRAM_ARB,
- &p.program->Base);
- /* Driver should be able to handle any texenv programs as long as
- * the driver correctly reported max number of texture units correctly,
- * etc.
- */
- ASSERT(ok);
- (void) ok; /* silence unused var warning */
- }
-
- if (DISASSEM) {
- _mesa_print_program(&p.program->Base);
- printf("\n");
- }
-}
-
-
-/**
- * Return a fragment program which implements the current
- * fixed-function texture, fog and color-sum operations.
- */
-struct gl_fragment_program *
-_mesa_get_fixed_func_fragment_program(struct gl_context *ctx)
-{
- struct gl_fragment_program *prog;
- struct state_key key;
- GLuint keySize;
-
- keySize = make_state_key(ctx, &key);
-
- prog = (struct gl_fragment_program *)
- _mesa_search_program_cache(ctx->FragmentProgram.Cache,
- &key, keySize);
-
- if (!prog) {
- prog = (struct gl_fragment_program *)
- ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
-
- create_new_program(ctx, &key, prog);
-
- _mesa_program_cache_insert(ctx, ctx->FragmentProgram.Cache,
- &key, keySize, &prog->Base);
- }
-
- return prog;
-}
diff --git a/src/mesa/main/texenvprogram.h b/src/mesa/main/texenvprogram.h
deleted file mode 100644
index 22e30a5..0000000
--- a/src/mesa/main/texenvprogram.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#ifndef TEXENVPROGRAM_H
-#define TEXENVPROGRAM_H
-
-
-struct gl_context;
-
-extern struct gl_fragment_program *
-_mesa_get_fixed_func_fragment_program(struct gl_context *ctx);
-
-#endif
diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c
deleted file mode 100644
index 372ef26..0000000
--- a/src/mesa/main/texfetch.c
+++ /dev/null
@@ -1,834 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2009 VMware, 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
- * 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 texfetch.c
- *
- * Texel fetch/store functions
- *
- * \author Gareth Hughes
- */
-
-
-#include "colormac.h"
-#include "macros.h"
-#include "texcompress.h"
-#include "texcompress_fxt1.h"
-#include "texcompress_s3tc.h"
-#include "texfetch.h"
-
-
-/**
- * Convert an 8-bit sRGB value from non-linear space to a
- * linear RGB value in [0, 1].
- * Implemented with a 256-entry lookup table.
- */
-static INLINE GLfloat
-nonlinear_to_linear(GLubyte cs8)
-{
- static GLfloat table[256];
- static GLboolean tableReady = GL_FALSE;
- if (!tableReady) {
- /* compute lookup table now */
- GLuint i;
- for (i = 0; i < 256; i++) {
- const GLfloat cs = UBYTE_TO_FLOAT(i);
- if (cs <= 0.04045) {
- table[i] = cs / 12.92f;
- }
- else {
- table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4);
- }
- }
- tableReady = GL_TRUE;
- }
- return table[cs8];
-}
-
-
-
-/* Texel fetch routines for all supported formats
- */
-#define DIM 1
-#include "texfetch_tmp.h"
-
-#define DIM 2
-#include "texfetch_tmp.h"
-
-#define DIM 3
-#include "texfetch_tmp.h"
-
-/**
- * Null texel fetch function.
- *
- * Have to have this so the FetchTexel function pointer is never NULL.
- */
-static void fetch_null_texelf( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- (void) texImage; (void) i; (void) j; (void) k;
- texel[RCOMP] = 0.0;
- texel[GCOMP] = 0.0;
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 0.0;
- _mesa_warning(NULL, "fetch_null_texelf() called!");
-}
-
-static void store_null_texel(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- (void) texImage;
- (void) i;
- (void) j;
- (void) k;
- (void) texel;
- /* no-op */
-}
-
-
-
-/**
- * Table to map MESA_FORMAT_ to texel fetch/store funcs.
- * XXX this is somewhat temporary.
- */
-static struct {
- gl_format Name;
- FetchTexelFuncF Fetch1D;
- FetchTexelFuncF Fetch2D;
- FetchTexelFuncF Fetch3D;
- StoreTexelFunc StoreTexel;
-}
-texfetch_funcs[MESA_FORMAT_COUNT] =
-{
- {
- MESA_FORMAT_NONE,
- fetch_null_texelf,
- fetch_null_texelf,
- fetch_null_texelf,
- store_null_texel
- },
-
- {
- MESA_FORMAT_RGBA8888,
- fetch_texel_1d_f_rgba8888,
- fetch_texel_2d_f_rgba8888,
- fetch_texel_3d_f_rgba8888,
- store_texel_rgba8888
- },
- {
- MESA_FORMAT_RGBA8888_REV,
- fetch_texel_1d_f_rgba8888_rev,
- fetch_texel_2d_f_rgba8888_rev,
- fetch_texel_3d_f_rgba8888_rev,
- store_texel_rgba8888_rev
- },
- {
- MESA_FORMAT_ARGB8888,
- fetch_texel_1d_f_argb8888,
- fetch_texel_2d_f_argb8888,
- fetch_texel_3d_f_argb8888,
- store_texel_argb8888
- },
- {
- MESA_FORMAT_ARGB8888_REV,
- fetch_texel_1d_f_argb8888_rev,
- fetch_texel_2d_f_argb8888_rev,
- fetch_texel_3d_f_argb8888_rev,
- store_texel_argb8888_rev
- },
- {
- MESA_FORMAT_XRGB8888,
- fetch_texel_1d_f_xrgb8888,
- fetch_texel_2d_f_xrgb8888,
- fetch_texel_3d_f_xrgb8888,
- store_texel_xrgb8888
- },
- {
- MESA_FORMAT_XRGB8888_REV,
- fetch_texel_1d_f_xrgb8888_rev,
- fetch_texel_2d_f_xrgb8888_rev,
- fetch_texel_3d_f_xrgb8888_rev,
- store_texel_xrgb8888_rev,
- },
- {
- MESA_FORMAT_RGB888,
- fetch_texel_1d_f_rgb888,
- fetch_texel_2d_f_rgb888,
- fetch_texel_3d_f_rgb888,
- store_texel_rgb888
- },
- {
- MESA_FORMAT_BGR888,
- fetch_texel_1d_f_bgr888,
- fetch_texel_2d_f_bgr888,
- fetch_texel_3d_f_bgr888,
- store_texel_bgr888
- },
- {
- MESA_FORMAT_RGB565,
- fetch_texel_1d_f_rgb565,
- fetch_texel_2d_f_rgb565,
- fetch_texel_3d_f_rgb565,
- store_texel_rgb565
- },
- {
- MESA_FORMAT_RGB565_REV,
- fetch_texel_1d_f_rgb565_rev,
- fetch_texel_2d_f_rgb565_rev,
- fetch_texel_3d_f_rgb565_rev,
- store_texel_rgb565_rev
- },
- {
- MESA_FORMAT_ARGB4444,
- fetch_texel_1d_f_argb4444,
- fetch_texel_2d_f_argb4444,
- fetch_texel_3d_f_argb4444,
- store_texel_argb4444
- },
- {
- MESA_FORMAT_ARGB4444_REV,
- fetch_texel_1d_f_argb4444_rev,
- fetch_texel_2d_f_argb4444_rev,
- fetch_texel_3d_f_argb4444_rev,
- store_texel_argb4444_rev
- },
- {
- MESA_FORMAT_RGBA5551,
- fetch_texel_1d_f_rgba5551,
- fetch_texel_2d_f_rgba5551,
- fetch_texel_3d_f_rgba5551,
- store_texel_rgba5551
- },
- {
- MESA_FORMAT_ARGB1555,
- fetch_texel_1d_f_argb1555,
- fetch_texel_2d_f_argb1555,
- fetch_texel_3d_f_argb1555,
- store_texel_argb1555
- },
- {
- MESA_FORMAT_ARGB1555_REV,
- fetch_texel_1d_f_argb1555_rev,
- fetch_texel_2d_f_argb1555_rev,
- fetch_texel_3d_f_argb1555_rev,
- store_texel_argb1555_rev
- },
- {
- MESA_FORMAT_AL88,
- fetch_texel_1d_f_al88,
- fetch_texel_2d_f_al88,
- fetch_texel_3d_f_al88,
- store_texel_al88
- },
- {
- MESA_FORMAT_AL88_REV,
- fetch_texel_1d_f_al88_rev,
- fetch_texel_2d_f_al88_rev,
- fetch_texel_3d_f_al88_rev,
- store_texel_al88_rev
- },
- {
- MESA_FORMAT_AL1616,
- fetch_texel_1d_f_al1616,
- fetch_texel_2d_f_al1616,
- fetch_texel_3d_f_al1616,
- store_texel_al1616
- },
- {
- MESA_FORMAT_AL1616_REV,
- fetch_texel_1d_f_al1616_rev,
- fetch_texel_2d_f_al1616_rev,
- fetch_texel_3d_f_al1616_rev,
- store_texel_al1616_rev
- },
- {
- MESA_FORMAT_RGB332,
- fetch_texel_1d_f_rgb332,
- fetch_texel_2d_f_rgb332,
- fetch_texel_3d_f_rgb332,
- store_texel_rgb332
- },
- {
- MESA_FORMAT_A8,
- fetch_texel_1d_f_a8,
- fetch_texel_2d_f_a8,
- fetch_texel_3d_f_a8,
- store_texel_a8
- },
- {
- MESA_FORMAT_L8,
- fetch_texel_1d_f_l8,
- fetch_texel_2d_f_l8,
- fetch_texel_3d_f_l8,
- store_texel_l8
- },
- {
- MESA_FORMAT_I8,
- fetch_texel_1d_f_i8,
- fetch_texel_2d_f_i8,
- fetch_texel_3d_f_i8,
- store_texel_i8
- },
- {
- MESA_FORMAT_CI8,
- fetch_texel_1d_f_ci8,
- fetch_texel_2d_f_ci8,
- fetch_texel_3d_f_ci8,
- store_texel_ci8
- },
- {
- MESA_FORMAT_YCBCR,
- fetch_texel_1d_f_ycbcr,
- fetch_texel_2d_f_ycbcr,
- fetch_texel_3d_f_ycbcr,
- store_texel_ycbcr
- },
- {
- MESA_FORMAT_YCBCR_REV,
- fetch_texel_1d_f_ycbcr_rev,
- fetch_texel_2d_f_ycbcr_rev,
- fetch_texel_3d_f_ycbcr_rev,
- store_texel_ycbcr_rev
- },
- {
- MESA_FORMAT_R8,
- fetch_texel_1d_f_r8,
- fetch_texel_2d_f_r8,
- fetch_texel_3d_f_r8,
- store_texel_r8,
- },
- {
- MESA_FORMAT_RG88,
- fetch_texel_1d_f_rg88,
- fetch_texel_2d_f_rg88,
- fetch_texel_3d_f_rg88,
- store_texel_rg88,
- },
- {
- MESA_FORMAT_RG88_REV,
- fetch_texel_1d_f_rg88_rev,
- fetch_texel_2d_f_rg88_rev,
- fetch_texel_3d_f_rg88_rev,
- store_texel_rg88_rev,
- },
- {
- MESA_FORMAT_R16,
- fetch_texel_1d_f_r16,
- fetch_texel_2d_f_r16,
- fetch_texel_3d_f_r16,
- store_texel_r16,
- },
- {
- MESA_FORMAT_RG1616,
- fetch_texel_1d_f_rg1616,
- fetch_texel_2d_f_rg1616,
- fetch_texel_3d_f_rg1616,
- store_texel_rg1616,
- },
- {
- MESA_FORMAT_RG1616_REV,
- fetch_texel_1d_f_rg1616_rev,
- fetch_texel_2d_f_rg1616_rev,
- fetch_texel_3d_f_rg1616_rev,
- store_texel_rg1616_rev,
- },
- {
- MESA_FORMAT_Z24_S8,
- fetch_texel_1d_f_z24_s8,
- fetch_texel_2d_f_z24_s8,
- fetch_texel_3d_f_z24_s8,
- store_texel_z24_s8
- },
- {
- MESA_FORMAT_S8_Z24,
- fetch_texel_1d_f_s8_z24,
- fetch_texel_2d_f_s8_z24,
- fetch_texel_3d_f_s8_z24,
- store_texel_s8_z24
- },
- {
- MESA_FORMAT_Z16,
- fetch_texel_1d_f_z16,
- fetch_texel_2d_f_z16,
- fetch_texel_3d_f_z16,
- store_texel_z16
- },
- {
- MESA_FORMAT_X8_Z24,
- fetch_texel_1d_f_s8_z24,
- fetch_texel_2d_f_s8_z24,
- fetch_texel_3d_f_s8_z24,
- store_texel_s8_z24
- },
- {
- MESA_FORMAT_Z24_X8,
- fetch_texel_1d_f_z24_s8,
- fetch_texel_2d_f_z24_s8,
- fetch_texel_3d_f_z24_s8,
- store_texel_z24_s8
- },
- {
- MESA_FORMAT_Z32,
- fetch_texel_1d_f_z32,
- 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
- }
-};
-
-
-static FetchTexelFuncF
-_mesa_get_texel_fetch_func(gl_format format, GLuint dims)
-{
-#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;
- }
-}
-
-
-StoreTexelFunc
-_mesa_get_texel_store_func(gl_format format)
-{
- assert(format < MESA_FORMAT_COUNT);
- return texfetch_funcs[format].StoreTexel;
-}
-
-
-/**
- * Adaptor for fetching a GLchan texel from a float-valued texture.
- */
-static void
-fetch_texel_float_to_chan(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texelOut)
-{
- GLfloat temp[4];
- GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
-
- ASSERT(texImage->FetchTexelf);
- texImage->FetchTexelf(texImage, i, j, k, temp);
- if (baseFormat == GL_DEPTH_COMPONENT ||
- baseFormat == GL_DEPTH_STENCIL_EXT) {
- /* just one channel */
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
- }
- else {
- /* four channels */
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[1], temp[1]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[2], temp[2]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[3], temp[3]);
- }
-}
-
-
-#if 0
-/**
- * Adaptor for fetching a float texel from a GLchan-valued texture.
- */
-static void
-fetch_texel_chan_to_float(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texelOut)
-{
- GLchan temp[4];
- GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
-
- ASSERT(texImage->FetchTexelc);
- texImage->FetchTexelc(texImage, i, j, k, temp);
- if (baseFormat == GL_DEPTH_COMPONENT ||
- baseFormat == GL_DEPTH_STENCIL_EXT) {
- /* just one channel */
- texelOut[0] = CHAN_TO_FLOAT(temp[0]);
- }
- else {
- /* four channels */
- texelOut[0] = CHAN_TO_FLOAT(temp[0]);
- texelOut[1] = CHAN_TO_FLOAT(temp[1]);
- texelOut[2] = CHAN_TO_FLOAT(temp[2]);
- texelOut[3] = CHAN_TO_FLOAT(temp[3]);
- }
-}
-#endif
-
-
-/**
- * Initialize the texture image's FetchTexelc and FetchTexelf methods.
- */
-void
-_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims)
-{
- ASSERT(dims == 1 || dims == 2 || dims == 3);
-
- texImage->FetchTexelf =
- _mesa_get_texel_fetch_func(texImage->TexFormat, dims);
-
- texImage->FetchTexelc = fetch_texel_float_to_chan;
-
- ASSERT(texImage->FetchTexelc);
- ASSERT(texImage->FetchTexelf);
-}
diff --git a/src/mesa/main/texfetch.h b/src/mesa/main/texfetch.h
deleted file mode 100644
index ef13bf2..0000000
--- a/src/mesa/main/texfetch.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2009 VMware, 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
- * 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 TEXFETCH_H
-#define TEXFETCH_H
-
-#include "mtypes.h"
-#include "formats.h"
-
-
-extern StoreTexelFunc
-_mesa_get_texel_store_func(gl_format format);
-
-extern void
-_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims);
-
-#endif
diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h
deleted file mode 100644
index 6a0b2de..0000000
--- a/src/mesa/main/texfetch_tmp.h
+++ /dev/null
@@ -1,1919 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2008-2009 VMware, 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
- * 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 texfetch_tmp.h
- * Texel fetch functions template.
- *
- * This template file is used by texfetch.c to generate texel fetch functions
- * for 1-D, 2-D and 3-D texture images.
- *
- * It should be expanded by defining \p DIM as the number texture dimensions
- * (1, 2 or 3). According to the value of \p DIM a series of macros is defined
- * for the texel lookup in the gl_texture_image::Data.
- *
- * \author Gareth Hughes
- * \author Brian Paul
- */
-
-
-#if DIM == 1
-
-#define TEXEL_ADDR( type, image, i, j, k, size ) \
- ((void) (j), (void) (k), ((type *)(image)->Data + (i) * (size)))
-
-#define FETCH(x) fetch_texel_1d_##x
-
-#elif DIM == 2
-
-#define TEXEL_ADDR( type, image, i, j, k, size ) \
- ((void) (k), \
- ((type *)(image)->Data + ((image)->RowStride * (j) + (i)) * (size)))
-
-#define FETCH(x) fetch_texel_2d_##x
-
-#elif DIM == 3
-
-#define TEXEL_ADDR( type, image, i, j, k, size ) \
- ((type *)(image)->Data + ((image)->ImageOffsets[k] \
- + (image)->RowStride * (j) + (i)) * (size))
-
-#define FETCH(x) fetch_texel_3d_##x
-
-#else
-#error illegal number of texture dimensions
-#endif
-
-
-/* MESA_FORMAT_Z32 ***********************************************************/
-
-/* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture,
- * returning 1 GLfloat.
- * Note: no GLchan version of this function.
- */
-static void FETCH(f_z32)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- texel[0] = src[0] * (1.0F / 0xffffffff);
-}
-
-#if DIM == 3
-static void store_texel_z32(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLuint *depth = (const GLuint *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- dst[0] = *depth;
-}
-#endif
-
-
-/* MESA_FORMAT_Z16 ***********************************************************/
-
-/* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture,
- * returning 1 GLfloat.
- * Note: no GLchan version of this function.
- */
-static void FETCH(f_z16)(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[0] = src[0] * (1.0F / 65535.0F);
-}
-
-#if DIM == 3
-static void store_texel_z16(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLushort *depth = (const GLushort *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- dst[0] = *depth;
-}
-#endif
-
-
-/* MESA_FORMAT_RGBA_F32 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats.
- */
-static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
- texel[RCOMP] = src[0];
- texel[GCOMP] = src[1];
- texel[BCOMP] = src[2];
- texel[ACOMP] = src[3];
-}
-
-#if DIM == 3
-static void store_texel_rgba_f32(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *depth = (const GLfloat *) texel;
- GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
- dst[0] = depth[RCOMP];
- dst[1] = depth[GCOMP];
- dst[2] = depth[BCOMP];
- dst[3] = depth[ACOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_RGBA_F16 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
- texel[RCOMP] = _mesa_half_to_float(src[0]);
- texel[GCOMP] = _mesa_half_to_float(src[1]);
- texel[BCOMP] = _mesa_half_to_float(src[2]);
- texel[ACOMP] = _mesa_half_to_float(src[3]);
-}
-
-#if DIM == 3
-static void store_texel_rgba_f16(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *src = (const GLfloat *) texel;
- GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
- dst[0] = _mesa_float_to_half(src[RCOMP]);
- dst[1] = _mesa_float_to_half(src[GCOMP]);
- dst[2] = _mesa_float_to_half(src[BCOMP]);
- dst[3] = _mesa_float_to_half(src[ACOMP]);
-}
-#endif
-
-/* MESA_FORMAT_RGB_F32 *******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
- texel[RCOMP] = src[0];
- texel[GCOMP] = src[1];
- texel[BCOMP] = src[2];
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb_f32(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *src = (const GLfloat *) texel;
- GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
- dst[0] = src[RCOMP];
- dst[1] = src[GCOMP];
- dst[2] = src[BCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_RGB_F16 *******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
- texel[RCOMP] = _mesa_half_to_float(src[0]);
- texel[GCOMP] = _mesa_half_to_float(src[1]);
- texel[BCOMP] = _mesa_half_to_float(src[2]);
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb_f16(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *src = (const GLfloat *) texel;
- GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
- dst[0] = _mesa_float_to_half(src[RCOMP]);
- dst[1] = _mesa_float_to_half(src[GCOMP]);
- dst[2] = _mesa_float_to_half(src[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ALPHA_F32 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = 0.0F;
- texel[ACOMP] = src[0];
-}
-
-#if DIM == 3
-static void store_texel_alpha_f32(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *rgba = (const GLfloat *) texel;
- GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
- dst[0] = rgba[ACOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_ALPHA_F32 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = 0.0F;
- texel[ACOMP] = _mesa_half_to_float(src[0]);
-}
-
-#if DIM == 3
-static void store_texel_alpha_f16(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *rgba = (const GLfloat *) texel;
- GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
- dst[0] = _mesa_float_to_half(rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_LUMINANCE_F32 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = src[0];
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_luminance_f32(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *rgba = (const GLfloat *) texel;
- GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
- dst[0] = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_LUMINANCE_F16 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = _mesa_half_to_float(src[0]);
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_luminance_f16(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *rgba = (const GLfloat *) texel;
- GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
- dst[0] = _mesa_float_to_half(rgba[RCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = src[0];
- texel[ACOMP] = src[1];
-}
-
-#if DIM == 3
-static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *rgba = (const GLfloat *) texel;
- GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[ACOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = _mesa_half_to_float(src[0]);
- texel[ACOMP] = _mesa_half_to_float(src[1]);
-}
-
-#if DIM == 3
-static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *rgba = (const GLfloat *) texel;
- GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
- dst[0] = _mesa_float_to_half(rgba[RCOMP]);
- dst[1] = _mesa_float_to_half(rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_INTENSITY_F32 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] =
- texel[ACOMP] = src[0];
-}
-
-#if DIM == 3
-static void store_texel_intensity_f32(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *rgba = (const GLfloat *) texel;
- GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
- dst[0] = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_INTENSITY_F16 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] =
- texel[ACOMP] = _mesa_half_to_float(src[0]);
-}
-
-#if DIM == 3
-static void store_texel_intensity_f16(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLfloat *rgba = (const GLfloat *) texel;
- GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
- dst[0] = _mesa_float_to_half(rgba[RCOMP]);
-}
-#endif
-
-
-
-
-/*
- * Begin Hardware formats
- */
-
-/* MESA_FORMAT_RGBA8888 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
-static void FETCH(f_rgba8888)( 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] = UBYTE_TO_FLOAT( (s >> 24) );
- texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
-}
-
-
-
-#if DIM == 3
-static void store_texel_rgba8888(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RGBA888_REV ***************************************************/
-
-/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
-static void FETCH(f_rgba8888_rev)( 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] = UBYTE_TO_FLOAT( (s ) & 0xff );
- texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) );
-}
-
-#if DIM == 3
-static void store_texel_rgba8888_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ARGB8888 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
-static void FETCH(f_argb8888)( 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] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- texel[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
- texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) );
-}
-
-#if DIM == 3
-static void store_texel_argb8888(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ARGB8888_REV **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_argb8888_rev)( 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] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
- texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
-}
-
-#if DIM == 3
-static void store_texel_argb8888_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_8888(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_XRGB8888 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */
-static void FETCH(f_xrgb8888)( 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] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- texel[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
- texel[ACOMP] = 1.0f;
-}
-
-#if DIM == 3
-static void store_texel_xrgb8888(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_8888(0xff, rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_XRGB8888_REV **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_xrgb8888_rev)( 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] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
- texel[ACOMP] = 1.0f;
-}
-
-#if DIM == 3
-static void store_texel_xrgb8888_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_8888(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], 0xff);
-}
-#endif
-
-
-/* MESA_FORMAT_RGB888 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
-static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
- texel[RCOMP] = UBYTE_TO_FLOAT( src[2] );
- texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
- texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb888(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, 3);
- dst[0] = rgba[BCOMP];
- dst[1] = rgba[GCOMP];
- dst[2] = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_BGR888 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
-static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
- texel[RCOMP] = UBYTE_TO_FLOAT( src[0] );
- texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
- texel[BCOMP] = UBYTE_TO_FLOAT( src[2] );
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_bgr888(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, 3);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[GCOMP];
- dst[2] = rgba[BCOMP];
-}
-#endif
-
-
-/* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding)
- instead of slow (g << 2) * 255 / 252 (always rounds down) */
-
-/* MESA_FORMAT_RGB565 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
-static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- const GLushort s = *src;
- texel[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
- texel[GCOMP] = ((s >> 5 ) & 0x3f) * (1.0F / 63.0F);
- texel[BCOMP] = ((s ) & 0x1f) * (1.0F / 31.0F);
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb565(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_565(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RGB565_REV ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */
-static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 3) & 0xfc) | ((s >> 9) & 0x3) );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) );
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb565_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_565(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ARGB4444 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
-static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- const GLushort s = *src;
- texel[RCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F);
- texel[GCOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
- texel[BCOMP] = ((s ) & 0xf) * (1.0F / 15.0F);
- texel[ACOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
-}
-
-#if DIM == 3
-static void store_texel_argb4444(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ARGB4444_REV **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */
-static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[RCOMP] = ((s ) & 0xf) * (1.0F / 15.0F);
- texel[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
- texel[BCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F);
- texel[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
-}
-
-#if DIM == 3
-static void store_texel_argb4444_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]);
-}
-#endif
-
-/* MESA_FORMAT_RGBA5551 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_rgba5551)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- const GLushort s = *src;
- texel[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
- texel[GCOMP] = ((s >> 6) & 0x1f) * (1.0F / 31.0F);
- texel[BCOMP] = ((s >> 1) & 0x1f) * (1.0F / 31.0F);
- texel[ACOMP] = ((s ) & 0x01) * 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgba5551(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_5551(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-/* MESA_FORMAT_ARGB1555 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- const GLushort s = *src;
- texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F);
- texel[GCOMP] = ((s >> 5) & 0x1f) * (1.0F / 31.0F);
- texel[BCOMP] = ((s >> 0) & 0x1f) * (1.0F / 31.0F);
- texel[ACOMP] = ((s >> 15) & 0x01) * 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_argb1555(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_1555(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ARGB1555_REV **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */
-static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) );
- texel[ACOMP] = UBYTE_TO_FLOAT( ((s >> 15) & 0x01) * 255 );
-}
-
-#if DIM == 3
-static void store_texel_argb1555_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_1555_REV(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RG88 **********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
-static void FETCH(f_rg88)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[RCOMP] = UBYTE_TO_FLOAT( s & 0xff );
- texel[GCOMP] = UBYTE_TO_FLOAT( s >> 8 );
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 1.0;
-}
-
-#if DIM == 3
-static void store_texel_rg88(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_88(rgba[RCOMP], rgba[GCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RG88_REV ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg88_rev texture, return 4 GLchans */
-static void FETCH(f_rg88_rev)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[RCOMP] = UBYTE_TO_FLOAT( s & 0xff );
- texel[GCOMP] = UBYTE_TO_FLOAT( s >> 8 );
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 1.0;
-}
-
-#if DIM == 3
-static void store_texel_rg88_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_88(rgba[GCOMP], rgba[RCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_AL88 **********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
-static void FETCH(f_al88)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff );
- texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 );
-}
-
-#if DIM == 3
-static void store_texel_al88(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_88(rgba[ACOMP], rgba[RCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_R8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
-static void FETCH(f_r8)(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
- texel[RCOMP] = UBYTE_TO_FLOAT(s);
- texel[GCOMP] = 0.0;
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 1.0;
-}
-
-#if DIM == 3
-static void store_texel_r8(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, 1);
- *dst = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_R16 ***********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D r16 texture, return 4 GLchans */
-static void FETCH(f_r16)(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[RCOMP] = USHORT_TO_FLOAT(s);
- texel[GCOMP] = 0.0;
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 1.0;
-}
-
-#if DIM == 3
-static void store_texel_r16(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, 1);
- *dst = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_AL88_REV ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
-static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 );
- texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff );
-}
-
-#if DIM == 3
-static void store_texel_al88_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_88(rgba[RCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RG1616 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg1616 texture, return 4 GLchans */
-static void FETCH(f_rg1616)( 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] = USHORT_TO_FLOAT( s & 0xffff );
- texel[GCOMP] = USHORT_TO_FLOAT( s >> 16 );
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 1.0;
-}
-
-#if DIM == 3
-static void store_texel_rg1616(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_1616(rgba[RCOMP], rgba[GCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RG1616_REV ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg1616_rev texture, return 4 GLchans */
-static void FETCH(f_rg1616_rev)( 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] = USHORT_TO_FLOAT( s >> 16 );
- texel[GCOMP] = USHORT_TO_FLOAT( s & 0xffff );
- texel[BCOMP] = 0.0;
- texel[ACOMP] = 1.0;
-}
-
-#if DIM == 3
-static void store_texel_rg1616_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_1616(rgba[GCOMP], rgba[RCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_AL1616 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */
-static void FETCH(f_al1616)( 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] =
- texel[GCOMP] =
- texel[BCOMP] = USHORT_TO_FLOAT( s & 0xffff );
- texel[ACOMP] = USHORT_TO_FLOAT( s >> 16 );
-}
-
-#if DIM == 3
-static void store_texel_al1616(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLushort *rgba = (const GLushort *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_1616(rgba[ACOMP], rgba[RCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_AL1616_REV ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al1616_rev texture, return 4 GLchans */
-static void FETCH(f_al1616_rev)( 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] =
- texel[GCOMP] =
- texel[BCOMP] = USHORT_TO_FLOAT( s >> 16 );
- texel[ACOMP] = USHORT_TO_FLOAT( s & 0xffff );
-}
-
-#if DIM == 3
-static void store_texel_al1616_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLushort *rgba = (const GLushort *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_1616(rgba[RCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RGB332 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
-static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
- const GLubyte s = *src;
- texel[RCOMP] = ((s >> 5) & 0x7) * (1.0F / 7.0F);
- texel[GCOMP] = ((s >> 2) & 0x7) * (1.0F / 7.0F);
- texel[BCOMP] = ((s ) & 0x3) * (1.0F / 3.0F);
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb332(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, 1);
- *dst = PACK_COLOR_332(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_A8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(f_a8)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = 0.0F;
- texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
-}
-
-#if DIM == 3
-static void store_texel_a8(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, 1);
- *dst = rgba[ACOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_L8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
-static void FETCH(f_l8)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_l8(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, 1);
- *dst = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_I8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
-static void FETCH(f_i8)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] =
- texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
-}
-
-#if DIM == 3
-static void store_texel_i8(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, 1);
- *dst = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_CI8 ***********************************************************/
-
-/* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a
- * color table, and return 4 GLchans.
- */
-static void FETCH(f_ci8)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
- const struct gl_color_table *palette;
- GLuint index;
- GET_CURRENT_CONTEXT(ctx);
-
- if (ctx->Texture.SharedPalette) {
- palette = &ctx->Texture.Palette;
- }
- else {
- palette = &texImage->TexObject->Palette;
- }
- if (palette->Size == 0)
- return; /* undefined results */
-
- /* Mask the index against size of palette to avoid going out of bounds */
- index = (*src) & (palette->Size - 1);
-
- {
- const GLfloat *table = palette->TableF;
- switch (palette->_BaseFormat) {
- case GL_ALPHA:
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = 0.0F;
- texel[ACOMP] = table[index];
- break;
- case GL_LUMINANCE:
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = table[index];
- texel[ACOMP] = 1.0F;
- break;
- case GL_INTENSITY:
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] =
- texel[ACOMP] = table[index];
- break;
- case GL_LUMINANCE_ALPHA:
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = table[index * 2 + 0];
- texel[ACOMP] = table[index * 2 + 1];
- break;
- case GL_RGB:
- texel[RCOMP] = table[index * 3 + 0];
- texel[GCOMP] = table[index * 3 + 1];
- texel[BCOMP] = table[index * 3 + 2];
- texel[ACOMP] = 1.0F;
- break;
- case GL_RGBA:
- texel[RCOMP] = table[index * 4 + 0];
- texel[GCOMP] = table[index * 4 + 1];
- texel[BCOMP] = table[index * 4 + 2];
- texel[ACOMP] = table[index * 4 + 3];
- break;
- default:
- _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8");
- return;
- }
- }
-}
-
-#if DIM == 3
-static void store_texel_ci8(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *index = (const GLubyte *) texel;
- GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
- *dst = *index;
-}
-#endif
-
-
-/* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */
-/* Note: component order is same as for MESA_FORMAT_RGB888 */
-static void FETCH(srgb8)(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
- texel[RCOMP] = nonlinear_to_linear(src[2]);
- texel[GCOMP] = nonlinear_to_linear(src[1]);
- texel[BCOMP] = nonlinear_to_linear(src[0]);
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_srgb8(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, 3);
- dst[0] = rgba[BCOMP]; /* no conversion */
- dst[1] = rgba[GCOMP];
- dst[2] = rgba[RCOMP];
-}
-#endif
-
-/* Fetch texel from 1D, 2D or 3D srgba8 texture, return 4 GLfloats */
-static void FETCH(srgba8)(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] = nonlinear_to_linear( (s >> 24) );
- texel[GCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
- texel[BCOMP] = nonlinear_to_linear( (s >> 8) & 0xff );
- texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); /* linear! */
-}
-
-#if DIM == 3
-static void store_texel_srgba8(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */
-static void FETCH(sargb8)(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] = nonlinear_to_linear( (s >> 16) & 0xff );
- texel[GCOMP] = nonlinear_to_linear( (s >> 8) & 0xff );
- texel[BCOMP] = nonlinear_to_linear( (s ) & 0xff );
- texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); /* linear! */
-}
-
-#if DIM == 3
-static void store_texel_sargb8(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-/* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */
-static void FETCH(sl8)(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = nonlinear_to_linear(src[0]);
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_sl8(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, 1);
- dst[0] = rgba[RCOMP];
-}
-#endif
-
-/* Fetch texel from 1D, 2D or 3D sla8 texture, return 4 GLfloats */
-static void FETCH(sla8)(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = nonlinear_to_linear(src[0]);
- texel[ACOMP] = UBYTE_TO_FLOAT(src[1]); /* linear */
-}
-
-#if DIM == 3
-static void store_texel_sla8(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, 2);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[ACOMP];
-}
-#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,
- however we'll return the dudv values as rg and fix up elsewhere */
-static void FETCH(dudv8)(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2);
- texel[RCOMP] = BYTE_TO_FLOAT(src[0]);
- texel[GCOMP] = BYTE_TO_FLOAT(src[1]);
- texel[BCOMP] = 0;
- 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,
- 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] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) );
-}
-
-#if DIM == 3
-static void store_texel_signed_rgba8888(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], rgba[ACOMP]);
-}
-#endif
-
-static void FETCH(signed_rgba8888_rev)( 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 ) );
- texel[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
- texel[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) );
- texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
-}
-
-#if DIM == 3
-static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-
-/* 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.
- * We convert YCbCr to RGB here.
- */
-static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
- const GLushort *src1 = src0 + 1; /* odd */
- const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */
- const GLubyte cb = *src0 & 0xff; /* chroma U */
- const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */
- const GLubyte cr = *src1 & 0xff; /* chroma V */
- const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */
- GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
- GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
- GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
- r *= (1.0F / 255.0F);
- g *= (1.0F / 255.0F);
- b *= (1.0F / 255.0F);
- texel[RCOMP] = CLAMP(r, 0.0F, 1.0F);
- texel[GCOMP] = CLAMP(g, 0.0F, 1.0F);
- texel[BCOMP] = CLAMP(b, 0.0F, 1.0F);
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_ycbcr(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- (void) texImage;
- (void) i;
- (void) j;
- (void) k;
- (void) texel;
- /* XXX to do */
-}
-#endif
-
-
-/* MESA_FORMAT_YCBCR_REV *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats.
- * We convert YCbCr to RGB here.
- */
-static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
- const GLushort *src1 = src0 + 1; /* odd */
- const GLubyte y0 = *src0 & 0xff; /* luminance */
- const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */
- const GLubyte y1 = *src1 & 0xff; /* luminance */
- const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */
- const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */
- GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
- GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
- GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
- r *= (1.0F / 255.0F);
- g *= (1.0F / 255.0F);
- b *= (1.0F / 255.0F);
- texel[RCOMP] = CLAMP(r, 0.0F, 1.0F);
- texel[GCOMP] = CLAMP(g, 0.0F, 1.0F);
- texel[BCOMP] = CLAMP(b, 0.0F, 1.0F);
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_ycbcr_rev(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- (void) texImage;
- (void) i;
- (void) j;
- (void) k;
- (void) texel;
- /* XXX to do */
-}
-#endif
-
-
-/* MESA_TEXFORMAT_Z24_S8 ***************************************************/
-
-static void FETCH(f_z24_s8)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- /* only return Z, not stencil data */
- const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
- texel[0] = ((*src) >> 8) * scale;
- ASSERT(texImage->TexFormat == MESA_FORMAT_Z24_S8);
- ASSERT(texel[0] >= 0.0F);
- ASSERT(texel[0] <= 1.0F);
-}
-
-#if DIM == 3
-static void store_texel_z24_s8(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- /* only store Z, not stencil */
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- GLfloat depth = *((GLfloat *) texel);
- GLuint zi = ((GLuint) (depth * 0xffffff)) << 8;
- *dst = zi | (*dst & 0xff);
-}
-#endif
-
-
-/* MESA_TEXFORMAT_S8_Z24 ***************************************************/
-
-static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- /* only return Z, not stencil data */
- const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
- texel[0] = ((*src) & 0x00ffffff) * scale;
- ASSERT(texImage->TexFormat == MESA_FORMAT_S8_Z24);
- ASSERT(texel[0] >= 0.0F);
- ASSERT(texel[0] <= 1.0F);
-}
-
-#if DIM == 3
-static void store_texel_s8_z24(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- /* only store Z, not stencil */
- GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- GLfloat depth = *((GLfloat *) texel);
- GLuint zi = (GLuint) (depth * 0xffffff);
- *dst = zi | (*dst & 0xff000000);
-}
-#endif
-
-
-#undef TEXEL_ADDR
-#undef DIM
-#undef FETCH
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
deleted file mode 100644
index 894c013..0000000
--- a/src/mesa/main/texformat.c
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2008-2009 VMware, 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
- * 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 texformat.c
- * Texture formats.
- *
- * \author Gareth Hughes
- * \author Brian Paul
- */
-
-
-#include "context.h"
-#include "texcompress.h"
-#include "texformat.h"
-
-
-/**
- * Choose an appropriate texture format given the format, type and
- * internalFormat parameters passed to glTexImage().
- *
- * \param ctx the GL context.
- * \param internalFormat user's prefered internal texture format.
- * \param format incoming image pixel format.
- * \param type incoming image data type.
- *
- * \return a pointer to a gl_texture_format object which describes the
- * choosen texture format, or NULL on failure.
- *
- * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers
- * will typically override this function with a specialized version.
- */
-gl_format
-_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- (void) format;
- (void) type;
-
- switch (internalFormat) {
- /* shallow RGBA formats */
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- return MESA_FORMAT_RGBA8888;
- case GL_RGB5_A1:
- return MESA_FORMAT_ARGB1555;
- case GL_RGBA2:
- return MESA_FORMAT_ARGB4444_REV; /* just to test another format*/
- case GL_RGBA4:
- return MESA_FORMAT_ARGB4444;
-
- /* 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_RGB8:
- return MESA_FORMAT_RGB888;
- case GL_R3_G3_B2:
- return MESA_FORMAT_RGB332;
- case GL_RGB4:
- return MESA_FORMAT_RGB565_REV; /* just to test another format */
- 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:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_ALPHA8:
- return MESA_FORMAT_A8;
-
- /* Luminance formats */
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_LUMINANCE8:
- return MESA_FORMAT_L8;
-
- /* Luminance/Alpha formats */
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- return MESA_FORMAT_AL88;
-
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return MESA_FORMAT_AL1616;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_INTENSITY8:
- return MESA_FORMAT_I8;
-
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- case GL_COLOR_INDEX8_EXT:
- return MESA_FORMAT_CI8;
-
- default:
- ; /* fallthrough */
- }
-
- if (ctx->Extensions.ARB_depth_texture) {
- switch (internalFormat) {
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32:
- return MESA_FORMAT_Z32;
- case GL_DEPTH_COMPONENT16:
- return MESA_FORMAT_Z16;
- default:
- ; /* fallthrough */
- }
- }
-
- switch (internalFormat) {
- case GL_COMPRESSED_ALPHA_ARB:
- return MESA_FORMAT_A8;
- case GL_COMPRESSED_LUMINANCE_ARB:
- return MESA_FORMAT_L8;
- case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
- return MESA_FORMAT_AL88;
- case GL_COMPRESSED_INTENSITY_ARB:
- return MESA_FORMAT_I8;
- case GL_COMPRESSED_RGB_ARB:
- if (ctx->Extensions.EXT_texture_compression_s3tc ||
- ctx->Extensions.S3_s3tc)
- return MESA_FORMAT_RGB_DXT1;
- if (ctx->Extensions.TDFX_texture_compression_FXT1)
- return MESA_FORMAT_RGB_FXT1;
- return MESA_FORMAT_RGB888;
- case GL_COMPRESSED_RGBA_ARB:
- if (ctx->Extensions.EXT_texture_compression_s3tc ||
- ctx->Extensions.S3_s3tc)
- return MESA_FORMAT_RGBA_DXT3; /* Not rgba_dxt1, see spec */
- if (ctx->Extensions.TDFX_texture_compression_FXT1)
- return MESA_FORMAT_RGBA_FXT1;
- return MESA_FORMAT_RGBA8888;
- default:
- ; /* fallthrough */
- }
-
- if (ctx->Extensions.MESA_ycbcr_texture) {
- if (internalFormat == GL_YCBCR_MESA) {
- if (type == GL_UNSIGNED_SHORT_8_8_MESA)
- return MESA_FORMAT_YCBCR;
- else
- return MESA_FORMAT_YCBCR_REV;
- }
- }
-
-#if FEATURE_texture_fxt1
- if (ctx->Extensions.TDFX_texture_compression_FXT1) {
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return MESA_FORMAT_RGB_FXT1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return MESA_FORMAT_RGBA_FXT1;
- default:
- ; /* fallthrough */
- }
- }
-#endif
-
-#if FEATURE_texture_s3tc
- if (ctx->Extensions.EXT_texture_compression_s3tc) {
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return MESA_FORMAT_RGB_DXT1;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return MESA_FORMAT_RGBA_DXT1;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return MESA_FORMAT_RGBA_DXT3;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return MESA_FORMAT_RGBA_DXT5;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.S3_s3tc) {
- switch (internalFormat) {
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- return MESA_FORMAT_RGB_DXT1;
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- return MESA_FORMAT_RGBA_DXT3;
- default:
- ; /* fallthrough */
- }
- }
-#endif
-
- if (ctx->Extensions.ARB_texture_float) {
- switch (internalFormat) {
- case GL_ALPHA16F_ARB:
- return MESA_FORMAT_ALPHA_FLOAT16;
- case GL_ALPHA32F_ARB:
- return MESA_FORMAT_ALPHA_FLOAT32;
- case GL_LUMINANCE16F_ARB:
- return MESA_FORMAT_LUMINANCE_FLOAT16;
- case GL_LUMINANCE32F_ARB:
- return MESA_FORMAT_LUMINANCE_FLOAT32;
- case GL_LUMINANCE_ALPHA16F_ARB:
- return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16;
- case GL_LUMINANCE_ALPHA32F_ARB:
- return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32;
- case GL_INTENSITY16F_ARB:
- return MESA_FORMAT_INTENSITY_FLOAT16;
- case GL_INTENSITY32F_ARB:
- return MESA_FORMAT_INTENSITY_FLOAT32;
- case GL_RGB16F_ARB:
- return MESA_FORMAT_RGB_FLOAT16;
- case GL_RGB32F_ARB:
- return MESA_FORMAT_RGB_FLOAT32;
- case GL_RGBA16F_ARB:
- return MESA_FORMAT_RGBA_FLOAT16;
- case GL_RGBA32F_ARB:
- return MESA_FORMAT_RGBA_FLOAT32;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_packed_depth_stencil) {
- switch (internalFormat) {
- case GL_DEPTH_STENCIL_EXT:
- case GL_DEPTH24_STENCIL8_EXT:
- return MESA_FORMAT_Z24_S8;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.ATI_envmap_bumpmap) {
- switch (internalFormat) {
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- return MESA_FORMAT_DUDV8;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.MESA_texture_signed_rgba) {
- switch (internalFormat) {
- case GL_RGBA_SNORM:
- case GL_RGBA8_SNORM:
- return MESA_FORMAT_SIGNED_RGBA8888;
- default:
- ; /* fallthrough */
- }
- }
-
- 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) {
- switch (internalFormat) {
- case GL_SRGB_EXT:
- case GL_SRGB8_EXT:
- return MESA_FORMAT_SRGB8;
- case GL_SRGB_ALPHA_EXT:
- case GL_SRGB8_ALPHA8_EXT:
- return MESA_FORMAT_SRGBA8;
- case GL_SLUMINANCE_EXT:
- case GL_SLUMINANCE8_EXT:
- return MESA_FORMAT_SL8;
- case GL_SLUMINANCE_ALPHA_EXT:
- case GL_SLUMINANCE8_ALPHA8_EXT:
- return MESA_FORMAT_SLA8;
- case GL_COMPRESSED_SLUMINANCE_EXT:
- return MESA_FORMAT_SL8;
- case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
- return MESA_FORMAT_SLA8;
- case GL_COMPRESSED_SRGB_EXT:
-#if FEATURE_texture_s3tc
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGB_DXT1;
-#endif
- return MESA_FORMAT_SRGB8;
- case GL_COMPRESSED_SRGB_ALPHA_EXT:
-#if FEATURE_texture_s3tc
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGBA_DXT3; /* Not srgba_dxt1, see spec */
-#endif
- return MESA_FORMAT_SRGBA8;
-#if FEATURE_texture_s3tc
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGB_DXT1;
- break;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGBA_DXT1;
- break;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGBA_DXT3;
- break;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGBA_DXT5;
- break;
-#endif
- default:
- ; /* fallthrough */
- }
- }
-#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;
- }
- }
-
- if (ctx->Extensions.ARB_texture_rg) {
- switch (internalFormat) {
- case GL_R8:
- case GL_RED:
- case GL_COMPRESSED_RED:
- return MESA_FORMAT_R8;
-
- case GL_R16:
- return MESA_FORMAT_R16;
-
- case GL_RG:
- case GL_RG8:
- case GL_COMPRESSED_RG:
- return MESA_FORMAT_RG88;
-
- case GL_RG16:
- return MESA_FORMAT_RG1616;
-
- default:
- ; /* fallthrough */
- }
- }
-
- _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
- return MESA_FORMAT_NONE;
-}
-
diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h
deleted file mode 100644
index 3cf0921..0000000
--- a/src/mesa/main/texformat.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.75
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2008-2009 VMware, 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
- * 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 TEXFORMAT_H
-#define TEXFORMAT_H
-
-
-#include "formats.h"
-
-struct gl_context;
-
-extern gl_format
-_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
- GLenum format, GLenum type );
-
-
-#endif
diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c
deleted file mode 100644
index 108ea4c..0000000
--- a/src/mesa/main/texgen.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-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 texgen.c
- *
- * glTexGen-related functions
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/enums.h"
-#include "main/macros.h"
-#include "main/texgen.h"
-#include "main/texstate.h"
-#include "math/m_matrix.h"
-#include "main/dispatch.h"
-
-
-#if FEATURE_texgen
-
-
-/**
- * Return texgen state for given coordinate
- */
-static struct gl_texgen *
-get_texgen(struct gl_texture_unit *texUnit, GLenum coord)
-{
- switch (coord) {
- case GL_S:
- return &texUnit->GenS;
- case GL_T:
- return &texUnit->GenT;
- case GL_R:
- return &texUnit->GenR;
- case GL_Q:
- return &texUnit->GenQ;
- default:
- return NULL;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texgen *texgen;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n",
- _mesa_lookup_enum_by_nr(coord),
- _mesa_lookup_enum_by_nr(pname),
- *params,
- _mesa_lookup_enum_by_nr((GLenum) (GLint) *params));
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- texgen = get_texgen(texUnit, coord);
- if (!texgen) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)");
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_GEN_MODE:
- {
- GLenum mode = (GLenum) (GLint) params[0];
- GLbitfield bit = 0x0;
- if (texgen->Mode == mode)
- return;
- switch (mode) {
- case GL_OBJECT_LINEAR:
- bit = TEXGEN_OBJ_LINEAR;
- break;
- case GL_EYE_LINEAR:
- bit = TEXGEN_EYE_LINEAR;
- break;
- case GL_SPHERE_MAP:
- if (coord == GL_S || coord == GL_T)
- bit = TEXGEN_SPHERE_MAP;
- break;
- case GL_REFLECTION_MAP_NV:
- if (coord != GL_Q)
- bit = TEXGEN_REFLECTION_MAP_NV;
- break;
- case GL_NORMAL_MAP_NV:
- if (coord != GL_Q)
- bit = TEXGEN_NORMAL_MAP_NV;
- break;
- default:
- ; /* nop */
- }
- if (!bit) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
- return;
- }
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texgen->Mode = mode;
- texgen->_ModeBit = bit;
- }
- break;
-
- case GL_OBJECT_PLANE:
- {
- if (TEST_EQ_4V(texgen->ObjectPlane, params))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texgen->ObjectPlane, params);
- }
- break;
-
- case GL_EYE_PLANE:
- {
- GLfloat tmp[4];
- /* Transform plane equation by the inverse modelview matrix */
- if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
- _math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
- }
- _mesa_transform_vector(tmp, params,
- ctx->ModelviewMatrixStack.Top->inv);
- if (TEST_EQ_4V(texgen->EyePlane, tmp))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texgen->EyePlane, tmp);
- }
- break;
-
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
- return;
- }
-
- if (ctx->Driver.TexGen)
- ctx->Driver.TexGen( ctx, coord, pname, params );
-}
-
-
-static void GLAPIENTRY
-_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
-{
- GLfloat p[4];
- p[0] = (GLfloat) params[0];
- if (pname == GL_TEXTURE_GEN_MODE) {
- p[1] = p[2] = p[3] = 0.0F;
- }
- else {
- p[1] = (GLfloat) params[1];
- p[2] = (GLfloat) params[2];
- p[3] = (GLfloat) params[3];
- }
- _mesa_TexGenfv(coord, pname, p);
-}
-
-
-static void GLAPIENTRY
-_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
-{
- GLfloat p[4];
- p[0] = (GLfloat) param;
- p[1] = p[2] = p[3] = 0.0F;
- _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 )
-{
- GLfloat p[4];
- p[0] = (GLfloat) params[0];
- if (pname == GL_TEXTURE_GEN_MODE) {
- p[1] = p[2] = p[3] = 0.0F;
- }
- else {
- p[1] = (GLfloat) params[1];
- p[2] = (GLfloat) params[2];
- p[3] = (GLfloat) params[3];
- }
- _mesa_TexGenfv( coord, pname, p );
-}
-
-
-void GLAPIENTRY
-_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
-{
- GLfloat p[4];
- p[0] = param;
- p[1] = p[2] = p[3] = 0.0F;
- _mesa_TexGenfv(coord, pname, p);
-}
-
-
-void GLAPIENTRY
-_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
-{
- GLint p[4];
- p[0] = param;
- p[1] = p[2] = p[3] = 0;
- _mesa_TexGeniv( coord, pname, p );
-}
-
-
-
-static void GLAPIENTRY
-_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texgen *texgen;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- texgen = get_texgen(texUnit, coord);
- if (!texgen) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)");
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_GEN_MODE:
- params[0] = ENUM_TO_DOUBLE(texgen->Mode);
- break;
- case GL_OBJECT_PLANE:
- COPY_4V(params, texgen->ObjectPlane);
- break;
- case GL_EYE_PLANE:
- COPY_4V(params, texgen->EyePlane);
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
- }
-}
-
-
-
-void GLAPIENTRY
-_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texgen *texgen;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- texgen = get_texgen(texUnit, coord);
- if (!texgen) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)");
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_GEN_MODE:
- params[0] = ENUM_TO_FLOAT(texgen->Mode);
- break;
- case GL_OBJECT_PLANE:
- COPY_4V(params, texgen->ObjectPlane);
- break;
- case GL_EYE_PLANE:
- COPY_4V(params, texgen->EyePlane);
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
- }
-}
-
-
-
-static void GLAPIENTRY
-_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texgen *texgen;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- texgen = get_texgen(texUnit, coord);
- if (!texgen) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)");
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_GEN_MODE:
- params[0] = texgen->Mode;
- break;
- case GL_OBJECT_PLANE:
- params[0] = (GLint) texgen->ObjectPlane[0];
- params[1] = (GLint) texgen->ObjectPlane[1];
- params[2] = (GLint) texgen->ObjectPlane[2];
- params[3] = (GLint) texgen->ObjectPlane[3];
- break;
- case GL_EYE_PLANE:
- params[0] = (GLint) texgen->EyePlane[0];
- params[1] = (GLint) texgen->EyePlane[1];
- params[2] = (GLint) texgen->EyePlane[2];
- params[3] = (GLint) texgen->EyePlane[3];
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
- }
-}
-
-
-void
-_mesa_init_texgen_dispatch(struct _glapi_table *disp)
-{
- SET_GetTexGendv(disp, _mesa_GetTexGendv);
- SET_GetTexGenfv(disp, _mesa_GetTexGenfv);
- SET_GetTexGeniv(disp, _mesa_GetTexGeniv);
- SET_TexGend(disp, _mesa_TexGend);
- SET_TexGendv(disp, _mesa_TexGendv);
- SET_TexGenf(disp, _mesa_TexGenf);
- SET_TexGenfv(disp, _mesa_TexGenfv);
- SET_TexGeni(disp, _mesa_TexGeni);
- SET_TexGeniv(disp, _mesa_TexGeniv);
-}
-
-
-#endif /* FEATURE_texgen */
diff --git a/src/mesa/main/texgen.h b/src/mesa/main/texgen.h
deleted file mode 100644
index 9ed8023..0000000
--- a/src/mesa/main/texgen.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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 TEXGEN_H
-#define TEXGEN_H
-
-
-#include "compiler.h"
-#include "glheader.h"
-
-struct _glapi_table;
-
-
-#if FEATURE_texgen
-
-extern void GLAPIENTRY
-_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param );
-
-extern void GLAPIENTRY
-_mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
-
-extern void GLAPIENTRY
-_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
-
-extern void
-_mesa_init_texgen_dispatch(struct _glapi_table *disp);
-
-
-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 )
-{
-}
-
-static void INLINE
-_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
-{
-}
-
-static INLINE void
-_mesa_init_texgen_dispatch(struct _glapi_table *disp)
-{
-}
-
-#endif /* FEATURE_texgen */
-
-
-#endif /* TEXGEN_H */
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
deleted file mode 100644
index c94f88e..0000000
--- a/src/mesa/main/texgetimage.c
+++ /dev/null
@@ -1,905 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2009 VMware, 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
- * 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.
- */
-
-
-/**
- * Code for glGetTexImage() and glGetCompressedTexImage().
- */
-
-
-#include "glheader.h"
-#include "bufferobj.h"
-#include "enums.h"
-#include "context.h"
-#include "formats.h"
-#include "image.h"
-#include "pack.h"
-#include "texgetimage.h"
-#include "teximage.h"
-
-
-
-/**
- * Can the given type represent negative values?
- */
-static INLINE GLboolean
-type_with_negative_values(GLenum type)
-{
- switch (type) {
- case GL_BYTE:
- case GL_SHORT:
- case GL_INT:
- case GL_FLOAT:
- case GL_HALF_FLOAT_ARB:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
-/**
- * glGetTexImage for color index pixels.
- */
-static void
-get_tex_color_index(struct gl_context *ctx, GLuint dimensions,
- GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_image *texImage)
-{
- const GLint width = texImage->Width;
- const GLint height = texImage->Height;
- const GLint depth = texImage->Depth;
- const GLuint indexBits =
- _mesa_get_format_bits(texImage->TexFormat, GL_TEXTURE_INDEX_SIZE_EXT);
- const GLbitfield transferOps = 0x0;
- GLint img, row, col;
-
- for (img = 0; img < depth; img++) {
- for (row = 0; row < height; row++) {
- GLuint indexRow[MAX_WIDTH] = { 0 };
- void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
- width, height, format, type,
- img, row, 0);
- assert(dest);
-
- if (indexBits == 8) {
- const GLubyte *src = (const GLubyte *) texImage->Data;
- src += width * (img * texImage->Height + row);
- for (col = 0; col < width; col++) {
- indexRow[col] = src[col];
- }
- }
- else if (indexBits == 16) {
- const GLushort *src = (const GLushort *) texImage->Data;
- src += width * (img * texImage->Height + row);
- for (col = 0; col < width; col++) {
- indexRow[col] = src[col];
- }
- }
- else {
- _mesa_problem(ctx, "Color index problem in _mesa_GetTexImage");
- }
- _mesa_pack_index_span(ctx, width, type, dest,
- indexRow, &ctx->Pack, transferOps);
- }
- }
-}
-
-
-/**
- * glGetTexImage for depth/Z pixels.
- */
-static void
-get_tex_depth(struct gl_context *ctx, GLuint dimensions,
- GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_image *texImage)
-{
- const GLint width = texImage->Width;
- const GLint height = texImage->Height;
- const GLint depth = texImage->Depth;
- GLint img, row, col;
- GLfloat *depthRow = (GLfloat *) malloc(width * sizeof(GLfloat));
-
- if (!depthRow) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
- return;
- }
-
- for (img = 0; img < depth; img++) {
- for (row = 0; row < height; row++) {
- void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
- width, height, format, type,
- img, row, 0);
- assert(dest);
-
- for (col = 0; col < width; col++) {
- texImage->FetchTexelf(texImage, col, row, img, depthRow + col);
- }
- _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack);
- }
- }
-
- free(depthRow);
-}
-
-
-/**
- * glGetTexImage for depth/stencil pixels.
- */
-static void
-get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
- GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_image *texImage)
-{
- const GLint width = texImage->Width;
- const GLint height = texImage->Height;
- const GLint depth = texImage->Depth;
- const GLuint *src = (const GLuint *) texImage->Data;
- GLint img, row;
-
- for (img = 0; img < depth; img++) {
- for (row = 0; row < height; row++) {
- void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
- width, height, format, type,
- img, row, 0);
- memcpy(dest, src, width * sizeof(GLuint));
- if (ctx->Pack.SwapBytes) {
- _mesa_swap4((GLuint *) dest, width);
- }
-
- src += width * row + width * height * img;
- }
- }
-}
-
-
-/**
- * glGetTexImage for YCbCr pixels.
- */
-static void
-get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions,
- GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_image *texImage)
-{
- const GLint width = texImage->Width;
- const GLint height = texImage->Height;
- const GLint depth = texImage->Depth;
- const GLint rowstride = texImage->RowStride;
- const GLushort *src = (const GLushort *) texImage->Data;
- GLint img, row;
-
- for (img = 0; img < depth; img++) {
- for (row = 0; row < height; row++) {
- void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
- width, height, format, type,
- img, row, 0);
- memcpy(dest, src, width * sizeof(GLushort));
-
- /* check for byte swapping */
- if ((texImage->TexFormat == MESA_FORMAT_YCBCR
- && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) ||
- (texImage->TexFormat == MESA_FORMAT_YCBCR_REV
- && type == GL_UNSIGNED_SHORT_8_8_MESA)) {
- if (!ctx->Pack.SwapBytes)
- _mesa_swap2((GLushort *) dest, width);
- }
- else if (ctx->Pack.SwapBytes) {
- _mesa_swap2((GLushort *) dest, width);
- }
-
- src += rowstride;
- }
- }
-}
-
-
-#if FEATURE_EXT_texture_sRGB
-
-
-/**
- * Convert a float value from linear space to a
- * non-linear sRGB value in [0, 255].
- * Not terribly efficient.
- */
-static INLINE GLfloat
-linear_to_nonlinear(GLfloat cl)
-{
- /* can't have values outside [0, 1] */
- GLfloat cs;
- if (cl < 0.0031308f) {
- cs = 12.92f * cl;
- }
- else {
- cs = (GLfloat)(1.055 * pow(cl, 0.41666) - 0.055);
- }
- return cs;
-}
-
-
-/**
- * glGetTexImagefor sRGB pixels;
- */
-static void
-get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
- GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_image *texImage)
-{
- const GLint width = texImage->Width;
- const GLint height = texImage->Height;
- const GLint depth = texImage->Depth;
- const GLbitfield transferOps = 0x0;
- GLint img, row;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
-
- if (!rgba) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
- return;
- }
-
- for (img = 0; img < depth; img++) {
- for (row = 0; row < height; row++) {
- void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
- width, height, format, type,
- img, row, 0);
-
- GLint col;
-
- /* convert row to RGBA format */
- for (col = 0; col < width; col++) {
- texImage->FetchTexelf(texImage, col, row, img, rgba[col]);
- if (texImage->_BaseFormat == GL_LUMINANCE) {
- rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
- rgba[col][GCOMP] = 0.0;
- rgba[col][BCOMP] = 0.0;
- }
- else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
- rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
- rgba[col][GCOMP] = 0.0;
- rgba[col][BCOMP] = 0.0;
- }
- else if (texImage->_BaseFormat == GL_RGB ||
- texImage->_BaseFormat == GL_RGBA) {
- rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
- rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]);
- rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]);
- }
- }
- _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
- format, type, dest,
- &ctx->Pack, transferOps);
- }
- }
-
- free(rgba);
-}
-
-
-#else /* FEATURE_EXT_texture_sRGB */
-
-
-static INLINE void
-get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
- GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_image *texImage)
-{
- ASSERT_NO_FEATURE();
-}
-
-
-#endif /* FEATURE_EXT_texture_sRGB */
-
-
-/**
- * glGetTexImagefor RGBA, Luminance, etc. pixels.
- * This is the slow way since we use texture sampling.
- */
-static void
-get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
- GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_image *texImage)
-{
- const GLint width = texImage->Width;
- const GLint height = texImage->Height;
- const GLint depth = texImage->Depth;
- /* Normally, no pixel transfer ops are performed during glGetTexImage.
- * The only possible exception is component clamping to [0,1].
- */
- GLbitfield transferOps = 0x0;
- GLint img, row;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
-
- if (!rgba) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
- return;
- }
-
- for (img = 0; img < depth; img++) {
- for (row = 0; row < height; row++) {
- void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
- width, height, format, type,
- img, row, 0);
- GLint col;
- GLenum dataType = _mesa_get_format_datatype(texImage->TexFormat);
-
- /* clamp does not apply to GetTexImage (final conversion)?
- * Looks like we need clamp though when going from format
- * containing negative values to unsigned format.
- */
- if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) {
- transferOps |= IMAGE_CLAMP_BIT;
- }
- else if (!type_with_negative_values(type) &&
- (dataType == GL_FLOAT ||
- dataType == GL_SIGNED_NORMALIZED)) {
- transferOps |= IMAGE_CLAMP_BIT;
- }
-
- for (col = 0; col < width; col++) {
- texImage->FetchTexelf(texImage, col, row, img, rgba[col]);
- if (texImage->_BaseFormat == GL_ALPHA) {
- rgba[col][RCOMP] = 0.0F;
- rgba[col][GCOMP] = 0.0F;
- rgba[col][BCOMP] = 0.0F;
- }
- else if (texImage->_BaseFormat == GL_LUMINANCE) {
- rgba[col][GCOMP] = 0.0F;
- rgba[col][BCOMP] = 0.0F;
- rgba[col][ACOMP] = 1.0F;
- }
- else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
- rgba[col][GCOMP] = 0.0F;
- rgba[col][BCOMP] = 0.0F;
- }
- else if (texImage->_BaseFormat == GL_INTENSITY) {
- rgba[col][GCOMP] = 0.0F;
- rgba[col][BCOMP] = 0.0F;
- rgba[col][ACOMP] = 1.0F;
- }
- }
- _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
- format, type, dest,
- &ctx->Pack, transferOps);
- }
- }
-
- free(rgba);
-}
-
-
-/**
- * Try to do glGetTexImage() with simple memcpy().
- * \return GL_TRUE if done, GL_FALSE otherwise
- */
-static GLboolean
-get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_object *texObj,
- const struct gl_texture_image *texImage)
-{
- GLboolean memCopy = GL_FALSE;
-
- /* Texture image should have been mapped already */
- assert(texImage->Data);
-
- /*
- * Check if the src/dst formats are compatible.
- * Also note that GL's pixel transfer ops don't apply to glGetTexImage()
- * so we don't have to worry about those.
- * XXX more format combinations could be supported here.
- */
- if ((texObj->Target == GL_TEXTURE_1D ||
- texObj->Target == GL_TEXTURE_2D ||
- texObj->Target == GL_TEXTURE_RECTANGLE ||
- (texObj->Target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
- texObj->Target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
- if (texImage->TexFormat == MESA_FORMAT_ARGB8888 &&
- format == GL_BGRA &&
- type == GL_UNSIGNED_BYTE &&
- !ctx->Pack.SwapBytes &&
- _mesa_little_endian()) {
- memCopy = GL_TRUE;
- }
- else if (texImage->TexFormat == MESA_FORMAT_AL88 &&
- format == GL_LUMINANCE_ALPHA &&
- type == GL_UNSIGNED_BYTE &&
- !ctx->Pack.SwapBytes &&
- _mesa_little_endian()) {
- memCopy = GL_TRUE;
- }
- else if (texImage->TexFormat == MESA_FORMAT_L8 &&
- format == GL_LUMINANCE &&
- type == GL_UNSIGNED_BYTE) {
- memCopy = GL_TRUE;
- }
- else if (texImage->TexFormat == MESA_FORMAT_A8 &&
- format == GL_ALPHA &&
- type == GL_UNSIGNED_BYTE) {
- memCopy = GL_TRUE;
- }
- }
-
- if (memCopy) {
- const GLuint bpp = _mesa_get_format_bytes(texImage->TexFormat);
- const GLuint bytesPerRow = texImage->Width * bpp;
- GLubyte *dst =
- _mesa_image_address2d(&ctx->Pack, pixels, texImage->Width,
- texImage->Height, format, type, 0, 0);
- const GLint dstRowStride =
- _mesa_image_row_stride(&ctx->Pack, texImage->Width, format, type);
- const GLubyte *src = texImage->Data;
- const GLint srcRowStride = texImage->RowStride * bpp;
- GLuint row;
-
- if (bytesPerRow == dstRowStride && bytesPerRow == srcRowStride) {
- memcpy(dst, src, bytesPerRow * texImage->Height);
- }
- else {
- for (row = 0; row < texImage->Height; row++) {
- memcpy(dst, src, bytesPerRow);
- dst += dstRowStride;
- src += srcRowStride;
- }
- }
- }
-
- return memCopy;
-}
-
-
-/**
- * This is the software fallback for Driver.GetTexImage().
- * All error checking will have been done before this routine is called.
- * The texture image must be mapped.
- */
-void
-_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
- GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- GLuint dimensions;
-
- /* If we get here, the texture image should be mapped */
- assert(texImage->Data);
-
- switch (target) {
- case GL_TEXTURE_1D:
- dimensions = 1;
- break;
- case GL_TEXTURE_3D:
- dimensions = 3;
- break;
- default:
- dimensions = 2;
- }
-
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- /* Packing texture image into a PBO.
- * Map the (potentially) VRAM-based buffer into our process space so
- * we can write into it with the code below.
- * A hardware driver might use a sophisticated blit to move the
- * texture data to the PBO if the PBO is in VRAM along with the texture.
- */
- GLubyte *buf = (GLubyte *)
- ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
- GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
- if (!buf) {
- /* out of memory or other unexpected error */
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)");
- return;
- }
- /* <pixels> was an offset into the PBO.
- * Now make it a real, client-side pointer inside the mapped region.
- */
- pixels = ADD_POINTERS(buf, pixels);
- }
-
- if (get_tex_memcpy(ctx, format, type, pixels, texObj, texImage)) {
- /* all done */
- }
- else if (format == GL_COLOR_INDEX) {
- get_tex_color_index(ctx, dimensions, format, type, pixels, texImage);
- }
- else if (format == GL_DEPTH_COMPONENT) {
- get_tex_depth(ctx, dimensions, format, type, pixels, texImage);
- }
- else if (format == GL_DEPTH_STENCIL_EXT) {
- get_tex_depth_stencil(ctx, dimensions, format, type, pixels, texImage);
- }
- else if (format == GL_YCBCR_MESA) {
- get_tex_ycbcr(ctx, dimensions, format, type, pixels, texImage);
- }
- else if (_mesa_get_format_color_encoding(texImage->TexFormat) == GL_SRGB) {
- get_tex_srgb(ctx, dimensions, format, type, pixels, texImage);
- }
- else {
- get_tex_rgba(ctx, dimensions, format, type, pixels, texImage);
- }
-
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
- ctx->Pack.BufferObj);
- }
-}
-
-
-
-/**
- * This is the software fallback for Driver.GetCompressedTexImage().
- * All error checking will have been done before this routine is called.
- */
-void
-_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level,
- GLvoid *img,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- const GLuint row_stride = _mesa_format_row_stride(texImage->TexFormat,
- texImage->Width);
- const GLuint row_stride_stored = _mesa_format_row_stride(texImage->TexFormat,
- texImage->RowStride);
- GLuint i;
-
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- /* pack texture image into a PBO */
- GLubyte *buf = (GLubyte *)
- ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
- GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
- if (!buf) {
- /* out of memory or other unexpected error */
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glGetCompresssedTexImage(map PBO failed)");
- return;
- }
- img = ADD_POINTERS(buf, img);
- }
-
- /* no pixelstore or pixel transfer, but respect stride */
-
- if (row_stride == row_stride_stored) {
- const GLuint size = _mesa_format_image_size(texImage->TexFormat,
- texImage->Width,
- texImage->Height,
- texImage->Depth);
- memcpy(img, texImage->Data, size);
- }
- else {
- GLuint bw, bh;
- _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
- for (i = 0; i < (texImage->Height + bh - 1) / bh; i++) {
- memcpy((GLubyte *)img + i * row_stride,
- (GLubyte *)texImage->Data + i * row_stride_stored,
- row_stride);
- }
- }
-
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
- ctx->Pack.BufferObj);
- }
-}
-
-
-
-/**
- * Do error checking for a glGetTexImage() call.
- * \return GL_TRUE if any error, GL_FALSE if no errors.
- */
-static GLboolean
-getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
- GLenum format, GLenum type, GLvoid *pixels )
-{
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
- GLenum baseFormat;
-
- if (maxLevels == 0) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target=0x%x)", target);
- return GL_TRUE;
- }
-
- if (level < 0 || level >= maxLevels) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" );
- return GL_TRUE;
- }
-
- if (_mesa_sizeof_packed_type(type) <= 0) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" );
- return GL_TRUE;
- }
-
- if (_mesa_components_in_format(format) <= 0 ||
- format == GL_STENCIL_INDEX) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" );
- return GL_TRUE;
- }
-
- if (!ctx->Extensions.EXT_paletted_texture && _mesa_is_index_format(format)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
- return GL_TRUE;
- }
-
- if (!ctx->Extensions.ARB_depth_texture && _mesa_is_depth_format(format)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
- return GL_TRUE;
- }
-
- if (!ctx->Extensions.MESA_ycbcr_texture && _mesa_is_ycbcr_format(format)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
- return GL_TRUE;
- }
-
- if (!ctx->Extensions.EXT_packed_depth_stencil
- && _mesa_is_depthstencil_format(format)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
- return GL_TRUE;
- }
-
- if (!ctx->Extensions.ATI_envmap_bumpmap
- && _mesa_is_dudv_format(format)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
- return GL_TRUE;
- }
-
- texObj = _mesa_get_current_tex_object(ctx, target);
-
- if (!texObj || _mesa_is_proxy_texture(target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)");
- return GL_TRUE;
- }
-
- texImage = _mesa_select_tex_image(ctx, texObj, target, level);
- if (!texImage) {
- /* out of memory */
- return GL_TRUE;
- }
-
- baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
-
- /* Make sure the requested image format is compatible with the
- * texture's format. Note that a color index texture can be converted
- * to RGBA so that combo is allowed.
- */
- if (_mesa_is_color_format(format)
- && !_mesa_is_color_format(baseFormat)
- && !_mesa_is_index_format(baseFormat)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
- return GL_TRUE;
- }
- else if (_mesa_is_index_format(format)
- && !_mesa_is_index_format(baseFormat)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
- return GL_TRUE;
- }
- else if (_mesa_is_depth_format(format)
- && !_mesa_is_depth_format(baseFormat)
- && !_mesa_is_depthstencil_format(baseFormat)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
- return GL_TRUE;
- }
- else if (_mesa_is_ycbcr_format(format)
- && !_mesa_is_ycbcr_format(baseFormat)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
- return GL_TRUE;
- }
- else if (_mesa_is_depthstencil_format(format)
- && !_mesa_is_depthstencil_format(baseFormat)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
- return GL_TRUE;
- }
- else if (_mesa_is_dudv_format(format)
- && !_mesa_is_dudv_format(baseFormat)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
- return GL_TRUE;
- }
-
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- /* packing texture image into a PBO */
- const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2;
- if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack, texImage->Width,
- texImage->Height, texImage->Depth,
- format, type, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTexImage(out of bounds PBO write)");
- return GL_TRUE;
- }
-
- /* PBO should not be mapped */
- if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTexImage(PBO is mapped)");
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-
-
-/**
- * Get texture image. Called by glGetTexImage.
- *
- * \param target texture target.
- * \param level image level.
- * \param format pixel data format for returned image.
- * \param type pixel data type for returned image.
- * \param pixels returned pixel data.
- */
-void GLAPIENTRY
-_mesa_GetTexImage( GLenum target, GLint level, GLenum format,
- GLenum type, GLvoid *pixels )
-{
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (getteximage_error_check(ctx, target, level, format, type, pixels)) {
- return;
- }
-
- if (!_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) {
- /* not an error, do nothing */
- return;
- }
-
- texObj = _mesa_get_current_tex_object(ctx, target);
- texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
- if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
- _mesa_debug(ctx, "glGetTexImage(tex %u) format = %s, w=%d, h=%d,"
- " dstFmt=0x%x, dstType=0x%x\n",
- texObj->Name,
- _mesa_get_format_name(texImage->TexFormat),
- texImage->Width, texImage->Height,
- format, type);
- }
-
- _mesa_lock_texture(ctx, texObj);
- {
- ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels,
- texObj, texImage);
- }
- _mesa_unlock_texture(ctx, texObj);
-}
-
-
-
-/**
- * Do error checking for a glGetCompressedTexImage() call.
- * \return GL_TRUE if any error, GL_FALSE if no errors.
- */
-static GLboolean
-getcompressedteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
- GLvoid *img)
-{
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
-
- if (maxLevels == 0) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)",
- target);
- return GL_TRUE;
- }
-
- if (level < 0 || level >= maxLevels) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glGetCompressedTexImageARB(bad level = %d)", level);
- return GL_TRUE;
- }
-
- if (_mesa_is_proxy_texture(target)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetCompressedTexImageARB(bad target = %s)",
- _mesa_lookup_enum_by_nr(target));
- return GL_TRUE;
- }
-
- texObj = _mesa_get_current_tex_object(ctx, target);
- if (!texObj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)");
- return GL_TRUE;
- }
-
- texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
- if (!texImage) {
- /* probably invalid mipmap level */
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glGetCompressedTexImageARB(level)");
- return GL_TRUE;
- }
-
- if (!_mesa_is_format_compressed(texImage->TexFormat)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetCompressedTexImageARB(texture is not compressed)");
- return GL_TRUE;
- }
-
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- GLuint compressedSize;
-
- /* make sure PBO is not mapped */
- if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetCompressedTexImage(PBO is mapped)");
- return GL_TRUE;
- }
-
- compressedSize = _mesa_format_image_size(texImage->TexFormat,
- texImage->Width,
- texImage->Height,
- texImage->Depth);
-
- /* do bounds checking on PBO write */
- if ((const GLubyte *) img + compressedSize >
- (const GLubyte *) ctx->Pack.BufferObj->Size) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetCompressedTexImage(out of bounds PBO write)");
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-
-void GLAPIENTRY
-_mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img)
-{
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (getcompressedteximage_error_check(ctx, target, level, img)) {
- return;
- }
-
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj) && !img) {
- /* not an error, do nothing */
- return;
- }
-
- texObj = _mesa_get_current_tex_object(ctx, target);
- texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
- if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
- _mesa_debug(ctx,
- "glGetCompressedTexImage(tex %u) format = %s, w=%d, h=%d\n",
- texObj->Name,
- _mesa_get_format_name(texImage->TexFormat),
- texImage->Width, texImage->Height);
- }
-
- _mesa_lock_texture(ctx, texObj);
- {
- ctx->Driver.GetCompressedTexImage(ctx, target, level, img,
- texObj, texImage);
- }
- _mesa_unlock_texture(ctx, texObj);
-}
diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h
deleted file mode 100644
index ef420dd..0000000
--- a/src/mesa/main/texgetimage.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2009 VMware, 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
- * 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 TEXGETIMAGE_H
-#define TEXGETIMAGE_H
-
-#include "glheader.h"
-
-struct gl_context;
-struct gl_texture_image;
-struct gl_texture_object;
-
-extern void
-_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
- GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level,
- GLvoid *img,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-
-
-extern void GLAPIENTRY
-_mesa_GetTexImage( GLenum target, GLint level,
- GLenum format, GLenum type, GLvoid *pixels );
-
-
-extern void GLAPIENTRY
-_mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img);
-
-
-#endif /* TEXGETIMAGE_H */
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
deleted file mode 100644
index c5ae630..0000000
--- a/src/mesa/main/teximage.c
+++ /dev/null
@@ -1,3485 +0,0 @@
-/*
- * mesa 3-D graphics library
- * Version: 7.6
- *
- * Copyright (C) 1999-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 teximage.c
- * Texture image-related functions.
- */
-
-
-#include "glheader.h"
-#include "bufferobj.h"
-#include "context.h"
-#include "enums.h"
-#include "fbobject.h"
-#include "framebuffer.h"
-#include "hash.h"
-#include "image.h"
-#include "imports.h"
-#include "macros.h"
-#include "state.h"
-#include "texcompress.h"
-#include "texfetch.h"
-#include "teximage.h"
-#include "texstate.h"
-#include "texpal.h"
-#include "mtypes.h"
-
-
-/**
- * State changes which we care about for glCopyTex[Sub]Image() calls.
- * In particular, we care about pixel transfer state and buffer state
- * (such as glReadBuffer to make sure we read from the right renderbuffer).
- */
-#define NEW_COPY_TEX_STATE (_MESA_NEW_TRANSFER_STATE | \
- _NEW_BUFFERS | \
- _NEW_PIXEL)
-
-
-
-/**
- * We allocate texture memory on 512-byte boundaries so we can use MMX/SSE
- * elsewhere.
- */
-void *
-_mesa_alloc_texmemory(GLsizei bytes)
-{
- return _mesa_align_malloc(bytes, 512);
-}
-
-
-/**
- * Free texture memory allocated with _mesa_alloc_texmemory()
- */
-void
-_mesa_free_texmemory(void *m)
-{
- _mesa_align_free(m);
-}
-
-
-/*
- * Compute floor(log_base_2(n)).
- * If n < 0 return -1.
- */
-static int
-logbase2( int n )
-{
- GLint i = 1;
- GLint log2 = 0;
-
- if (n < 0)
- return -1;
-
- if (n == 0)
- return 0;
-
- while ( n > i ) {
- i *= 2;
- log2++;
- }
- if (i != n) {
- return log2 - 1;
- }
- else {
- return log2;
- }
-}
-
-
-
-/**
- * Return the simple base format for a given internal texture format.
- * For example, given GL_LUMINANCE12_ALPHA4, return GL_LUMINANCE_ALPHA.
- *
- * \param ctx GL context.
- * \param internalFormat the internal texture format token or 1, 2, 3, or 4.
- *
- * \return the corresponding \u base internal format (GL_ALPHA, GL_LUMINANCE,
- * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA), or -1 if invalid enum.
- *
- * This is the format which is used during texture application (i.e. the
- * texture format and env mode determine the arithmetic used.
- *
- * XXX this could be static
- */
-GLint
-_mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
-{
- switch (internalFormat) {
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return GL_ALPHA;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return GL_LUMINANCE;
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return GL_LUMINANCE_ALPHA;
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return GL_INTENSITY;
- case 3:
- case GL_RGB:
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return GL_RGB;
- case 4:
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return GL_RGBA;
- default:
- ; /* fallthrough */
- }
-
- if (ctx->Extensions.EXT_paletted_texture) {
- switch (internalFormat) {
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return GL_COLOR_INDEX;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.ARB_depth_texture) {
- switch (internalFormat) {
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32:
- return GL_DEPTH_COMPONENT;
- default:
- ; /* fallthrough */
- }
- }
-
- switch (internalFormat) {
- case GL_COMPRESSED_ALPHA:
- return GL_ALPHA;
- case GL_COMPRESSED_LUMINANCE:
- return GL_LUMINANCE;
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- return GL_LUMINANCE_ALPHA;
- case GL_COMPRESSED_INTENSITY:
- return GL_INTENSITY;
- case GL_COMPRESSED_RGB:
- return GL_RGB;
- case GL_COMPRESSED_RGBA:
- return GL_RGBA;
- default:
- ; /* fallthrough */
- }
-
- if (ctx->Extensions.TDFX_texture_compression_FXT1) {
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return GL_RGB;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return GL_RGBA;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_texture_compression_s3tc) {
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return GL_RGB;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return GL_RGBA;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.S3_s3tc) {
- switch (internalFormat) {
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- return GL_RGB;
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- return GL_RGBA;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.MESA_ycbcr_texture) {
- if (internalFormat == GL_YCBCR_MESA)
- return GL_YCBCR_MESA;
- }
-
- if (ctx->Extensions.ARB_texture_float) {
- switch (internalFormat) {
- case GL_ALPHA16F_ARB:
- case GL_ALPHA32F_ARB:
- return GL_ALPHA;
- case GL_RGBA16F_ARB:
- case GL_RGBA32F_ARB:
- return GL_RGBA;
- case GL_RGB16F_ARB:
- case GL_RGB32F_ARB:
- return GL_RGB;
- case GL_INTENSITY16F_ARB:
- case GL_INTENSITY32F_ARB:
- return GL_INTENSITY;
- case GL_LUMINANCE16F_ARB:
- case GL_LUMINANCE32F_ARB:
- return GL_LUMINANCE;
- case GL_LUMINANCE_ALPHA16F_ARB:
- case GL_LUMINANCE_ALPHA32F_ARB:
- return GL_LUMINANCE_ALPHA;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.ATI_envmap_bumpmap) {
- switch (internalFormat) {
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- return GL_DUDV_ATI;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.MESA_texture_signed_rgba) {
- switch (internalFormat) {
- case GL_RGBA_SNORM:
- case GL_RGBA8_SNORM:
- return GL_RGBA;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_packed_depth_stencil) {
- switch (internalFormat) {
- case GL_DEPTH_STENCIL_EXT:
- case GL_DEPTH24_STENCIL8_EXT:
- return GL_DEPTH_STENCIL_EXT;
- default:
- ; /* fallthrough */
- }
- }
-
-#if FEATURE_EXT_texture_sRGB
- if (ctx->Extensions.EXT_texture_sRGB) {
- switch (internalFormat) {
- case GL_SRGB_EXT:
- case GL_SRGB8_EXT:
- case GL_COMPRESSED_SRGB_EXT:
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- return GL_RGB;
- case GL_SRGB_ALPHA_EXT:
- case GL_SRGB8_ALPHA8_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_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 GL_RGBA;
- case GL_SLUMINANCE_ALPHA_EXT:
- case GL_SLUMINANCE8_ALPHA8_EXT:
- case GL_COMPRESSED_SLUMINANCE_EXT:
- case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
- return GL_LUMINANCE_ALPHA;
- case GL_SLUMINANCE_EXT:
- case GL_SLUMINANCE8_EXT:
- return GL_LUMINANCE;
- default:
- ; /* fallthrough */
- }
- }
-#endif /* FEATURE_EXT_texture_sRGB */
-
- 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_R16F:
- /* R16F depends on both ARB_half_float_pixel and ARB_texture_float.
- */
- if (!ctx->Extensions.ARB_half_float_pixel)
- break;
- /* FALLTHROUGH */
- case GL_R32F:
- if (!ctx->Extensions.ARB_texture_float)
- break;
- return GL_RED;
- case GL_R8I:
- case GL_R8UI:
- case GL_R16I:
- case GL_R16UI:
- case GL_R32I:
- case GL_R32UI:
- if (!ctx->Extensions.EXT_texture_integer)
- break;
- /* FALLTHROUGH */
- case GL_R8:
- case GL_R16:
- case GL_RED:
- case GL_COMPRESSED_RED:
- return GL_RED;
-
- case GL_RG16F:
- /* RG16F depends on both ARB_half_float_pixel and ARB_texture_float.
- */
- if (!ctx->Extensions.ARB_half_float_pixel)
- break;
- /* FALLTHROUGH */
- case GL_RG32F:
- if (!ctx->Extensions.ARB_texture_float)
- break;
- return GL_RG;
- case GL_RG8I:
- case GL_RG8UI:
- case GL_RG16I:
- case GL_RG16UI:
- case GL_RG32I:
- case GL_RG32UI:
- if (!ctx->Extensions.EXT_texture_integer)
- break;
- /* FALLTHROUGH */
- case GL_RG:
- case GL_RG8:
- case GL_RG16:
- case GL_COMPRESSED_RG:
- return GL_RG;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_texture_shared_exponent) {
- switch (internalFormat) {
- case GL_RGB9_E5_EXT:
- return GL_RGB;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_packed_float) {
- switch (internalFormat) {
- case GL_R11F_G11F_B10F_EXT:
- return GL_RGB;
- default:
- ; /* fallthrough */
- }
- }
-
- 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.ARB_texture_compression_rgtc) {
- switch (internalFormat) {
- case GL_COMPRESSED_RED_RGTC1:
- case GL_COMPRESSED_SIGNED_RED_RGTC1:
- return GL_RED;
- case GL_COMPRESSED_RG_RGTC2:
- case GL_COMPRESSED_SIGNED_RG_RGTC2:
- return GL_RG;
- default:
- ; /* fallthrough */
- }
- }
-
- return -1; /* error */
-}
-
-
-/**
- * For cube map faces, return a face index in [0,5].
- * For other targets return 0;
- */
-GLuint
-_mesa_tex_target_to_face(GLenum target)
-{
- if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
- target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)
- return (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- else
- return 0;
-}
-
-
-
-/**
- * Store a gl_texture_image pointer in a gl_texture_object structure
- * according to the target and level parameters.
- *
- * \param tObj texture object.
- * \param target texture target.
- * \param level image level.
- * \param texImage texture image.
- *
- * This was basically prompted by the introduction of cube maps.
- */
-void
-_mesa_set_tex_image(struct gl_texture_object *tObj,
- GLenum target, GLint level,
- struct gl_texture_image *texImage)
-{
- const GLuint face = _mesa_tex_target_to_face(target);
-
- ASSERT(tObj);
- ASSERT(texImage);
- ASSERT(target != GL_TEXTURE_RECTANGLE_NV || level == 0);
-
- tObj->Image[face][level] = texImage;
-
- /* Set the 'back' pointer */
- texImage->TexObject = tObj;
-}
-
-
-/**
- * Allocate a texture image structure.
- *
- * Called via ctx->Driver.NewTextureImage() unless overriden by a device
- * driver.
- *
- * \return a pointer to gl_texture_image struct with all fields initialized to
- * zero.
- */
-struct gl_texture_image *
-_mesa_new_texture_image( struct gl_context *ctx )
-{
- (void) ctx;
- return CALLOC_STRUCT(gl_texture_image);
-}
-
-
-/**
- * Free texture image data.
- * This function is a fallback called via ctx->Driver.FreeTexImageData().
- *
- * \param texImage texture image.
- *
- * Free the texture image data if it's not marked as client data.
- */
-void
-_mesa_free_texture_image_data(struct gl_context *ctx,
- struct gl_texture_image *texImage)
-{
- (void) ctx;
-
- if (texImage->Data && !texImage->IsClientData) {
- /* free the old texture data */
- _mesa_free_texmemory(texImage->Data);
- }
-
- texImage->Data = NULL;
-}
-
-
-/**
- * Free texture image.
- *
- * \param texImage texture image.
- *
- * Free the texture image structure and the associated image data.
- */
-void
-_mesa_delete_texture_image(struct gl_context *ctx,
- struct gl_texture_image *texImage)
-{
- /* Free texImage->Data and/or any other driver-specific texture
- * image storage.
- */
- ASSERT(ctx->Driver.FreeTexImageData);
- ctx->Driver.FreeTexImageData( ctx, texImage );
-
- ASSERT(texImage->Data == NULL);
- if (texImage->ImageOffsets)
- free(texImage->ImageOffsets);
- free(texImage);
-}
-
-
-/**
- * Test if a target is a proxy target.
- *
- * \param target texture target.
- *
- * \return GL_TRUE if the target is a proxy target, GL_FALSE otherwise.
- */
-GLboolean
-_mesa_is_proxy_texture(GLenum target)
-{
- /* NUM_TEXTURE_TARGETS should match number of terms below */
- assert(NUM_TEXTURE_TARGETS == 7);
-
- return (target == GL_PROXY_TEXTURE_1D ||
- target == GL_PROXY_TEXTURE_2D ||
- target == GL_PROXY_TEXTURE_3D ||
- target == GL_PROXY_TEXTURE_CUBE_MAP_ARB ||
- target == GL_PROXY_TEXTURE_RECTANGLE_NV ||
- target == GL_PROXY_TEXTURE_1D_ARRAY_EXT ||
- target == GL_PROXY_TEXTURE_2D_ARRAY_EXT);
-}
-
-
-/**
- * Return the proxy target which corresponds to the given texture target
- */
-static GLenum
-get_proxy_target(GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_1D:
- case GL_PROXY_TEXTURE_1D:
- return GL_PROXY_TEXTURE_1D;
- case GL_TEXTURE_2D:
- case GL_PROXY_TEXTURE_2D:
- return GL_PROXY_TEXTURE_2D;
- case GL_TEXTURE_3D:
- case GL_PROXY_TEXTURE_3D:
- return GL_PROXY_TEXTURE_3D;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_ARB:
- case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
- return GL_PROXY_TEXTURE_CUBE_MAP_ARB;
- case GL_TEXTURE_RECTANGLE_NV:
- case GL_PROXY_TEXTURE_RECTANGLE_NV:
- return GL_PROXY_TEXTURE_RECTANGLE_NV;
- case GL_TEXTURE_1D_ARRAY_EXT:
- case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
- return GL_PROXY_TEXTURE_1D_ARRAY_EXT;
- case GL_TEXTURE_2D_ARRAY_EXT:
- case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
- return GL_PROXY_TEXTURE_2D_ARRAY_EXT;
- default:
- _mesa_problem(NULL, "unexpected target in get_proxy_target()");
- return 0;
- }
-}
-
-
-/**
- * Get the texture object that corresponds to the target of the given
- * texture unit.
- *
- * \param ctx GL context.
- * \param texUnit texture unit.
- * \param target texture target.
- *
- * \return pointer to the texture object on success, or NULL on failure.
- *
- * \sa gl_texture_unit.
- */
-struct gl_texture_object *
-_mesa_select_tex_object(struct gl_context *ctx,
- const struct gl_texture_unit *texUnit,
- GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_1D:
- return texUnit->CurrentTex[TEXTURE_1D_INDEX];
- case GL_PROXY_TEXTURE_1D:
- return ctx->Texture.ProxyTex[TEXTURE_1D_INDEX];
- case GL_TEXTURE_2D:
- return texUnit->CurrentTex[TEXTURE_2D_INDEX];
- case GL_PROXY_TEXTURE_2D:
- return ctx->Texture.ProxyTex[TEXTURE_2D_INDEX];
- case GL_TEXTURE_3D:
- return texUnit->CurrentTex[TEXTURE_3D_INDEX];
- case GL_PROXY_TEXTURE_3D:
- return ctx->Texture.ProxyTex[TEXTURE_3D_INDEX];
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_ARB:
- return ctx->Extensions.ARB_texture_cube_map
- ? texUnit->CurrentTex[TEXTURE_CUBE_INDEX] : NULL;
- case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
- return ctx->Extensions.ARB_texture_cube_map
- ? ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX] : NULL;
- case GL_TEXTURE_RECTANGLE_NV:
- return ctx->Extensions.NV_texture_rectangle
- ? texUnit->CurrentTex[TEXTURE_RECT_INDEX] : NULL;
- case GL_PROXY_TEXTURE_RECTANGLE_NV:
- return ctx->Extensions.NV_texture_rectangle
- ? ctx->Texture.ProxyTex[TEXTURE_RECT_INDEX] : NULL;
- case GL_TEXTURE_1D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array
- ? texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX] : NULL;
- case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array
- ? ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX] : NULL;
- case GL_TEXTURE_2D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array
- ? texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
- case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array
- ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
- default:
- _mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
- return NULL;
- }
-}
-
-
-/**
- * Return pointer to texture object for given target on current texture unit.
- */
-struct gl_texture_object *
-_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target)
-{
- struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
- return _mesa_select_tex_object(ctx, texUnit, target);
-}
-
-
-/**
- * Get a texture image pointer from a texture object, given a texture
- * target and mipmap level. The target and level parameters should
- * have already been error-checked.
- *
- * \param ctx GL context.
- * \param texObj texture unit.
- * \param target texture target.
- * \param level image level.
- *
- * \return pointer to the texture image structure, or NULL on failure.
- */
-struct gl_texture_image *
-_mesa_select_tex_image(struct gl_context *ctx,
- const struct gl_texture_object *texObj,
- GLenum target, GLint level)
-{
- const GLuint face = _mesa_tex_target_to_face(target);
-
- ASSERT(texObj);
- ASSERT(level >= 0);
- ASSERT(level < MAX_TEXTURE_LEVELS);
-
- return texObj->Image[face][level];
-}
-
-
-/**
- * Like _mesa_select_tex_image() but if the image doesn't exist, allocate
- * it and install it. Only return NULL if passed a bad parameter or run
- * out of memory.
- */
-struct gl_texture_image *
-_mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
- GLenum target, GLint level)
-{
- struct gl_texture_image *texImage;
-
- if (!texObj)
- return NULL;
-
- texImage = _mesa_select_tex_image(ctx, texObj, target, level);
- if (!texImage) {
- texImage = ctx->Driver.NewTextureImage(ctx);
- if (!texImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture image allocation");
- return NULL;
- }
-
- _mesa_set_tex_image(texObj, target, level, texImage);
- }
-
- return texImage;
-}
-
-
-/**
- * Return pointer to the specified proxy texture image.
- * Note that proxy textures are per-context, not per-texture unit.
- * \return pointer to texture image or NULL if invalid target, invalid
- * level, or out of memory.
- */
-struct gl_texture_image *
-_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level)
-{
- struct gl_texture_image *texImage;
- GLuint texIndex;
-
- if (level < 0 )
- return NULL;
-
- switch (target) {
- case GL_PROXY_TEXTURE_1D:
- if (level >= ctx->Const.MaxTextureLevels)
- return NULL;
- texIndex = TEXTURE_1D_INDEX;
- break;
- case GL_PROXY_TEXTURE_2D:
- if (level >= ctx->Const.MaxTextureLevels)
- return NULL;
- texIndex = TEXTURE_2D_INDEX;
- break;
- case GL_PROXY_TEXTURE_3D:
- if (level >= ctx->Const.Max3DTextureLevels)
- return NULL;
- texIndex = TEXTURE_3D_INDEX;
- break;
- case GL_PROXY_TEXTURE_CUBE_MAP:
- if (level >= ctx->Const.MaxCubeTextureLevels)
- return NULL;
- texIndex = TEXTURE_CUBE_INDEX;
- break;
- case GL_PROXY_TEXTURE_RECTANGLE_NV:
- if (level > 0)
- return NULL;
- texIndex = TEXTURE_RECT_INDEX;
- break;
- case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
- if (level >= ctx->Const.MaxTextureLevels)
- return NULL;
- texIndex = TEXTURE_1D_ARRAY_INDEX;
- break;
- case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
- if (level >= ctx->Const.MaxTextureLevels)
- return NULL;
- texIndex = TEXTURE_2D_ARRAY_INDEX;
- break;
- default:
- return NULL;
- }
-
- texImage = ctx->Texture.ProxyTex[texIndex]->Image[0][level];
- if (!texImage) {
- texImage = ctx->Driver.NewTextureImage(ctx);
- if (!texImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation");
- return NULL;
- }
- ctx->Texture.ProxyTex[texIndex]->Image[0][level] = texImage;
- /* Set the 'back' pointer */
- texImage->TexObject = ctx->Texture.ProxyTex[texIndex];
- }
- return texImage;
-}
-
-
-/**
- * Get the maximum number of allowed mipmap levels.
- *
- * \param ctx GL context.
- * \param target texture target.
- *
- * \return the maximum number of allowed mipmap levels for the given
- * texture target, or zero if passed a bad target.
- *
- * \sa gl_constants.
- */
-GLint
-_mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_1D:
- case GL_PROXY_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_PROXY_TEXTURE_2D:
- return ctx->Const.MaxTextureLevels;
- case GL_TEXTURE_3D:
- case GL_PROXY_TEXTURE_3D:
- return ctx->Const.Max3DTextureLevels;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_ARB:
- case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
- return ctx->Extensions.ARB_texture_cube_map
- ? ctx->Const.MaxCubeTextureLevels : 0;
- case GL_TEXTURE_RECTANGLE_NV:
- case GL_PROXY_TEXTURE_RECTANGLE_NV:
- return ctx->Extensions.NV_texture_rectangle ? 1 : 0;
- case GL_TEXTURE_1D_ARRAY_EXT:
- case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
- case GL_TEXTURE_2D_ARRAY_EXT:
- case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array
- ? ctx->Const.MaxTextureLevels : 0;
- default:
- return 0; /* bad target */
- }
-}
-
-
-/**
- * Return number of dimensions per mipmap level for the given texture target.
- */
-static GLint
-get_texture_dimensions(GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_1D:
- case GL_PROXY_TEXTURE_1D:
- return 1;
- case GL_TEXTURE_2D:
- case GL_TEXTURE_RECTANGLE:
- case GL_TEXTURE_CUBE_MAP:
- case GL_PROXY_TEXTURE_2D:
- case GL_PROXY_TEXTURE_RECTANGLE:
- case GL_PROXY_TEXTURE_CUBE_MAP:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- case GL_TEXTURE_1D_ARRAY:
- case GL_PROXY_TEXTURE_1D_ARRAY:
- return 2;
- case GL_TEXTURE_3D:
- case GL_PROXY_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- case GL_PROXY_TEXTURE_2D_ARRAY:
- return 3;
- default:
- _mesa_problem(NULL, "invalid target 0x%x in get_texture_dimensions()",
- target);
- return 2;
- }
-}
-
-
-
-
-#if 000 /* not used anymore */
-/*
- * glTexImage[123]D can accept a NULL image pointer. In this case we
- * create a texture image with unspecified image contents per the OpenGL
- * spec.
- */
-static GLubyte *
-make_null_texture(GLint width, GLint height, GLint depth, GLenum format)
-{
- const GLint components = _mesa_components_in_format(format);
- const GLint numPixels = width * height * depth;
- GLubyte *data = (GLubyte *) MALLOC(numPixels * components * sizeof(GLubyte));
-
-#ifdef DEBUG
- /*
- * Let's see if anyone finds this. If glTexImage2D() is called with
- * a NULL image pointer then load the texture image with something
- * interesting instead of leaving it indeterminate.
- */
- if (data) {
- static const char message[8][32] = {
- " X X XXXXX XXX X ",
- " XX XX X X X X X ",
- " X X X X X X X ",
- " X X XXXX XXX XXXXX ",
- " X X X X X X ",
- " X X X X X X X ",
- " X X XXXXX XXX X X ",
- " "
- };
-
- GLubyte *imgPtr = data;
- GLint h, i, j, k;
- for (h = 0; h < depth; h++) {
- for (i = 0; i < height; i++) {
- GLint srcRow = 7 - (i % 8);
- for (j = 0; j < width; j++) {
- GLint srcCol = j % 32;
- GLubyte texel = (message[srcRow][srcCol]=='X') ? 255 : 70;
- for (k = 0; k < components; k++) {
- *imgPtr++ = texel;
- }
- }
- }
- }
- }
-#endif
-
- return data;
-}
-#endif
-
-
-
-/**
- * Reset the fields of a gl_texture_image struct to zero.
- *
- * \param img texture image structure.
- *
- * This is called when a proxy texture test fails, we set all the
- * image members (except DriverData) to zero.
- * It's also used in glTexImage[123]D as a safeguard to be sure all
- * required fields get initialized properly by the Driver.TexImage[123]D
- * functions.
- */
-static void
-clear_teximage_fields(struct gl_texture_image *img)
-{
- ASSERT(img);
- img->_BaseFormat = 0;
- img->InternalFormat = 0;
- img->Border = 0;
- img->Width = 0;
- img->Height = 0;
- img->Depth = 0;
- img->RowStride = 0;
- if (img->ImageOffsets) {
- free(img->ImageOffsets);
- img->ImageOffsets = NULL;
- }
- img->Width2 = 0;
- img->Height2 = 0;
- img->Depth2 = 0;
- img->WidthLog2 = 0;
- img->HeightLog2 = 0;
- img->DepthLog2 = 0;
- img->Data = NULL;
- img->TexFormat = MESA_FORMAT_NONE;
- img->FetchTexelc = NULL;
- img->FetchTexelf = NULL;
-}
-
-
-/**
- * Initialize basic fields of the gl_texture_image struct.
- *
- * \param ctx GL context.
- * \param target texture target (GL_TEXTURE_1D, GL_TEXTURE_RECTANGLE, etc).
- * \param img texture image structure to be initialized.
- * \param width image width.
- * \param height image height.
- * \param depth image depth.
- * \param border image border.
- * \param internalFormat internal format.
- * \param format the actual hardware format (one of MESA_FORMAT_*)
- *
- * Fills in the fields of \p img with the given information.
- * Note: width, height and depth include the border.
- */
-void
-_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
- struct gl_texture_image *img,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum internalFormat,
- gl_format format)
-{
- GLint i, dims;
-
- ASSERT(img);
- ASSERT(width >= 0);
- ASSERT(height >= 0);
- ASSERT(depth >= 0);
-
- img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat );
- ASSERT(img->_BaseFormat > 0);
- img->InternalFormat = internalFormat;
- img->Border = border;
- img->Width = width;
- img->Height = height;
- img->Depth = depth;
-
- img->Width2 = width - 2 * border; /* == 1 << img->WidthLog2; */
- img->WidthLog2 = logbase2(img->Width2);
-
- if (height == 1) { /* 1-D texture */
- img->Height2 = 1;
- img->HeightLog2 = 0;
- }
- else {
- img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */
- img->HeightLog2 = logbase2(img->Height2);
- }
-
- if (depth == 1) { /* 2-D texture */
- img->Depth2 = 1;
- img->DepthLog2 = 0;
- }
- else {
- img->Depth2 = depth - 2 * border; /* == 1 << img->DepthLog2; */
- img->DepthLog2 = logbase2(img->Depth2);
- }
-
- img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
-
- if ((width == 1 || _mesa_is_pow_two(img->Width2)) &&
- (height == 1 || _mesa_is_pow_two(img->Height2)) &&
- (depth == 1 || _mesa_is_pow_two(img->Depth2)))
- img->_IsPowerOfTwo = GL_TRUE;
- else
- img->_IsPowerOfTwo = GL_FALSE;
-
- /* RowStride and ImageOffsets[] describe how to address texels in 'Data' */
- img->RowStride = width;
- /* Allocate the ImageOffsets array and initialize to typical values.
- * We allocate the array for 1D/2D textures too in order to avoid special-
- * case code in the texstore routines.
- */
- if (img->ImageOffsets)
- free(img->ImageOffsets);
- img->ImageOffsets = (GLuint *) malloc(depth * sizeof(GLuint));
- for (i = 0; i < depth; i++) {
- img->ImageOffsets[i] = i * width * height;
- }
-
- /* Compute Width/Height/DepthScale for mipmap lod computation */
- if (target == GL_TEXTURE_RECTANGLE_NV) {
- /* scale = 1.0 since texture coords directly map to texels */
- img->WidthScale = 1.0;
- img->HeightScale = 1.0;
- img->DepthScale = 1.0;
- }
- else {
- img->WidthScale = (GLfloat) img->Width;
- img->HeightScale = (GLfloat) img->Height;
- img->DepthScale = (GLfloat) img->Depth;
- }
-
- img->TexFormat = format;
-
- dims = get_texture_dimensions(target);
-
- _mesa_set_fetch_functions(img, dims);
-}
-
-
-/**
- * Free and clear fields of the gl_texture_image struct.
- *
- * \param ctx GL context.
- * \param texImage texture image structure to be cleared.
- *
- * After the call, \p texImage will have no data associated with it. Its
- * fields are cleared so that its parent object will test incomplete.
- */
-void
-_mesa_clear_texture_image(struct gl_context *ctx,
- struct gl_texture_image *texImage)
-{
- ctx->Driver.FreeTexImageData(ctx, texImage);
- clear_teximage_fields(texImage);
-}
-
-
-/**
- * This is the fallback for Driver.TestProxyTexImage(). Test the texture
- * level, width, height and depth against the ctx->Const limits for textures.
- *
- * A hardware driver might override this function if, for example, the
- * max 3D texture size is 512x512x64 (i.e. not a cube).
- *
- * Note that width, height, depth == 0 is not an error. However, a
- * texture with zero width/height/depth will be considered "incomplete"
- * and texturing will effectively be disabled.
- *
- * \param target one of GL_PROXY_TEXTURE_1D, GL_PROXY_TEXTURE_2D,
- * GL_PROXY_TEXTURE_3D, GL_PROXY_TEXTURE_RECTANGLE_NV,
- * GL_PROXY_TEXTURE_CUBE_MAP_ARB.
- * \param level as passed to glTexImage
- * \param internalFormat as passed to glTexImage
- * \param format as passed to glTexImage
- * \param type as passed to glTexImage
- * \param width as passed to glTexImage
- * \param height as passed to glTexImage
- * \param depth as passed to glTexImage
- * \param border as passed to glTexImage
- * \return GL_TRUE if the image is acceptable, GL_FALSE if not acceptable.
- */
-GLboolean
-_mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat, GLenum format, GLenum type,
- GLint width, GLint height, GLint depth, GLint border)
-{
- GLint maxSize;
-
- (void) internalFormat;
- (void) format;
- (void) type;
-
- switch (target) {
- case GL_PROXY_TEXTURE_1D:
- maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
- if (width < 2 * border || width > 2 + maxSize)
- return GL_FALSE;
- if (level >= ctx->Const.MaxTextureLevels)
- return GL_FALSE;
- if (!ctx->Extensions.ARB_texture_non_power_of_two) {
- if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
- return GL_FALSE;
- }
- return GL_TRUE;
-
- case GL_PROXY_TEXTURE_2D:
- maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
- if (width < 2 * border || width > 2 + maxSize)
- return GL_FALSE;
- if (height < 2 * border || height > 2 + maxSize)
- return GL_FALSE;
- if (level >= ctx->Const.MaxTextureLevels)
- return GL_FALSE;
- if (!ctx->Extensions.ARB_texture_non_power_of_two) {
- if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
- return GL_FALSE;
- if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
- return GL_FALSE;
- }
- return GL_TRUE;
-
- case GL_PROXY_TEXTURE_3D:
- maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
- if (width < 2 * border || width > 2 + maxSize)
- return GL_FALSE;
- if (height < 2 * border || height > 2 + maxSize)
- return GL_FALSE;
- if (depth < 2 * border || depth > 2 + maxSize)
- return GL_FALSE;
- if (level >= ctx->Const.Max3DTextureLevels)
- return GL_FALSE;
- if (!ctx->Extensions.ARB_texture_non_power_of_two) {
- if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
- return GL_FALSE;
- if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
- return GL_FALSE;
- if (depth > 0 && !_mesa_is_pow_two(depth - 2 * border))
- return GL_FALSE;
- }
- return GL_TRUE;
-
- case GL_PROXY_TEXTURE_RECTANGLE_NV:
- maxSize = ctx->Const.MaxTextureRectSize;
- if (width < 0 || width > maxSize)
- return GL_FALSE;
- if (height < 0 || height > maxSize)
- return GL_FALSE;
- if (level != 0)
- return GL_FALSE;
- return GL_TRUE;
-
- case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
- maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
- if (width < 2 * border || width > 2 + maxSize)
- return GL_FALSE;
- if (height < 2 * border || height > 2 + maxSize)
- return GL_FALSE;
- if (level >= ctx->Const.MaxCubeTextureLevels)
- return GL_FALSE;
- if (!ctx->Extensions.ARB_texture_non_power_of_two) {
- if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
- return GL_FALSE;
- if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
- return GL_FALSE;
- }
- return GL_TRUE;
-
- case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
- maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
- if (width < 2 * border || width > 2 + maxSize)
- return GL_FALSE;
- if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
- return GL_FALSE;
- if (level >= ctx->Const.MaxTextureLevels)
- return GL_FALSE;
- if (!ctx->Extensions.ARB_texture_non_power_of_two) {
- if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
- return GL_FALSE;
- }
- return GL_TRUE;
-
- case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
- maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
- if (width < 2 * border || width > 2 + maxSize)
- return GL_FALSE;
- if (height < 2 * border || height > 2 + maxSize)
- return GL_FALSE;
- if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
- return GL_FALSE;
- if (level >= ctx->Const.MaxTextureLevels)
- return GL_FALSE;
- if (!ctx->Extensions.ARB_texture_non_power_of_two) {
- if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
- return GL_FALSE;
- if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
- return GL_FALSE;
- }
- return GL_TRUE;
-
- default:
- _mesa_problem(ctx, "Invalid target in _mesa_test_proxy_teximage");
- return GL_FALSE;
- }
-}
-
-
-/**
- * Check if the memory used by the texture would exceed the driver's limit.
- * This lets us support a max 3D texture size of 8K (for example) but
- * prevents allocating a full 8K x 8K x 8K texture.
- * XXX this could be rolled into the proxy texture size test (above) but
- * we don't have the actual texture internal format at that point.
- */
-static GLboolean
-legal_texture_size(struct gl_context *ctx, gl_format format,
- GLint width, GLint height, GLint depth)
-{
- uint64_t bytes = _mesa_format_image_size64(format, width, height, depth);
- uint64_t mbytes = bytes / (1024 * 1024); /* convert to MB */
- return mbytes <= (uint64_t) ctx->Const.MaxTextureMbytes;
-}
-
-
-
-/**
- * Helper function to determine whether a target and specific compression
- * format are supported.
- */
-static GLboolean
-target_can_be_compressed(const struct gl_context *ctx, GLenum target,
- GLenum intFormat)
-{
- (void) intFormat; /* not used yet */
-
- switch (target) {
- case GL_TEXTURE_2D:
- case GL_PROXY_TEXTURE_2D:
- return GL_TRUE; /* true for any compressed format so far */
- case GL_PROXY_TEXTURE_CUBE_MAP:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- return ctx->Extensions.ARB_texture_cube_map;
- case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
- case GL_TEXTURE_2D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array;
- default:
- return GL_FALSE;
- }
-}
-
-
-/**
- * Check if the given texture target value is legal for a
- * glTexImage1/2/3D call.
- */
-static GLboolean
-legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
-{
- switch (dims) {
- case 1:
- switch (target) {
- case GL_TEXTURE_1D:
- case GL_PROXY_TEXTURE_1D:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
- case 2:
- switch (target) {
- case GL_TEXTURE_2D:
- case GL_PROXY_TEXTURE_2D:
- return GL_TRUE;
- case GL_PROXY_TEXTURE_CUBE_MAP:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- return ctx->Extensions.ARB_texture_cube_map;
- case GL_TEXTURE_RECTANGLE_NV:
- case GL_PROXY_TEXTURE_RECTANGLE_NV:
- return ctx->Extensions.NV_texture_rectangle;
- case GL_TEXTURE_1D_ARRAY_EXT:
- case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array;
- default:
- return GL_FALSE;
- }
- case 3:
- switch (target) {
- case GL_TEXTURE_3D:
- case GL_PROXY_TEXTURE_3D:
- return GL_TRUE;
- case GL_TEXTURE_2D_ARRAY_EXT:
- case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array;
- default:
- return GL_FALSE;
- }
- default:
- _mesa_problem(ctx, "invalid dims=%u in legal_teximage_target()", dims);
- return GL_FALSE;
- }
-}
-
-
-/**
- * Check if the given texture target value is legal for a
- * glTexSubImage, glCopyTexSubImage or glCopyTexImage call.
- * The difference compared to legal_teximage_target() above is that
- * proxy targets are not supported.
- */
-static GLboolean
-legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target)
-{
- switch (dims) {
- case 1:
- return target == GL_TEXTURE_1D;
- case 2:
- switch (target) {
- case GL_TEXTURE_2D:
- return GL_TRUE;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- return ctx->Extensions.ARB_texture_cube_map;
- case GL_TEXTURE_RECTANGLE_NV:
- return ctx->Extensions.NV_texture_rectangle;
- case GL_TEXTURE_1D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array;
- default:
- return GL_FALSE;
- }
- case 3:
- switch (target) {
- case GL_TEXTURE_3D:
- return GL_TRUE;
- case GL_TEXTURE_2D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array;
- default:
- return GL_FALSE;
- }
- default:
- _mesa_problem(ctx, "invalid dims=%u in legal_texsubimage_target()",
- dims);
- return GL_FALSE;
- }
-}
-
-
-/**
- * Test the glTexImage[123]D() parameters for errors.
- *
- * \param ctx GL context.
- * \param dimensions texture image dimensions (must be 1, 2 or 3).
- * \param target texture target given by the user.
- * \param level image level given by the user.
- * \param internalFormat internal format given by the user.
- * \param format pixel data format given by the user.
- * \param type pixel data type given by the user.
- * \param width image width given by the user.
- * \param height image height given by the user.
- * \param depth image depth given by the user.
- * \param border image border given by the user.
- *
- * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
- *
- * Verifies each of the parameters against the constants specified in
- * __struct gl_contextRec::Const and the supported extensions, and according
- * to the OpenGL specification.
- */
-static GLboolean
-texture_error_check( struct gl_context *ctx,
- GLuint dimensions, GLenum target,
- GLint level, GLint internalFormat,
- GLenum format, GLenum type,
- GLint width, GLint height,
- GLint depth, GLint border )
-{
- const GLenum proxyTarget = get_proxy_target(target);
- const GLboolean isProxy = target == proxyTarget;
- GLboolean sizeOK = GL_TRUE;
- GLboolean colorFormat, indexFormat;
-
- /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
- if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexImage%dD(level=%d)", dimensions, level);
- }
- return GL_TRUE;
- }
-
- /* Check border */
- if (border < 0 || border > 1 ||
- ((target == GL_TEXTURE_RECTANGLE_NV ||
- target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexImage%dD(border=%d)", dimensions, border);
- }
- return GL_TRUE;
- }
-
- if (width < 0 || height < 0 || depth < 0) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexImage%dD(width, height or depth < 0)", dimensions);
- }
- return GL_TRUE;
- }
-
- /* Do this simple check before calling the TestProxyTexImage() function */
- if (proxyTarget == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
- sizeOK = (width == height);
- }
-
- /*
- * Use the proxy texture driver hook to see if the size/level/etc are
- * legal.
- */
- sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
- internalFormat, format,
- type, width, height,
- depth, border);
- if (!sizeOK) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexImage%dD(level=%d, width=%d, height=%d, depth=%d)",
- dimensions, level, width, height, depth);
- }
- return GL_TRUE;
- }
-
- /* Check internalFormat */
- if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexImage%dD(internalFormat=%s)",
- dimensions, _mesa_lookup_enum_by_nr(internalFormat));
- }
- return GL_TRUE;
- }
-
- /* Check incoming image format and type */
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- /* Normally, GL_INVALID_OPERATION is generated by a format/type
- * mismatch (see the 1.2 spec page 94, sec 3.6.4.). But with the
- * GL_EXT_texture_integer extension, some combinations should generate
- * GL_INVALID_ENUM instead (grr!).
- */
- if (!isProxy) {
- GLenum error = _mesa_is_integer_format(format)
- ? GL_INVALID_ENUM : GL_INVALID_OPERATION;
- _mesa_error(ctx, error,
- "glTexImage%dD(incompatible format 0x%x, type 0x%x)",
- dimensions, format, type);
- }
- return GL_TRUE;
- }
-
- /* make sure internal format and format basically agree */
- colorFormat = _mesa_is_color_format(format);
- indexFormat = _mesa_is_index_format(format);
- if ((_mesa_is_color_format(internalFormat) && !colorFormat && !indexFormat) ||
- (_mesa_is_index_format(internalFormat) && !indexFormat) ||
- (_mesa_is_depth_format(internalFormat) != _mesa_is_depth_format(format)) ||
- (_mesa_is_ycbcr_format(internalFormat) != _mesa_is_ycbcr_format(format)) ||
- (_mesa_is_depthstencil_format(internalFormat) != _mesa_is_depthstencil_format(format)) ||
- (_mesa_is_dudv_format(internalFormat) != _mesa_is_dudv_format(format))) {
- if (!isProxy)
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexImage%dD(incompatible internalFormat 0x%x, format 0x%x)",
- dimensions, internalFormat, format);
- return GL_TRUE;
- }
-
- /* additional checks for ycbcr textures */
- if (internalFormat == GL_YCBCR_MESA) {
- ASSERT(ctx->Extensions.MESA_ycbcr_texture);
- if (type != GL_UNSIGNED_SHORT_8_8_MESA &&
- type != GL_UNSIGNED_SHORT_8_8_REV_MESA) {
- char message[100];
- _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 &&
- target != GL_PROXY_TEXTURE_2D &&
- target != GL_TEXTURE_RECTANGLE_NV &&
- target != GL_PROXY_TEXTURE_RECTANGLE_NV) {
- if (!isProxy)
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target)");
- return GL_TRUE;
- }
- if (border != 0) {
- if (!isProxy) {
- char message[100];
- _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;
- }
- }
-
- /* additional checks for depth textures */
- if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
- /* Only 1D, 2D and rectangular textures supported, not 3D or cubes */
- if (target != GL_TEXTURE_1D &&
- target != GL_PROXY_TEXTURE_1D &&
- target != GL_TEXTURE_2D &&
- target != GL_PROXY_TEXTURE_2D &&
- target != GL_TEXTURE_RECTANGLE_ARB &&
- target != GL_PROXY_TEXTURE_RECTANGLE_ARB) {
- if (!isProxy)
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexImage(target/internalFormat)");
- return GL_TRUE;
- }
- }
-
- /* additional checks for compressed textures */
- if (_mesa_is_compressed_format(ctx, internalFormat)) {
- if (!target_can_be_compressed(ctx, target, internalFormat)) {
- if (!isProxy)
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexImage%dD(target)", dimensions);
- return GL_TRUE;
- }
- if (border != 0) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexImage%dD(border!=0)", dimensions);
- }
- return GL_TRUE;
- }
- }
-
- /* additional checks for integer textures */
- if (ctx->Extensions.EXT_texture_integer &&
- (_mesa_is_integer_format(format) !=
- _mesa_is_integer_format(internalFormat))) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexImage%dD(integer/non-integer format mismatch)",
- dimensions);
- }
- return GL_TRUE;
- }
-
- /* if we get here, the parameters are OK */
- return GL_FALSE;
-}
-
-
-/**
- * Test glTexSubImage[123]D() parameters for errors.
- *
- * \param ctx GL context.
- * \param dimensions texture image dimensions (must be 1, 2 or 3).
- * \param target texture target given by the user.
- * \param level image level given by the user.
- * \param xoffset sub-image x offset given by the user.
- * \param yoffset sub-image y offset given by the user.
- * \param zoffset sub-image z offset given by the user.
- * \param format pixel data format given by the user.
- * \param type pixel data type given by the user.
- * \param width image width given by the user.
- * \param height image height given by the user.
- * \param depth image depth given by the user.
- *
- * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
- *
- * Verifies each of the parameters against the constants specified in
- * __struct gl_contextRec::Const and the supported extensions, and according
- * to the OpenGL specification.
- */
-static GLboolean
-subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint width, GLint height, GLint depth,
- GLenum format, GLenum type )
-{
- /* Basic level check */
- if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level);
- return GL_TRUE;
- }
-
- /* Check for negative sizes */
- if (width < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexSubImage%dD(width=%d)", dimensions, width);
- return GL_TRUE;
- }
- if (height < 0 && dimensions > 1) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexSubImage%dD(height=%d)", dimensions, height);
- return GL_TRUE;
- }
- if (depth < 0 && dimensions > 2) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexSubImage%dD(depth=%d)", dimensions, depth);
- return GL_TRUE;
- }
-
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- /* As with the glTexImage2D check above, the error code here
- * depends on texture integer.
- */
- GLenum error = _mesa_is_integer_format(format)
- ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
- _mesa_error(ctx, error,
- "glTexSubImage%dD(incompatible format 0x%x, type 0x%x)",
- dimensions, format, type);
- return GL_TRUE;
- }
-
- return GL_FALSE;
-}
-
-
-/**
- * Do second part of glTexSubImage which depends on the destination texture.
- * \return GL_TRUE if error recorded, GL_FALSE otherwise
- */
-static GLboolean
-subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint width, GLint height, GLint depth,
- GLenum format, GLenum type,
- const struct gl_texture_image *destTex )
-{
- if (!destTex) {
- /* undefined image level */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%dD", dimensions);
- return GL_TRUE;
- }
-
- if (xoffset < -((GLint)destTex->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset)",
- dimensions);
- return GL_TRUE;
- }
- if (xoffset + width > (GLint) (destTex->Width + destTex->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset+width)",
- dimensions);
- return GL_TRUE;
- }
- if (dimensions > 1) {
- if (yoffset < -((GLint)destTex->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset)",
- dimensions);
- return GL_TRUE;
- }
- if (yoffset + height > (GLint) (destTex->Height + destTex->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset+height)",
- dimensions);
- return GL_TRUE;
- }
- }
- if (dimensions > 2) {
- if (zoffset < -((GLint)destTex->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)");
- return GL_TRUE;
- }
- if (zoffset + depth > (GLint) (destTex->Depth + destTex->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)");
- return GL_TRUE;
- }
- }
-
- if (_mesa_is_format_compressed(destTex->TexFormat)) {
- GLuint bw, bh;
-
- /* do tests which depend on compression block size */
- _mesa_get_format_block_size(destTex->TexFormat, &bw, &bh);
-
- /* offset must be multiple of block size */
- if ((xoffset % bw != 0) || (yoffset % bh != 0)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "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%dD(width = %d)", dimensions, width);
- return GL_TRUE;
- }
- if ((height % bh != 0) && (GLuint) height != destTex->Height) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexSubImage%dD(height = %d)", dimensions, height);
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-
-/**
- * Test glCopyTexImage[12]D() parameters for errors.
- *
- * \param ctx GL context.
- * \param dimensions texture image dimensions (must be 1, 2 or 3).
- * \param target texture target given by the user.
- * \param level image level given by the user.
- * \param internalFormat internal format given by the user.
- * \param width image width given by the user.
- * \param height image height given by the user.
- * \param border texture border.
- *
- * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
- *
- * Verifies each of the parameters against the constants specified in
- * __struct gl_contextRec::Const and the supported extensions, and according
- * to the OpenGL specification.
- */
-static GLboolean
-copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
- GLenum target, GLint level, GLint internalFormat,
- GLint width, GLint height, GLint border )
-{
- const GLenum proxyTarget = get_proxy_target(target);
- const GLenum type = GL_FLOAT;
- GLboolean sizeOK;
- GLint format;
-
- /* check target */
- if (!legal_texsubimage_target(ctx, dimensions, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexImage%uD(target=%s)",
- dimensions, _mesa_lookup_enum_by_nr(target));
- return GL_TRUE;
- }
-
- /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
- if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexImage%dD(level=%d)", dimensions, level);
- return GL_TRUE;
- }
-
- /* Check that the source buffer is complete */
- if (ctx->ReadBuffer->Name) {
- _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
- if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
- "glCopyTexImage%dD(invalid readbuffer)", dimensions);
- return GL_TRUE;
- }
- }
-
- /* Check border */
- if (border < 0 || border > 1 ||
- ((target == GL_TEXTURE_RECTANGLE_NV ||
- target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
- return GL_TRUE;
- }
-
- format = _mesa_base_tex_format(ctx, internalFormat);
- if (format < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexImage%dD(internalFormat)", dimensions);
- return GL_TRUE;
- }
-
- if (!_mesa_source_buffer_exists(ctx, format)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexImage%dD(missing readbuffer)", dimensions);
- return GL_TRUE;
- }
-
- /* Do size, level checking */
- sizeOK = (proxyTarget == GL_PROXY_TEXTURE_CUBE_MAP_ARB)
- ? (width == height) : 1;
-
- sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
- internalFormat, format,
- type, width, height,
- 1, border);
-
- if (!sizeOK) {
- if (dimensions == 1) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexImage1D(width=%d)", width);
- }
- else {
- ASSERT(dimensions == 2);
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexImage2D(width=%d, height=%d)", width, height);
- }
- return GL_TRUE;
- }
-
- if (_mesa_is_compressed_format(ctx, internalFormat)) {
- if (!target_can_be_compressed(ctx, target, internalFormat)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glCopyTexImage%dD(target)", dimensions);
- return GL_TRUE;
- }
- if (border != 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexImage%dD(border!=0)", dimensions);
- return GL_TRUE;
- }
- }
- else if (_mesa_is_depth_format(internalFormat)) {
- /* make sure we have depth/stencil buffers */
- if (!ctx->ReadBuffer->_DepthBuffer) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexImage%dD(no depth)", dimensions);
- return GL_TRUE;
- }
- }
- else if (_mesa_is_depthstencil_format(internalFormat)) {
- /* make sure we have depth/stencil buffers */
- if (!ctx->ReadBuffer->_DepthBuffer || !ctx->ReadBuffer->_StencilBuffer) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexImage%dD(no depth/stencil buffer)", dimensions);
- return GL_TRUE;
- }
- }
-
- /* if we get here, the parameters are OK */
- return GL_FALSE;
-}
-
-
-/**
- * Test glCopyTexSubImage[12]D() parameters for errors.
- * Note that this is the first part of error checking.
- * See also copytexsubimage_error_check2() below for the second part.
- *
- * \param ctx GL context.
- * \param dimensions texture image dimensions (must be 1, 2 or 3).
- * \param target texture target given by the user.
- * \param level image level given by the user.
- *
- * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
- */
-static GLboolean
-copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions,
- GLenum target, GLint level)
-{
- /* Check that the source buffer is complete */
- if (ctx->ReadBuffer->Name) {
- _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
- if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
- "glCopyTexImage%dD(invalid readbuffer)", dimensions);
- return GL_TRUE;
- }
- }
-
- /* check target (proxies not allowed) */
- if (!legal_texsubimage_target(ctx, dimensions, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexSubImage%uD(target=%s)",
- dimensions, _mesa_lookup_enum_by_nr(target));
- return GL_TRUE;
- }
-
- /* Check level */
- if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexSubImage%dD(level=%d)", dimensions, level);
- return GL_TRUE;
- }
-
- return GL_FALSE;
-}
-
-
-/**
- * Second part of error checking for glCopyTexSubImage[12]D().
- * \param xoffset sub-image x offset given by the user.
- * \param yoffset sub-image y offset given by the user.
- * \param zoffset sub-image z offset given by the user.
- * \param width image width given by the user.
- * \param height image height given by the user.
- */
-static GLboolean
-copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height,
- const struct gl_texture_image *teximage )
-{
- /* check that dest tex image exists */
- if (!teximage) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexSubImage%dD(undefined texture level: %d)",
- dimensions, level);
- return GL_TRUE;
- }
-
- /* Check size */
- if (width < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexSubImage%dD(width=%d)", dimensions, width);
- return GL_TRUE;
- }
- if (dimensions > 1 && height < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexSubImage%dD(height=%d)", dimensions, height);
- return GL_TRUE;
- }
-
- /* check x/y offsets */
- if (xoffset < -((GLint)teximage->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset);
- return GL_TRUE;
- }
- if (xoffset + width > (GLint) (teximage->Width + teximage->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexSubImage%dD(xoffset+width)", dimensions);
- return GL_TRUE;
- }
- if (dimensions > 1) {
- if (yoffset < -((GLint)teximage->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset);
- return GL_TRUE;
- }
- /* NOTE: we're adding the border here, not subtracting! */
- if (yoffset + height > (GLint) (teximage->Height + teximage->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexSubImage%dD(yoffset+height)", dimensions);
- return GL_TRUE;
- }
- }
-
- /* check z offset */
- if (dimensions > 2) {
- if (zoffset < -((GLint)teximage->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexSubImage%dD(zoffset)", dimensions);
- return GL_TRUE;
- }
- if (zoffset > (GLint) (teximage->Depth + teximage->Border)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexSubImage%dD(zoffset+depth)", dimensions);
- return GL_TRUE;
- }
- }
-
- if (_mesa_is_format_compressed(teximage->TexFormat)) {
- /* offset must be multiple of 4 */
- if ((xoffset & 3) || (yoffset & 3)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "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%dD(width)", dimensions);
- return GL_TRUE;
- }
- if ((height & 3) != 0 && (GLuint) height != teximage->Height) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexSubImage%dD(height)", dimensions);
- return GL_TRUE;
- }
- }
-
- if (teximage->InternalFormat == GL_YCBCR_MESA) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D");
- return GL_TRUE;
- }
-
- if (!_mesa_source_buffer_exists(ctx, teximage->_BaseFormat)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexSubImage%dD(missing readbuffer, format=0x%x)",
- dimensions, teximage->_BaseFormat);
- return GL_TRUE;
- }
-
- if (teximage->_BaseFormat == GL_DEPTH_COMPONENT) {
- if (!ctx->ReadBuffer->_DepthBuffer) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexSubImage%dD(no depth buffer)",
- dimensions);
- return GL_TRUE;
- }
- }
- else if (teximage->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
- if (!ctx->ReadBuffer->_DepthBuffer || !ctx->ReadBuffer->_StencilBuffer) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexSubImage%dD(no depth/stencil buffer)",
- dimensions);
- return GL_TRUE;
- }
- }
-
- /* If copying into an integer texture, the source buffer must also be
- * integer-valued.
- */
- if (_mesa_is_format_integer_color(teximage->TexFormat)) {
- struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
- if (!_mesa_is_format_integer_color(rb->Format)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexSubImage%dD(source buffer is not integer format)",
- dimensions);
- return GL_TRUE;
- }
- }
-
- /* if we get here, the parameters are OK */
- return GL_FALSE;
-}
-
-
-/** Callback info for walking over FBO hash table */
-struct cb_info
-{
- struct gl_context *ctx;
- struct gl_texture_object *texObj;
- GLuint level, face;
-};
-
-
-/**
- * Check render to texture callback. Called from _mesa_HashWalk().
- */
-static void
-check_rtt_cb(GLuint key, void *data, void *userData)
-{
- struct gl_framebuffer *fb = (struct gl_framebuffer *) data;
- const struct cb_info *info = (struct cb_info *) userData;
- struct gl_context *ctx = info->ctx;
- const struct gl_texture_object *texObj = info->texObj;
- const GLuint level = info->level, face = info->face;
-
- /* If this is a user-created FBO */
- if (fb->Name) {
- GLuint i;
- /* check if any of the FBO's attachments point to 'texObj' */
- for (i = 0; i < BUFFER_COUNT; i++) {
- struct gl_renderbuffer_attachment *att = fb->Attachment + i;
- if (att->Type == GL_TEXTURE &&
- att->Texture == texObj &&
- att->TextureLevel == level &&
- att->CubeMapFace == face) {
- ASSERT(att->Texture->Image[att->CubeMapFace][att->TextureLevel]);
- /* Tell driver about the new renderbuffer texture */
- ctx->Driver.RenderTexture(ctx, ctx->DrawBuffer, att);
- /* Mark fb status as indeterminate to force re-validation */
- fb->_Status = 0;
- }
- }
- }
-}
-
-
-/**
- * When a texture image is specified we have to check if it's bound to
- * any framebuffer objects (render to texture) in order to detect changes
- * in size or format since that effects FBO completeness.
- * Any FBOs rendering into the texture must be re-validated.
- */
-static void
-update_fbo_texture(struct gl_context *ctx, struct gl_texture_object *texObj,
- GLuint face, GLuint level)
-{
- /* Only check this texture if it's been marked as RenderToTexture */
- if (texObj->_RenderToTexture) {
- struct cb_info info;
- info.ctx = ctx;
- info.texObj = texObj;
- info.level = level;
- info.face = face;
- _mesa_HashWalk(ctx->Shared->FrameBuffers, check_rtt_cb, &info);
- }
-}
-
-
-/**
- * If the texture object's GenerateMipmap flag is set and we've
- * changed the texture base level image, regenerate the rest of the
- * mipmap levels now.
- */
-static INLINE void
-check_gen_mipmap(struct gl_context *ctx, GLenum target,
- struct gl_texture_object *texObj, GLint level)
-{
- ASSERT(target != GL_TEXTURE_CUBE_MAP);
- if (texObj->GenerateMipmap &&
- level == texObj->BaseLevel &&
- level < texObj->MaxLevel) {
- ASSERT(ctx->Driver.GenerateMipmap);
- ctx->Driver.GenerateMipmap(ctx, target, texObj);
- }
-}
-
-
-/** Debug helper: override the user-requested internal format */
-static GLenum
-override_internal_format(GLenum internalFormat, GLint width, GLint height)
-{
-#if 0
- if (internalFormat == GL_RGBA16F_ARB ||
- internalFormat == GL_RGBA32F_ARB) {
- printf("Convert rgba float tex to int %d x %d\n", width, height);
- return GL_RGBA;
- }
- else if (internalFormat == GL_RGB16F_ARB ||
- internalFormat == GL_RGB32F_ARB) {
- printf("Convert rgb float tex to int %d x %d\n", width, height);
- return GL_RGB;
- }
- else if (internalFormat == GL_LUMINANCE_ALPHA16F_ARB ||
- internalFormat == GL_LUMINANCE_ALPHA32F_ARB) {
- printf("Convert luminance float tex to int %d x %d\n", width, height);
- return GL_LUMINANCE_ALPHA;
- }
- else if (internalFormat == GL_LUMINANCE16F_ARB ||
- internalFormat == GL_LUMINANCE32F_ARB) {
- printf("Convert luminance float tex to int %d x %d\n", width, height);
- return GL_LUMINANCE;
- }
- else if (internalFormat == GL_ALPHA16F_ARB ||
- internalFormat == GL_ALPHA32F_ARB) {
- printf("Convert luminance float tex to int %d x %d\n", width, height);
- return GL_ALPHA;
- }
- /*
- else if (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) {
- internalFormat = GL_RGBA;
- }
- */
- else {
- return internalFormat;
- }
-#else
- return internalFormat;
-#endif
-}
-
-
-/**
- * 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.
- */
-gl_format
-_mesa_choose_texture_format(struct gl_context *ctx,
- struct gl_texture_object *texObj,
- GLenum target, GLint level,
- GLenum internalFormat, GLenum format, GLenum type)
-{
- gl_format f;
-
- /* 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 */
- ASSERT(prevImage->TexFormat != MESA_FORMAT_NONE);
- return prevImage->TexFormat;
- }
- }
-
- /* choose format from scratch */
- f = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
- ASSERT(f != MESA_FORMAT_NONE);
- return f;
-}
-
-
-/**
- * Common code to implement all the glTexImage1D/2D/3D functions.
- */
-static void
-teximage(struct gl_context *ctx, GLuint dims,
- GLenum target, GLint level, GLint internalFormat,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum format, GLenum type,
- const GLvoid *pixels)
-{
- GLboolean error;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glTexImage%uD %s %d %s %d %d %d %d %s %s %p\n",
- dims,
- _mesa_lookup_enum_by_nr(target), level,
- _mesa_lookup_enum_by_nr(internalFormat),
- width, height, depth, border,
- _mesa_lookup_enum_by_nr(format),
- _mesa_lookup_enum_by_nr(type), pixels);
-
- internalFormat = override_internal_format(internalFormat, width, height);
-
- /* target error checking */
- if (!legal_teximage_target(ctx, dims, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage%uD(target=%s)",
- dims, _mesa_lookup_enum_by_nr(target));
- return;
- }
-
- /* general error checking */
- error = texture_error_check(ctx, dims, target, level, internalFormat,
- format, type, width, height, depth, border);
-
- if (_mesa_is_proxy_texture(target)) {
- /* Proxy texture: just clear or set state depending on error checking */
- struct gl_texture_image *texImage =
- _mesa_get_proxy_tex_image(ctx, target, level);
-
- if (error) {
- /* when error, clear all proxy texture image parameters */
- if (texImage)
- clear_teximage_fields(texImage);
- }
- else {
- /* no error, set the tex image parameters */
- struct gl_texture_object *texObj =
- _mesa_get_current_tex_object(ctx, target);
- gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
- target, level,
- internalFormat,
- format, type);
-
- if (legal_texture_size(ctx, texFormat, width, height, depth)) {
- _mesa_init_teximage_fields(ctx, target, texImage, width, height,
- depth, border, internalFormat,
- texFormat);
- }
- else if (texImage) {
- clear_teximage_fields(texImage);
- }
- }
- }
- else {
- /* non-proxy target */
- const GLuint face = _mesa_tex_target_to_face(target);
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- if (error) {
- return; /* error was recorded */
- }
-
- if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
- _mesa_update_state(ctx);
-
- texObj = _mesa_get_current_tex_object(ctx, target);
-
- _mesa_lock_texture(ctx, texObj);
- {
- texImage = _mesa_get_tex_image(ctx, texObj, target, level);
-
- if (!texImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
- }
- else {
- gl_format texFormat;
-
- if (texImage->Data) {
- ctx->Driver.FreeTexImageData( ctx, texImage );
- }
-
- ASSERT(texImage->Data == NULL);
- texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
- internalFormat, format,
- type);
-
- if (legal_texture_size(ctx, texFormat, width, height, depth)) {
- _mesa_init_teximage_fields(ctx, target, texImage,
- width, height, depth,
- border, internalFormat, texFormat);
-
- /* Give the texture to the driver. <pixels> may be null. */
- ASSERT(ctx->Driver.TexImage3D);
- switch (dims) {
- case 1:
- ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
- width, border, format,
- type, pixels, &ctx->Unpack, texObj,
- texImage);
- break;
- case 2:
- ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
- width, height, border, format,
- type, pixels, &ctx->Unpack, texObj,
- texImage);
- break;
- case 3:
- ctx->Driver.TexImage3D(ctx, target, level, internalFormat,
- width, height, depth, border, format,
- type, pixels, &ctx->Unpack, texObj,
- texImage);
- break;
- default:
- _mesa_problem(ctx, "invalid dims=%u in teximage()", dims);
- }
-
- check_gen_mipmap(ctx, target, texObj, level);
-
- update_fbo_texture(ctx, texObj, face, level);
-
- /* state update */
- texObj->_Complete = GL_FALSE;
- ctx->NewState |= _NEW_TEXTURE;
- }
- else {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
- }
- }
- }
- _mesa_unlock_texture(ctx, texObj);
- }
-}
-
-
-/*
- * Called from the API. Note that width includes the border.
- */
-void GLAPIENTRY
-_mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
- GLsizei width, GLint border, GLenum format,
- GLenum type, const GLvoid *pixels )
-{
- GET_CURRENT_CONTEXT(ctx);
- teximage(ctx, 1, target, level, internalFormat, width, 1, 1,
- border, format, type, pixels);
-}
-
-
-void GLAPIENTRY
-_mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
- GLsizei width, GLsizei height, GLint border,
- GLenum format, GLenum type,
- const GLvoid *pixels )
-{
- GET_CURRENT_CONTEXT(ctx);
- teximage(ctx, 2, target, level, internalFormat, width, height, 1,
- border, format, type, pixels);
-}
-
-
-/*
- * Called by the API or display list executor.
- * Note that width and height include the border.
- */
-void GLAPIENTRY
-_mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum format, GLenum type,
- const GLvoid *pixels )
-{
- GET_CURRENT_CONTEXT(ctx);
- teximage(ctx, 3, target, level, internalFormat, width, height, depth,
- border, format, type, pixels);
-}
-
-
-void GLAPIENTRY
-_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum format, GLenum type,
- const GLvoid *pixels )
-{
- _mesa_TexImage3D(target, level, (GLint) internalFormat, width, height,
- depth, border, format, type, pixels);
-}
-
-
-#if FEATURE_OES_EGL_image
-void GLAPIENTRY
-_mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
-{
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- 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);
- return;
- }
-
- if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
- _mesa_update_state(ctx);
-
- texObj = _mesa_get_current_tex_object(ctx, target);
- _mesa_lock_texture(ctx, texObj);
-
- texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
- if (!texImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEGLImageTargetTexture2D");
- } else {
- if (texImage->Data)
- ctx->Driver.FreeTexImageData( ctx, texImage );
-
- ASSERT(texImage->Data == NULL);
- ctx->Driver.EGLImageTargetTexture2D(ctx, target,
- texObj, texImage, image);
-
- /* state update */
- texObj->_Complete = GL_FALSE;
- ctx->NewState |= _NEW_TEXTURE;
- }
- _mesa_unlock_texture(ctx, texObj);
-
-}
-#endif
-
-
-
-/**
- * Implement all the glTexSubImage1/2/3D() functions.
- */
-static void
-texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const GLvoid *pixels )
-{
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glTexSubImage%uD %s %d %d %d %d %d %d %d %s %s %p\n",
- dims,
- _mesa_lookup_enum_by_nr(target), level,
- xoffset, yoffset, zoffset, width, height, depth,
- _mesa_lookup_enum_by_nr(format),
- _mesa_lookup_enum_by_nr(type), pixels);
-
- /* check target (proxies not allowed) */
- if (!legal_texsubimage_target(ctx, dims, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%uD(target=%s)",
- dims, _mesa_lookup_enum_by_nr(target));
- return;
- }
-
- if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
- _mesa_update_state(ctx);
-
- if (subtexture_error_check(ctx, dims, target, level, xoffset, yoffset, zoffset,
- width, height, depth, format, type)) {
- return; /* error was detected */
- }
-
- texObj = _mesa_get_current_tex_object(ctx, target);
-
- _mesa_lock_texture(ctx, texObj);
- {
- texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
- if (subtexture_error_check2(ctx, dims, target, level,
- xoffset, yoffset, zoffset,
- width, height, depth,
- format, type, texImage)) {
- /* error was recorded */
- }
- else if (width > 0 && height > 0 && height > 0) {
- /* If we have a border, offset=-1 is legal. Bias by border width. */
- switch (dims) {
- case 3:
- zoffset += texImage->Border;
- /* fall-through */
- case 2:
- yoffset += texImage->Border;
- /* fall-through */
- case 1:
- xoffset += texImage->Border;
- }
-
- switch (dims) {
- case 1:
- ctx->Driver.TexSubImage1D(ctx, target, level,
- xoffset, width,
- format, type, pixels,
- &ctx->Unpack, texObj, texImage );
- break;
- case 2:
- ctx->Driver.TexSubImage2D(ctx, target, level,
- xoffset, yoffset, width, height,
- format, type, pixels,
- &ctx->Unpack, texObj, texImage );
- break;
- case 3:
- ctx->Driver.TexSubImage3D(ctx, target, level,
- xoffset, yoffset, zoffset,
- width, height, depth,
- format, type, pixels,
- &ctx->Unpack, texObj, texImage );
- break;
- default:
- _mesa_problem(ctx, "unexpected dims in subteximage()");
- }
-
- check_gen_mipmap(ctx, target, texObj, level);
-
- ctx->NewState |= _NEW_TEXTURE;
- }
- }
- _mesa_unlock_texture(ctx, texObj);
-}
-
-
-void GLAPIENTRY
-_mesa_TexSubImage1D( GLenum target, GLint level,
- GLint xoffset, GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels )
-{
- GET_CURRENT_CONTEXT(ctx);
- texsubimage(ctx, 1, target, level,
- xoffset, 0, 0,
- width, 1, 1,
- format, type, pixels);
-}
-
-
-void GLAPIENTRY
-_mesa_TexSubImage2D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels )
-{
- GET_CURRENT_CONTEXT(ctx);
- texsubimage(ctx, 2, target, level,
- xoffset, yoffset, 0,
- width, height, 1,
- format, type, pixels);
-}
-
-
-
-void GLAPIENTRY
-_mesa_TexSubImage3D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type,
- const GLvoid *pixels )
-{
- GET_CURRENT_CONTEXT(ctx);
- texsubimage(ctx, 3, target, level,
- xoffset, yoffset, zoffset,
- width, height, depth,
- format, type, pixels);
-}
-
-
-
-/**
- * Implement the glCopyTexImage1/2D() functions.
- */
-static void
-copyteximage(struct gl_context *ctx, GLuint dims,
- GLenum target, GLint level, GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
-{
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- const GLuint face = _mesa_tex_target_to_face(target);
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glCopyTexImage%uD %s %d %s %d %d %d %d %d\n",
- dims,
- _mesa_lookup_enum_by_nr(target), level,
- _mesa_lookup_enum_by_nr(internalFormat),
- x, y, width, height, border);
-
- if (ctx->NewState & NEW_COPY_TEX_STATE)
- _mesa_update_state(ctx);
-
- if (copytexture_error_check(ctx, dims, target, level, internalFormat,
- width, height, border))
- return;
-
- texObj = _mesa_get_current_tex_object(ctx, target);
-
- _mesa_lock_texture(ctx, texObj);
- {
- texImage = _mesa_get_tex_image(ctx, texObj, target, level);
-
- if (!texImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
- }
- else {
- gl_format texFormat;
-
- if (texImage->Data) {
- ctx->Driver.FreeTexImageData( ctx, texImage );
- }
-
- ASSERT(texImage->Data == NULL);
-
- texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
- internalFormat, GL_NONE,
- GL_NONE);
-
- if (legal_texture_size(ctx, texFormat, width, height, 1)) {
- _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
- border, internalFormat, texFormat);
-
- ASSERT(ctx->Driver.CopyTexImage2D);
- if (dims == 1)
- ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat,
- x, y, width, border);
- else
- ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat,
- x, y, width, height, border);
-
- check_gen_mipmap(ctx, target, texObj, level);
-
- update_fbo_texture(ctx, texObj, face, level);
-
- /* state update */
- texObj->_Complete = GL_FALSE;
- ctx->NewState |= _NEW_TEXTURE;
- }
- else {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
- }
- }
- }
- _mesa_unlock_texture(ctx, texObj);
-}
-
-
-
-void GLAPIENTRY
-_mesa_CopyTexImage1D( GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y,
- GLsizei width, GLint border )
-{
- GET_CURRENT_CONTEXT(ctx);
- copyteximage(ctx, 1, target, level, internalFormat, x, y, width, 1, border);
-}
-
-
-
-void GLAPIENTRY
-_mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint border )
-{
- GET_CURRENT_CONTEXT(ctx);
- copyteximage(ctx, 2, target, level, internalFormat,
- x, y, width, height, border);
-}
-
-
-
-/**
- * Implementation for glCopyTexSubImage1/2/3D() functions.
- */
-static void
-copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y, GLsizei width, GLsizei height)
-{
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glCopyTexSubImage%uD %s %d %d %d %d %d %d %d %d\n",
- dims,
- _mesa_lookup_enum_by_nr(target),
- level, xoffset, yoffset, zoffset, x, y, width, height);
-
- if (ctx->NewState & NEW_COPY_TEX_STATE)
- _mesa_update_state(ctx);
-
- if (copytexsubimage_error_check1(ctx, dims, target, level))
- return;
-
- texObj = _mesa_get_current_tex_object(ctx, target);
-
- _mesa_lock_texture(ctx, texObj);
- {
- texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
- if (copytexsubimage_error_check2(ctx, dims, target, level, xoffset, yoffset,
- zoffset, width, height, texImage)) {
- /* error was recored */
- }
- else {
- /* If we have a border, offset=-1 is legal. Bias by border width. */
- switch (dims) {
- case 3:
- zoffset += texImage->Border;
- /* fall-through */
- case 2:
- yoffset += texImage->Border;
- /* fall-through */
- case 1:
- xoffset += texImage->Border;
- }
-
- if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
- &width, &height)) {
- switch (dims) {
- case 1:
- ctx->Driver.CopyTexSubImage1D(ctx, target, level,
- xoffset, x, y, width);
- break;
- case 2:
- ctx->Driver.CopyTexSubImage2D(ctx, target, level,
- xoffset, yoffset,
- x, y, width, height);
- break;
- case 3:
- ctx->Driver.CopyTexSubImage3D(ctx, target, level,
- xoffset, yoffset, zoffset,
- x, y, width, height);
- break;
- default:
- _mesa_problem(ctx, "bad dims in copytexsubimage()");
- }
-
- check_gen_mipmap(ctx, target, texObj, level);
-
- ctx->NewState |= _NEW_TEXTURE;
- }
- }
- }
- _mesa_unlock_texture(ctx, texObj);
-}
-
-
-void GLAPIENTRY
-_mesa_CopyTexSubImage1D( GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width )
-{
- GET_CURRENT_CONTEXT(ctx);
- copytexsubimage(ctx, 1, target, level, xoffset, 0, 0, x, y, width, 1);
-}
-
-
-
-void GLAPIENTRY
-_mesa_CopyTexSubImage2D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLsizei height )
-{
- GET_CURRENT_CONTEXT(ctx);
- copytexsubimage(ctx, 2, target, level, xoffset, yoffset, 0, x, y,
- width, height);
-}
-
-
-
-void GLAPIENTRY
-_mesa_CopyTexSubImage3D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y, GLsizei width, GLsizei height )
-{
- GET_CURRENT_CONTEXT(ctx);
- copytexsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
- x, y, width, height);
-}
-
-
-
-
-/**********************************************************************/
-/****** Compressed Textures ******/
-/**********************************************************************/
-
-
-/**
- * Return expected size of a compressed texture.
- */
-static GLuint
-compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth,
- GLenum glformat)
-{
- gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
- return _mesa_format_image_size(mesaFormat, width, height, depth);
-}
-
-
-/*
- * Return compressed texture block size, in pixels.
- */
-static void
-get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh)
-{
- gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
- _mesa_get_format_block_size(mesaFormat, bw, bh);
-}
-
-
-/**
- * Error checking for glCompressedTexImage[123]D().
- * \return error code or GL_NO_ERROR.
- */
-static GLenum
-compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
- GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLsizei height, GLsizei depth, GLint border,
- GLsizei imageSize)
-{
- const GLenum proxyTarget = get_proxy_target(target);
- const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
- GLint expectedSize;
-
- /* check level */
- if (level < 0 || level >= maxLevels)
- return GL_INVALID_VALUE;
-
- if (!target_can_be_compressed(ctx, target, internalFormat)) {
- return GL_INVALID_ENUM;
- }
-
- /* This will detect any invalid internalFormat value */
- if (!_mesa_is_compressed_format(ctx, internalFormat))
- return GL_INVALID_ENUM;
-
- /* This should really never fail */
- if (_mesa_base_tex_format(ctx, internalFormat) < 0)
- return GL_INVALID_ENUM;
-
- /* No compressed formats support borders at this time */
- if (border != 0)
- return GL_INVALID_VALUE;
-
- /* For cube map, width must equal height */
- if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
- target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB && width != height)
- return GL_INVALID_VALUE;
-
- /* check image size against compression block size */
- {
- gl_format texFormat =
- ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
- GL_NONE, GL_NONE);
- GLuint bw, bh;
-
- _mesa_get_format_block_size(texFormat, &bw, &bh);
- if ((width > bw && width % bw > 0) ||
- (height > bh && height % bh > 0)) {
- /*
- * Per GL_ARB_texture_compression: GL_INVALID_OPERATION is
- * generated [...] if any parameter combinations are not
- * supported by the specific compressed internal format.
- */
- return GL_INVALID_OPERATION;
- }
- }
-
- /* check image sizes */
- if (!ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
- internalFormat, GL_NONE, GL_NONE,
- width, height, depth, border)) {
- /* See error comment above */
- return GL_INVALID_OPERATION;
- }
-
- /* check image size in bytes */
- expectedSize = compressed_tex_size(width, height, depth, internalFormat);
- if (expectedSize != imageSize) {
- /* Per GL_ARB_texture_compression: GL_INVALID_VALUE is generated [...]
- * if <imageSize> is not consistent with the format, dimensions, and
- * contents of the specified image.
- */
- return GL_INVALID_VALUE;
- }
-
- return GL_NO_ERROR;
-}
-
-
-/**
- * Error checking for glCompressedTexSubImage[123]D().
- * \warning There are some bad assumptions here about the size of compressed
- * texture tiles (multiple of 4) used to test the validity of the
- * offset and size parameters.
- * \return error code or GL_NO_ERROR.
- */
-static GLenum
-compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLsizei imageSize)
-{
- GLint expectedSize, maxLevels = 0, maxTextureSize;
- GLuint bw, bh;
- (void) zoffset;
-
- if (dimensions == 1) {
- /* 1D compressed textures not allowed */
- return GL_INVALID_ENUM;
- }
- else if (dimensions == 2) {
- if (target == GL_PROXY_TEXTURE_2D) {
- maxLevels = ctx->Const.MaxTextureLevels;
- }
- else if (target == GL_TEXTURE_2D) {
- maxLevels = ctx->Const.MaxTextureLevels;
- }
- else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
- if (!ctx->Extensions.ARB_texture_cube_map)
- return GL_INVALID_ENUM; /*target*/
- maxLevels = ctx->Const.MaxCubeTextureLevels;
- }
- else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
- target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
- if (!ctx->Extensions.ARB_texture_cube_map)
- return GL_INVALID_ENUM; /*target*/
- maxLevels = ctx->Const.MaxCubeTextureLevels;
- }
- else {
- return GL_INVALID_ENUM; /*target*/
- }
- }
- else if (dimensions == 3) {
- /* 3D compressed textures not allowed */
- return GL_INVALID_ENUM;
- }
-
- maxTextureSize = 1 << (maxLevels - 1);
-
- /* this will catch any invalid compressed format token */
- if (!_mesa_is_compressed_format(ctx, format))
- return GL_INVALID_ENUM;
-
- if (width < 1 || width > maxTextureSize)
- return GL_INVALID_VALUE;
-
- if ((height < 1 || height > maxTextureSize)
- && dimensions > 1)
- return GL_INVALID_VALUE;
-
- if (level < 0 || level >= maxLevels)
- return GL_INVALID_VALUE;
-
- /*
- * do checks which depend on compression block size
- */
- get_compressed_block_size(format, &bw, &bh);
-
- if ((xoffset % bw != 0) || (yoffset % bh != 0))
- return GL_INVALID_VALUE;
-
- if ((width % bw != 0) && width != 2 && width != 1)
- return GL_INVALID_VALUE;
-
- if ((height % bh != 0) && height != 2 && height != 1)
- return GL_INVALID_VALUE;
-
- expectedSize = compressed_tex_size(width, height, depth, format);
- if (expectedSize != imageSize)
- return GL_INVALID_VALUE;
-
- return GL_NO_ERROR;
-}
-
-
-/**
- * Do second part of glCompressedTexSubImage error checking.
- * \return GL_TRUE if error found, GL_FALSE otherwise.
- */
-static GLboolean
-compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims,
- GLsizei width, GLsizei height,
- GLsizei depth, GLenum format,
- struct gl_texture_image *texImage)
-{
-
- if ((GLint) format != texImage->InternalFormat) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCompressedTexSubImage%uD(format=0x%x)", dims, format);
- return GL_TRUE;
- }
-
- if (((width == 1 || width == 2) &&
- width != (GLsizei) texImage->Width) ||
- (width > (GLsizei) texImage->Width)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCompressedTexSubImage%uD(width=%d)", dims, width);
- return GL_TRUE;
- }
-
- if (dims >= 2) {
- if (((height == 1 || height == 2) &&
- height != (GLsizei) texImage->Height) ||
- (height > (GLsizei) texImage->Height)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCompressedTexSubImage%uD(height=%d)", dims, height);
- return GL_TRUE;
- }
- }
-
- if (dims >= 3) {
- if (((depth == 1 || depth == 2) &&
- depth != (GLsizei) texImage->Depth) ||
- (depth > (GLsizei) texImage->Depth)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCompressedTexSubImage%uD(depth=%d)", dims, depth);
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-
-/**
- * Implementation of the glCompressedTexImage1/2/3D() functions.
- */
-static void
-compressedteximage(struct gl_context *ctx, GLuint dims,
- GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLsizei height, GLsizei depth, GLint border,
- GLsizei imageSize, const GLvoid *data)
-{
- GLenum error;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx,
- "glCompressedTexImage%uDARB %s %d %s %d %d %d %d %d %p\n",
- dims,
- _mesa_lookup_enum_by_nr(target), level,
- _mesa_lookup_enum_by_nr(internalFormat),
- width, height, depth, border, imageSize, data);
-
- /* check target */
- if (!legal_teximage_target(ctx, dims, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage%uD(target=%s)",
- dims, _mesa_lookup_enum_by_nr(target));
- return;
- }
-
- error = compressed_texture_error_check(ctx, dims, target, level,
- internalFormat, width, height, depth,
- border, imageSize);
-
-#if FEATURE_ES
- /* XXX this is kind of a hack */
- if (error) {
- _mesa_error(ctx, error, "glTexImage2D");
- return;
- }
-
- if (dims == 2) {
- 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 (_mesa_is_proxy_texture(target)) {
- /* Proxy texture: just check for errors and update proxy state */
- struct gl_texture_image *texImage;
-
- if (!error) {
- struct gl_texture_object *texObj =
- _mesa_get_current_tex_object(ctx, target);
- gl_format texFormat =
- _mesa_choose_texture_format(ctx, texObj, target, level,
- internalFormat, GL_NONE, GL_NONE);
- if (!legal_texture_size(ctx, texFormat, width, height, depth)) {
- error = GL_OUT_OF_MEMORY;
- }
- }
-
- texImage = _mesa_get_proxy_tex_image(ctx, target, level);
- if (texImage) {
- if (error) {
- /* if error, clear all proxy texture image parameters */
- clear_teximage_fields(texImage);
- }
- else {
- /* no error: store the teximage parameters */
- _mesa_init_teximage_fields(ctx, target, texImage, width, height,
- depth, border, internalFormat,
- MESA_FORMAT_NONE);
- }
- }
- }
- else {
- /* non-proxy target */
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- if (error) {
- _mesa_error(ctx, error, "glCompressedTexImage%uD", dims);
- return;
- }
-
- texObj = _mesa_get_current_tex_object(ctx, target);
-
- _mesa_lock_texture(ctx, texObj);
- {
- texImage = _mesa_get_tex_image(ctx, texObj, target, level);
- if (!texImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glCompressedTexImage%uD", dims);
- }
- else {
- gl_format texFormat;
-
- if (texImage->Data) {
- ctx->Driver.FreeTexImageData( ctx, texImage );
- }
- ASSERT(texImage->Data == NULL);
-
- texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
- internalFormat, GL_NONE,
- GL_NONE);
-
- if (legal_texture_size(ctx, texFormat, width, height, depth)) {
- _mesa_init_teximage_fields(ctx, target, texImage,
- width, height, depth,
- border, internalFormat, texFormat);
-
- switch (dims) {
- case 1:
- ASSERT(ctx->Driver.CompressedTexImage1D);
- ctx->Driver.CompressedTexImage1D(ctx, target, level,
- internalFormat,
- width,
- border, imageSize, data,
- texObj, texImage);
- break;
- case 2:
- ASSERT(ctx->Driver.CompressedTexImage2D);
- ctx->Driver.CompressedTexImage2D(ctx, target, level,
- internalFormat,
- width, height,
- border, imageSize, data,
- texObj, texImage);
- break;
- case 3:
- ASSERT(ctx->Driver.CompressedTexImage3D);
- ctx->Driver.CompressedTexImage3D(ctx, target, level,
- internalFormat,
- width, height, depth,
- border, imageSize, data,
- texObj, texImage);
- break;
- default:
- _mesa_problem(ctx, "bad dims in compressedteximage");
- }
-
- check_gen_mipmap(ctx, target, texObj, level);
-
- /* state update */
- texObj->_Complete = GL_FALSE;
- ctx->NewState |= _NEW_TEXTURE;
- }
- else {
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glCompressedTexImage%uD", dims);
- }
- }
- }
- _mesa_unlock_texture(ctx, texObj);
- }
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexImage1DARB(GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLint border, GLsizei imageSize,
- const GLvoid *data)
-{
- GET_CURRENT_CONTEXT(ctx);
- compressedteximage(ctx, 1, target, level, internalFormat,
- width, 1, 1, border, imageSize, data);
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLsizei height, GLint border, GLsizei imageSize,
- const GLvoid *data)
-{
- GET_CURRENT_CONTEXT(ctx);
- compressedteximage(ctx, 2, target, level, internalFormat,
- width, height, 1, border, imageSize, data);
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexImage3DARB(GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLsizei height, GLsizei depth, GLint border,
- GLsizei imageSize, const GLvoid *data)
-{
- GET_CURRENT_CONTEXT(ctx);
- compressedteximage(ctx, 3, target, level, internalFormat,
- width, height, depth, border, imageSize, data);
-}
-
-
-/**
- * Common helper for glCompressedTexSubImage1/2/3D().
- */
-static void
-compressed_tex_sub_image(GLuint dims, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- GLenum error;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- error = compressed_subtexture_error_check(ctx, dims, target, level,
- xoffset, 0, 0, /* pos */
- width, height, depth, /* size */
- format, imageSize);
- if (error) {
- _mesa_error(ctx, error, "glCompressedTexSubImage%uD", dims);
- return;
- }
-
- texObj = _mesa_get_current_tex_object(ctx, target);
-
- _mesa_lock_texture(ctx, texObj);
- {
- texImage = _mesa_select_tex_image(ctx, texObj, target, level);
- assert(texImage);
-
- if (compressed_subtexture_error_check2(ctx, dims, width, height, depth,
- format, texImage)) {
- /* error was recorded */
- }
- else if (width > 0 && height > 0 && depth > 0) {
- switch (dims) {
- case 1:
- if (ctx->Driver.CompressedTexSubImage1D) {
- ctx->Driver.CompressedTexSubImage1D(ctx, target, level,
- xoffset, width,
- format, imageSize, data,
- texObj, texImage);
- }
- break;
- case 2:
- if (ctx->Driver.CompressedTexSubImage2D) {
- ctx->Driver.CompressedTexSubImage2D(ctx, target, level,
- xoffset, yoffset,
- width, height,
- format, imageSize, data,
- texObj, texImage);
- }
- break;
- case 3:
- if (ctx->Driver.CompressedTexSubImage3D) {
- ctx->Driver.CompressedTexSubImage3D(ctx, target, level,
- xoffset, yoffset, zoffset,
- width, height, depth,
- format, imageSize, data,
- texObj, texImage);
- }
- break;
- default:
- ;
- }
-
- check_gen_mipmap(ctx, target, texObj, level);
-
- ctx->NewState |= _NEW_TEXTURE;
- }
- }
- _mesa_unlock_texture(ctx, texObj);
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
- GLsizei width, GLenum format,
- GLsizei imageSize, const GLvoid *data)
-{
- compressed_tex_sub_image(1, target, level, xoffset, 0, 0, width, 1, 1,
- format, imageSize, data);
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
- GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize,
- const GLvoid *data)
-{
- compressed_tex_sub_image(2, target, level, xoffset, yoffset, 0,
- width, height, 1, format, imageSize, data);
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
- GLint yoffset, GLint zoffset, GLsizei width,
- GLsizei height, GLsizei depth, GLenum format,
- GLsizei imageSize, const GLvoid *data)
-{
- compressed_tex_sub_image(3, target, level, xoffset, yoffset, zoffset,
- width, height, depth, format, imageSize, data);
-}
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
deleted file mode 100644
index 5bb9d49..0000000
--- a/src/mesa/main/teximage.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/**
- * \file teximage.h
- * Texture images manipulation functions.
- */
-
-/*
- * 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.
- */
-
-
-#ifndef TEXIMAGE_H
-#define TEXIMAGE_H
-
-
-#include "mtypes.h"
-#include "formats.h"
-
-
-extern void *
-_mesa_alloc_texmemory(GLsizei bytes);
-
-extern void
-_mesa_free_texmemory(void *m);
-
-
-/** \name Internal functions */
-/*@{*/
-
-extern GLint
-_mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat );
-
-
-extern GLboolean
-_mesa_is_proxy_texture(GLenum target);
-
-
-extern struct gl_texture_image *
-_mesa_new_texture_image( struct gl_context *ctx );
-
-
-extern void
-_mesa_delete_texture_image( struct gl_context *ctx, struct gl_texture_image *teximage );
-
-extern void
-_mesa_free_texture_image_data( struct gl_context *ctx,
- struct gl_texture_image *texImage );
-
-
-extern void
-_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
- struct gl_texture_image *img,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum internalFormat,
- gl_format format);
-
-
-extern gl_format
-_mesa_choose_texture_format(struct gl_context *ctx,
- struct gl_texture_object *texObj,
- GLenum target, GLint level,
- GLenum internalFormat, GLenum format, GLenum type);
-
-
-extern void
-_mesa_clear_texture_image(struct gl_context *ctx, struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_set_tex_image(struct gl_texture_object *tObj,
- GLenum target, GLint level,
- struct gl_texture_image *texImage);
-
-
-extern struct gl_texture_object *
-_mesa_select_tex_object(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
- GLenum target);
-
-extern struct gl_texture_object *
-_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target);
-
-
-extern struct gl_texture_image *
-_mesa_select_tex_image(struct gl_context *ctx, const struct gl_texture_object *texObj,
- GLenum target, GLint level);
-
-
-extern struct gl_texture_image *
-_mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
- GLenum target, GLint level);
-
-
-extern struct gl_texture_image *
-_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level);
-
-
-extern GLint
-_mesa_max_texture_levels(struct gl_context *ctx, GLenum target);
-
-
-extern GLboolean
-_mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat, GLenum format, GLenum type,
- GLint width, GLint height, GLint depth, GLint border);
-
-
-extern GLuint
-_mesa_tex_target_to_face(GLenum target);
-
-
-/**
- * Lock a texture for updating. See also _mesa_lock_context_textures().
- */
-static INLINE void
-_mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
-{
- _glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
- ctx->Shared->TextureStateStamp++;
- (void) texObj;
-}
-
-static INLINE void
-_mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
-{
- _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
-}
-
-/*@}*/
-
-
-/** \name API entry point functions */
-/*@{*/
-
-extern void GLAPIENTRY
-_mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
- GLsizei width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels );
-
-
-extern void GLAPIENTRY
-_mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
- GLsizei width, GLsizei height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels );
-
-
-extern void GLAPIENTRY
-_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
- GLsizei width, GLsizei height, GLsizei depth, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels );
-
-
-extern void GLAPIENTRY
-_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum format, GLenum type,
- const GLvoid *pixels );
-
-extern void GLAPIENTRY
-_mesa_EGLImageTargetTexture2DOES( GLenum target, GLeglImageOES image );
-
-extern void GLAPIENTRY
-_mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-
-extern void GLAPIENTRY
-_mesa_TexSubImage2D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-
-extern void GLAPIENTRY
-_mesa_TexSubImage3D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-
-extern void GLAPIENTRY
-_mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
- GLint x, GLint y, GLsizei width, GLint border );
-
-
-extern void GLAPIENTRY
-_mesa_CopyTexImage2D( GLenum target, GLint level,
- GLenum internalformat, GLint x, GLint y,
- GLsizei width, GLsizei height, GLint border );
-
-
-extern void GLAPIENTRY
-_mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
- GLint x, GLint y, GLsizei width );
-
-
-extern void GLAPIENTRY
-_mesa_CopyTexSubImage2D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLsizei height );
-
-
-extern void GLAPIENTRY
-_mesa_CopyTexSubImage3D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y, GLsizei width, GLsizei height );
-
-
-
-extern void GLAPIENTRY
-_mesa_CompressedTexImage1DARB(GLenum target, GLint level,
- GLenum internalformat, GLsizei width,
- GLint border, GLsizei imageSize,
- const GLvoid *data);
-
-extern void GLAPIENTRY
-_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
- GLenum internalformat, GLsizei width,
- GLsizei height, GLint border, GLsizei imageSize,
- const GLvoid *data);
-
-extern void GLAPIENTRY
-_mesa_CompressedTexImage3DARB(GLenum target, GLint level,
- GLenum internalformat, GLsizei width,
- GLsizei height, GLsizei depth, GLint border,
- GLsizei imageSize, const GLvoid *data);
-
-#ifdef VMS
-#define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
-#define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
-#define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
-#endif
-extern void GLAPIENTRY
-_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
- GLsizei width, GLenum format,
- GLsizei imageSize, const GLvoid *data);
-
-extern void GLAPIENTRY
-_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
- GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize,
- const GLvoid *data);
-
-extern void GLAPIENTRY
-_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
- GLint yoffset, GLint zoffset, GLsizei width,
- GLsizei height, GLsizei depth, GLenum format,
- GLsizei imageSize, const GLvoid *data);
-
-/*@}*/
-
-#endif
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
deleted file mode 100644
index 5bc5639..0000000
--- a/src/mesa/main/texobj.c
+++ /dev/null
@@ -1,1258 +0,0 @@
-/**
- * \file texobj.c
- * Texture object management.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#include "mfeatures.h"
-#include "colortab.h"
-#include "context.h"
-#include "enums.h"
-#include "fbobject.h"
-#include "formats.h"
-#include "hash.h"
-#include "imports.h"
-#include "macros.h"
-#include "teximage.h"
-#include "texobj.h"
-#include "mtypes.h"
-#include "program/prog_instruction.h"
-
-
-
-/**********************************************************************/
-/** \name Internal functions */
-/*@{*/
-
-
-/**
- * Return the gl_texture_object for a given ID.
- */
-struct gl_texture_object *
-_mesa_lookup_texture(struct gl_context *ctx, GLuint id)
-{
- return (struct gl_texture_object *)
- _mesa_HashLookup(ctx->Shared->TexObjects, id);
-}
-
-
-
-/**
- * Allocate and initialize a new texture object. But don't put it into the
- * texture object hash table.
- *
- * Called via ctx->Driver.NewTextureObject, unless overridden by a device
- * driver.
- *
- * \param shared the shared GL state structure to contain the texture object
- * \param name integer name for the texture object
- * \param target either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D,
- * GL_TEXTURE_CUBE_MAP_ARB or GL_TEXTURE_RECTANGLE_NV. zero is ok for the sake
- * of GenTextures()
- *
- * \return pointer to new texture object.
- */
-struct gl_texture_object *
-_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj;
- (void) ctx;
- obj = MALLOC_STRUCT(gl_texture_object);
- _mesa_initialize_texture_object(obj, name, target);
- return obj;
-}
-
-
-/**
- * Initialize a new texture object to default values.
- * \param obj the texture object
- * \param name the texture name
- * \param target the texture target
- */
-void
-_mesa_initialize_texture_object( struct gl_texture_object *obj,
- GLuint name, GLenum target )
-{
- ASSERT(target == 0 ||
- target == GL_TEXTURE_1D ||
- target == GL_TEXTURE_2D ||
- target == GL_TEXTURE_3D ||
- target == GL_TEXTURE_CUBE_MAP_ARB ||
- target == GL_TEXTURE_RECTANGLE_NV ||
- target == GL_TEXTURE_1D_ARRAY_EXT ||
- target == GL_TEXTURE_2D_ARRAY_EXT);
-
- memset(obj, 0, sizeof(*obj));
- /* init the non-zero fields */
- _glthread_INIT_MUTEX(obj->Mutex);
- obj->RefCount = 1;
- obj->Name = name;
- obj->Target = target;
- obj->Priority = 1.0F;
- if (target == GL_TEXTURE_RECTANGLE_NV) {
- obj->WrapS = GL_CLAMP_TO_EDGE;
- obj->WrapT = GL_CLAMP_TO_EDGE;
- obj->WrapR = GL_CLAMP_TO_EDGE;
- obj->MinFilter = GL_LINEAR;
- }
- else {
- obj->WrapS = GL_REPEAT;
- obj->WrapT = GL_REPEAT;
- obj->WrapR = GL_REPEAT;
- obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR;
- }
- obj->MagFilter = GL_LINEAR;
- obj->MinLod = -1000.0;
- obj->MaxLod = 1000.0;
- obj->LodBias = 0.0;
- obj->BaseLevel = 0;
- obj->MaxLevel = 1000;
- obj->MaxAnisotropy = 1.0;
- obj->CompareMode = GL_NONE; /* ARB_shadow */
- obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */
- obj->CompareFailValue = 0.0F; /* ARB_shadow_ambient */
- obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */
- obj->Swizzle[0] = GL_RED;
- obj->Swizzle[1] = GL_GREEN;
- obj->Swizzle[2] = GL_BLUE;
- obj->Swizzle[3] = GL_ALPHA;
- obj->_Swizzle = SWIZZLE_NOOP;
-}
-
-
-/**
- * Some texture initialization can't be finished until we know which
- * target it's getting bound to (GL_TEXTURE_1D/2D/etc).
- */
-static void
-finish_texture_init(struct gl_context *ctx, GLenum target,
- struct gl_texture_object *obj)
-{
- assert(obj->Target == 0);
-
- if (target == GL_TEXTURE_RECTANGLE_NV) {
- /* have to init wrap and filter state here - kind of klunky */
- obj->WrapS = GL_CLAMP_TO_EDGE;
- obj->WrapT = GL_CLAMP_TO_EDGE;
- obj->WrapR = GL_CLAMP_TO_EDGE;
- obj->MinFilter = GL_LINEAR;
- if (ctx->Driver.TexParameter) {
- static const GLfloat fparam_wrap[1] = {(GLfloat) GL_CLAMP_TO_EDGE};
- static const GLfloat fparam_filter[1] = {(GLfloat) GL_LINEAR};
- ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_S, fparam_wrap);
- ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_T, fparam_wrap);
- ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_R, fparam_wrap);
- ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_MIN_FILTER, fparam_filter);
- }
- }
-}
-
-
-/**
- * Deallocate a texture object struct. It should have already been
- * removed from the texture object pool.
- * Called via ctx->Driver.DeleteTexture() if not overriden by a driver.
- *
- * \param shared the shared GL state to which the object belongs.
- * \param texObj the texture object to delete.
- */
-void
-_mesa_delete_texture_object(struct gl_context *ctx,
- struct gl_texture_object *texObj)
-{
- GLuint i, face;
-
- /* Set Target to an invalid value. With some assertions elsewhere
- * we can try to detect possible use of deleted textures.
- */
- texObj->Target = 0x99;
-
- _mesa_free_colortable_data(&texObj->Palette);
-
- /* free the texture images */
- for (face = 0; face < 6; face++) {
- for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
- if (texObj->Image[face][i]) {
- _mesa_delete_texture_image( ctx, texObj->Image[face][i] );
- }
- }
- }
-
- /* destroy the mutex -- it may have allocated memory (eg on bsd) */
- _glthread_DESTROY_MUTEX(texObj->Mutex);
-
- /* free this object */
- free(texObj);
-}
-
-
-
-/**
- * Copy texture object state from one texture object to another.
- * Use for glPush/PopAttrib.
- *
- * \param dest destination texture object.
- * \param src source texture object.
- */
-void
-_mesa_copy_texture_object( struct gl_texture_object *dest,
- const struct gl_texture_object *src )
-{
- dest->Target = src->Target;
- dest->Name = src->Name;
- dest->Priority = src->Priority;
- dest->BorderColor.f[0] = src->BorderColor.f[0];
- dest->BorderColor.f[1] = src->BorderColor.f[1];
- dest->BorderColor.f[2] = src->BorderColor.f[2];
- dest->BorderColor.f[3] = src->BorderColor.f[3];
- dest->WrapS = src->WrapS;
- dest->WrapT = src->WrapT;
- dest->WrapR = src->WrapR;
- dest->MinFilter = src->MinFilter;
- dest->MagFilter = src->MagFilter;
- dest->MinLod = src->MinLod;
- dest->MaxLod = src->MaxLod;
- dest->LodBias = src->LodBias;
- dest->BaseLevel = src->BaseLevel;
- dest->MaxLevel = src->MaxLevel;
- dest->MaxAnisotropy = src->MaxAnisotropy;
- dest->CompareMode = src->CompareMode;
- dest->CompareFunc = src->CompareFunc;
- dest->CompareFailValue = src->CompareFailValue;
- dest->DepthMode = src->DepthMode;
- dest->_MaxLevel = src->_MaxLevel;
- dest->_MaxLambda = src->_MaxLambda;
- dest->GenerateMipmap = src->GenerateMipmap;
- dest->Palette = src->Palette;
- dest->_Complete = src->_Complete;
- COPY_4V(dest->Swizzle, src->Swizzle);
- dest->_Swizzle = src->_Swizzle;
-}
-
-
-/**
- * Free all texture images of the given texture object.
- *
- * \param ctx GL context.
- * \param t texture object.
- *
- * \sa _mesa_clear_texture_image().
- */
-void
-_mesa_clear_texture_object(struct gl_context *ctx,
- struct gl_texture_object *texObj)
-{
- GLuint i, j;
-
- if (texObj->Target == 0)
- return;
-
- for (i = 0; i < MAX_FACES; i++) {
- for (j = 0; j < MAX_TEXTURE_LEVELS; j++) {
- struct gl_texture_image *texImage = texObj->Image[i][j];
- if (texImage)
- _mesa_clear_texture_image(ctx, texImage);
- }
- }
-}
-
-
-/**
- * Check if the given texture object is valid by examining its Target field.
- * For debugging only.
- */
-static GLboolean
-valid_texture_object(const struct gl_texture_object *tex)
-{
- switch (tex->Target) {
- case 0:
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- case GL_TEXTURE_CUBE_MAP_ARB:
- case GL_TEXTURE_RECTANGLE_NV:
- case GL_TEXTURE_1D_ARRAY_EXT:
- case GL_TEXTURE_2D_ARRAY_EXT:
- return GL_TRUE;
- case 0x99:
- _mesa_problem(NULL, "invalid reference to a deleted texture object");
- return GL_FALSE;
- default:
- _mesa_problem(NULL, "invalid texture object Target 0x%x, Id = %u",
- tex->Target, tex->Name);
- return GL_FALSE;
- }
-}
-
-
-/**
- * Reference (or unreference) a texture object.
- * If '*ptr', decrement *ptr's refcount (and delete if it becomes zero).
- * If 'tex' is non-null, increment its refcount.
- */
-void
-_mesa_reference_texobj(struct gl_texture_object **ptr,
- struct gl_texture_object *tex)
-{
- assert(ptr);
- if (*ptr == tex) {
- /* no change */
- return;
- }
-
- if (*ptr) {
- /* Unreference the old texture */
- GLboolean deleteFlag = GL_FALSE;
- struct gl_texture_object *oldTex = *ptr;
-
- ASSERT(valid_texture_object(oldTex));
- (void) valid_texture_object; /* silence warning in release builds */
-
- _glthread_LOCK_MUTEX(oldTex->Mutex);
- ASSERT(oldTex->RefCount > 0);
- oldTex->RefCount--;
-
- deleteFlag = (oldTex->RefCount == 0);
- _glthread_UNLOCK_MUTEX(oldTex->Mutex);
-
- if (deleteFlag) {
- GET_CURRENT_CONTEXT(ctx);
- if (ctx)
- ctx->Driver.DeleteTexture(ctx, oldTex);
- else
- _mesa_problem(NULL, "Unable to delete texture, no context");
- }
-
- *ptr = NULL;
- }
- assert(!*ptr);
-
- if (tex) {
- /* reference new texture */
- ASSERT(valid_texture_object(tex));
- _glthread_LOCK_MUTEX(tex->Mutex);
- if (tex->RefCount == 0) {
- /* this texture's being deleted (look just above) */
- /* Not sure this can every really happen. Warn if it does. */
- _mesa_problem(NULL, "referencing deleted texture object");
- *ptr = NULL;
- }
- else {
- tex->RefCount++;
- *ptr = tex;
- }
- _glthread_UNLOCK_MUTEX(tex->Mutex);
- }
-}
-
-
-
-/**
- * Mark a texture object as incomplete.
- * \param t texture object
- * \param fmt... string describing why it's incomplete (for debugging).
- */
-static void
-incomplete(struct gl_texture_object *t, const char *fmt, ...)
-{
-#if 0
- va_list args;
- char s[100];
-
- va_start(args, fmt);
- vsnprintf(s, sizeof(s), fmt, args);
- va_end(args);
-
- printf("Texture Obj %d incomplete because: %s\n", t->Name, s);
-#endif
- t->_Complete = GL_FALSE;
-}
-
-
-/**
- * Examine a texture object to determine if it is complete.
- *
- * The gl_texture_object::Complete flag will be set to GL_TRUE or GL_FALSE
- * accordingly.
- *
- * \param ctx GL context.
- * \param t texture object.
- *
- * According to the texture target, verifies that each of the mipmaps is
- * present and has the expected size.
- */
-void
-_mesa_test_texobj_completeness( const struct gl_context *ctx,
- struct gl_texture_object *t )
-{
- const GLint baseLevel = t->BaseLevel;
- GLint maxLog2 = 0, maxLevels = 0;
-
- t->_Complete = GL_TRUE; /* be optimistic */
-
- /* Detect cases where the application set the base level to an invalid
- * value.
- */
- if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) {
- incomplete(t, "base level = %d is invalid", baseLevel);
- return;
- }
-
- /* Always need the base level image */
- if (!t->Image[0][baseLevel]) {
- incomplete(t, "Image[baseLevel=%d] == NULL", baseLevel);
- return;
- }
-
- /* Check width/height/depth for zero */
- if (t->Image[0][baseLevel]->Width == 0 ||
- t->Image[0][baseLevel]->Height == 0 ||
- t->Image[0][baseLevel]->Depth == 0) {
- incomplete(t, "texture width = 0");
- return;
- }
-
- /* Compute _MaxLevel */
- if ((t->Target == GL_TEXTURE_1D) ||
- (t->Target == GL_TEXTURE_1D_ARRAY_EXT)) {
- maxLog2 = t->Image[0][baseLevel]->WidthLog2;
- maxLevels = ctx->Const.MaxTextureLevels;
- }
- else if ((t->Target == GL_TEXTURE_2D) ||
- (t->Target == GL_TEXTURE_2D_ARRAY_EXT)) {
- maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
- t->Image[0][baseLevel]->HeightLog2);
- maxLevels = ctx->Const.MaxTextureLevels;
- }
- else if (t->Target == GL_TEXTURE_3D) {
- GLint max = MAX2(t->Image[0][baseLevel]->WidthLog2,
- t->Image[0][baseLevel]->HeightLog2);
- maxLog2 = MAX2(max, (GLint)(t->Image[0][baseLevel]->DepthLog2));
- maxLevels = ctx->Const.Max3DTextureLevels;
- }
- else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
- maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
- t->Image[0][baseLevel]->HeightLog2);
- maxLevels = ctx->Const.MaxCubeTextureLevels;
- }
- else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
- maxLog2 = 0; /* not applicable */
- maxLevels = 1; /* no mipmapping */
- }
- else {
- _mesa_problem(ctx, "Bad t->Target in _mesa_test_texobj_completeness");
- return;
- }
-
- ASSERT(maxLevels > 0);
-
- t->_MaxLevel = baseLevel + maxLog2;
- t->_MaxLevel = MIN2(t->_MaxLevel, t->MaxLevel);
- t->_MaxLevel = MIN2(t->_MaxLevel, maxLevels - 1);
-
- /* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */
- t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel);
-
- if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
- /* make sure that all six cube map level 0 images are the same size */
- const GLuint w = t->Image[0][baseLevel]->Width2;
- const GLuint h = t->Image[0][baseLevel]->Height2;
- GLuint face;
- for (face = 1; face < 6; face++) {
- if (t->Image[face][baseLevel] == NULL ||
- t->Image[face][baseLevel]->Width2 != w ||
- t->Image[face][baseLevel]->Height2 != h) {
- incomplete(t, "Cube face missing or mismatched size");
- return;
- }
- }
- }
-
- /* extra checking for mipmaps */
- if (t->MinFilter != GL_NEAREST && t->MinFilter != GL_LINEAR) {
- /*
- * Mipmapping: determine if we have a complete set of mipmaps
- */
- GLint i;
- GLint minLevel = baseLevel;
- GLint maxLevel = t->_MaxLevel;
-
- if (minLevel > maxLevel) {
- incomplete(t, "minLevel > maxLevel");
- return;
- }
-
- /* Test dimension-independent attributes */
- for (i = minLevel; i <= maxLevel; i++) {
- if (t->Image[0][i]) {
- if (t->Image[0][i]->TexFormat != t->Image[0][baseLevel]->TexFormat) {
- incomplete(t, "Format[i] != Format[baseLevel]");
- return;
- }
- if (t->Image[0][i]->Border != t->Image[0][baseLevel]->Border) {
- incomplete(t, "Border[i] != Border[baseLevel]");
- return;
- }
- }
- }
-
- /* Test things which depend on number of texture image dimensions */
- if ((t->Target == GL_TEXTURE_1D) ||
- (t->Target == GL_TEXTURE_1D_ARRAY_EXT)) {
- /* Test 1-D mipmaps */
- GLuint width = t->Image[0][baseLevel]->Width2;
- for (i = baseLevel + 1; i < maxLevels; i++) {
- if (width > 1) {
- width /= 2;
- }
- if (i >= minLevel && i <= maxLevel) {
- if (!t->Image[0][i]) {
- incomplete(t, "1D Image[0][i] == NULL");
- return;
- }
- if (t->Image[0][i]->Width2 != width ) {
- incomplete(t, "1D Image[0][i] bad width");
- return;
- }
- }
- if (width == 1) {
- return; /* found smallest needed mipmap, all done! */
- }
- }
- }
- else if ((t->Target == GL_TEXTURE_2D) ||
- (t->Target == GL_TEXTURE_2D_ARRAY_EXT)) {
- /* Test 2-D mipmaps */
- GLuint width = t->Image[0][baseLevel]->Width2;
- GLuint height = t->Image[0][baseLevel]->Height2;
- for (i = baseLevel + 1; i < maxLevels; i++) {
- if (width > 1) {
- width /= 2;
- }
- if (height > 1) {
- height /= 2;
- }
- if (i >= minLevel && i <= maxLevel) {
- if (!t->Image[0][i]) {
- incomplete(t, "2D Image[0][i] == NULL");
- return;
- }
- if (t->Image[0][i]->Width2 != width) {
- incomplete(t, "2D Image[0][i] bad width");
- return;
- }
- if (t->Image[0][i]->Height2 != height) {
- incomplete(t, "2D Image[0][i] bad height");
- return;
- }
- if (width==1 && height==1) {
- return; /* found smallest needed mipmap, all done! */
- }
- }
- }
- }
- else if (t->Target == GL_TEXTURE_3D) {
- /* Test 3-D mipmaps */
- GLuint width = t->Image[0][baseLevel]->Width2;
- GLuint height = t->Image[0][baseLevel]->Height2;
- GLuint depth = t->Image[0][baseLevel]->Depth2;
- for (i = baseLevel + 1; i < maxLevels; i++) {
- if (width > 1) {
- width /= 2;
- }
- if (height > 1) {
- height /= 2;
- }
- if (depth > 1) {
- depth /= 2;
- }
- if (i >= minLevel && i <= maxLevel) {
- if (!t->Image[0][i]) {
- incomplete(t, "3D Image[0][i] == NULL");
- return;
- }
- if (t->Image[0][i]->_BaseFormat == GL_DEPTH_COMPONENT) {
- incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
- return;
- }
- if (t->Image[0][i]->Width2 != width) {
- incomplete(t, "3D Image[0][i] bad width");
- return;
- }
- if (t->Image[0][i]->Height2 != height) {
- incomplete(t, "3D Image[0][i] bad height");
- return;
- }
- if (t->Image[0][i]->Depth2 != depth) {
- incomplete(t, "3D Image[0][i] bad depth");
- return;
- }
- }
- if (width == 1 && height == 1 && depth == 1) {
- return; /* found smallest needed mipmap, all done! */
- }
- }
- }
- else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
- /* make sure 6 cube faces are consistant */
- GLuint width = t->Image[0][baseLevel]->Width2;
- GLuint height = t->Image[0][baseLevel]->Height2;
- for (i = baseLevel + 1; i < maxLevels; i++) {
- if (width > 1) {
- width /= 2;
- }
- if (height > 1) {
- height /= 2;
- }
- if (i >= minLevel && i <= maxLevel) {
- GLuint face;
- for (face = 0; face < 6; face++) {
- /* check that we have images defined */
- if (!t->Image[face][i]) {
- incomplete(t, "CubeMap Image[n][i] == NULL");
- return;
- }
- /* Don't support GL_DEPTH_COMPONENT for cube maps */
- if (t->Image[face][i]->_BaseFormat == GL_DEPTH_COMPONENT) {
- incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
- return;
- }
- /* check that all six images have same size */
- if (t->Image[face][i]->Width2 != width ||
- t->Image[face][i]->Height2 != height) {
- incomplete(t, "CubeMap Image[n][i] bad size");
- return;
- }
- }
- }
- if (width == 1 && height == 1) {
- return; /* found smallest needed mipmap, all done! */
- }
- }
- }
- else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
- /* XXX special checking? */
- }
- else {
- /* Target = ??? */
- _mesa_problem(ctx, "Bug in gl_test_texture_object_completeness\n");
- }
- }
-}
-
-
-/**
- * Check if the given cube map texture is "cube complete" as defined in
- * the OpenGL specification.
- */
-GLboolean
-_mesa_cube_complete(const struct gl_texture_object *texObj)
-{
- const GLint baseLevel = texObj->BaseLevel;
- const struct gl_texture_image *img0, *img;
- GLuint face;
-
- if (texObj->Target != GL_TEXTURE_CUBE_MAP)
- return GL_FALSE;
-
- if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS))
- return GL_FALSE;
-
- /* check first face */
- img0 = texObj->Image[0][baseLevel];
- if (!img0 ||
- img0->Width < 1 ||
- img0->Width != img0->Height)
- return GL_FALSE;
-
- /* check remaining faces vs. first face */
- for (face = 1; face < 6; face++) {
- img = texObj->Image[face][baseLevel];
- if (!img ||
- img->Width != img0->Width ||
- img->Height != img0->Height ||
- img->TexFormat != img0->TexFormat)
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Mark a texture object dirty. It forces the object to be incomplete
- * and optionally forces the context to re-validate its state.
- *
- * \param ctx GL context.
- * \param texObj texture object.
- * \param invalidate_state also invalidate context state.
- */
-void
-_mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
- GLboolean invalidate_state)
-{
- texObj->_Complete = GL_FALSE;
- if (invalidate_state)
- ctx->NewState |= _NEW_TEXTURE;
-}
-
-
-/**
- * Return pointer to a default/fallback texture.
- * The texture is a 2D 8x8 RGBA texture with all texels = (0,0,0,1).
- * That's the value a sampler should get when sampling from an
- * incomplete texture.
- */
-struct gl_texture_object *
-_mesa_get_fallback_texture(struct gl_context *ctx)
-{
- if (!ctx->Shared->FallbackTex) {
- /* create fallback texture now */
- static GLubyte texels[8 * 8][4];
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- gl_format texFormat;
- GLuint i;
-
- for (i = 0; i < 8 * 8; i++) {
- texels[i][0] =
- texels[i][1] =
- texels[i][2] = 0x0;
- texels[i][3] = 0xff;
- }
-
- /* create texture object */
- texObj = ctx->Driver.NewTextureObject(ctx, 0, GL_TEXTURE_2D);
- assert(texObj->RefCount == 1);
- texObj->MinFilter = GL_NEAREST;
- texObj->MagFilter = GL_NEAREST;
-
- /* create level[0] texture image */
- texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, 0);
-
- texFormat = ctx->Driver.ChooseTextureFormat(ctx, GL_RGBA, GL_RGBA,
- GL_UNSIGNED_BYTE);
-
- /* init the image fields */
- _mesa_init_teximage_fields(ctx, GL_TEXTURE_2D, texImage,
- 8, 8, 1, 0, GL_RGBA, texFormat);
-
- ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
-
- /* set image data */
- ctx->Driver.TexImage2D(ctx, GL_TEXTURE_2D, 0, GL_RGBA,
- 8, 8, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, texels,
- &ctx->DefaultPacking, texObj, texImage);
-
- _mesa_test_texobj_completeness(ctx, texObj);
- assert(texObj->_Complete);
-
- ctx->Shared->FallbackTex = texObj;
- }
- return ctx->Shared->FallbackTex;
-}
-
-
-/*@}*/
-
-
-/***********************************************************************/
-/** \name API functions */
-/*@{*/
-
-
-/**
- * Generate texture names.
- *
- * \param n number of texture names to be generated.
- * \param textures an array in which will hold the generated texture names.
- *
- * \sa glGenTextures().
- *
- * Calls _mesa_HashFindFreeKeyBlock() to find a block of free texture
- * IDs which are stored in \p textures. Corresponding empty texture
- * objects are also generated.
- */
-void GLAPIENTRY
-_mesa_GenTextures( GLsizei n, GLuint *textures )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint first;
- GLint i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (n < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glGenTextures" );
- return;
- }
-
- if (!textures)
- return;
-
- /*
- * This must be atomic (generation and allocation of texture IDs)
- */
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
-
- first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n);
-
- /* Allocate new, empty texture objects */
- for (i = 0; i < n; i++) {
- struct gl_texture_object *texObj;
- GLuint name = first + i;
- GLenum target = 0;
- texObj = (*ctx->Driver.NewTextureObject)( ctx, name, target);
- if (!texObj) {
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures");
- return;
- }
-
- /* insert into hash table */
- _mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj);
-
- textures[i] = name;
- }
-
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-}
-
-
-/**
- * Check if the given texture object is bound to the current draw or
- * read framebuffer. If so, Unbind it.
- */
-static void
-unbind_texobj_from_fbo(struct gl_context *ctx,
- struct gl_texture_object *texObj)
-{
- const GLuint n = (ctx->DrawBuffer == ctx->ReadBuffer) ? 1 : 2;
- GLuint i;
-
- for (i = 0; i < n; i++) {
- struct gl_framebuffer *fb = (i == 0) ? ctx->DrawBuffer : ctx->ReadBuffer;
- if (fb->Name) {
- GLuint j;
- for (j = 0; j < BUFFER_COUNT; j++) {
- if (fb->Attachment[j].Type == GL_TEXTURE &&
- fb->Attachment[j].Texture == texObj) {
- _mesa_remove_attachment(ctx, fb->Attachment + j);
- }
- }
- }
- }
-}
-
-
-/**
- * Check if the given texture object is bound to any texture image units and
- * unbind it if so (revert to default textures).
- */
-static void
-unbind_texobj_from_texunits(struct gl_context *ctx,
- struct gl_texture_object *texObj)
-{
- GLuint u, tex;
-
- for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) {
- struct gl_texture_unit *unit = &ctx->Texture.Unit[u];
- for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
- if (texObj == unit->CurrentTex[tex]) {
- _mesa_reference_texobj(&unit->CurrentTex[tex],
- ctx->Shared->DefaultTex[tex]);
- ASSERT(unit->CurrentTex[tex]);
- break;
- }
- }
- }
-}
-
-
-/**
- * Delete named textures.
- *
- * \param n number of textures to be deleted.
- * \param textures array of texture IDs to be deleted.
- *
- * \sa glDeleteTextures().
- *
- * If we're about to delete a texture that's currently bound to any
- * texture unit, unbind the texture first. Decrement the reference
- * count on the texture object and delete it if it's zero.
- * Recall that texture objects can be shared among several rendering
- * contexts.
- */
-void GLAPIENTRY
-_mesa_DeleteTextures( GLsizei n, const GLuint *textures)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
-
- if (!textures)
- return;
-
- for (i = 0; i < n; i++) {
- if (textures[i] > 0) {
- struct gl_texture_object *delObj
- = _mesa_lookup_texture(ctx, textures[i]);
-
- if (delObj) {
- _mesa_lock_texture(ctx, delObj);
-
- /* Check if texture is bound to any framebuffer objects.
- * If so, unbind.
- * See section 4.4.2.3 of GL_EXT_framebuffer_object.
- */
- unbind_texobj_from_fbo(ctx, delObj);
-
- /* Check if this texture is currently bound to any texture units.
- * If so, unbind it.
- */
- unbind_texobj_from_texunits(ctx, delObj);
-
- _mesa_unlock_texture(ctx, delObj);
-
- ctx->NewState |= _NEW_TEXTURE;
-
- /* The texture _name_ is now free for re-use.
- * Remove it from the hash table now.
- */
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
- _mesa_HashRemove(ctx->Shared->TexObjects, delObj->Name);
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-
- /* Unreference the texobj. If refcount hits zero, the texture
- * will be deleted.
- */
- _mesa_reference_texobj(&delObj, NULL);
- }
- }
- }
-}
-
-
-/**
- * Convert a GL texture target enum such as GL_TEXTURE_2D or GL_TEXTURE_3D
- * into the corresponding Mesa texture target index.
- * Note that proxy targets are not valid here.
- * \return TEXTURE_x_INDEX or -1 if target is invalid
- */
-static GLint
-target_enum_to_index(GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_1D:
- return TEXTURE_1D_INDEX;
- case GL_TEXTURE_2D:
- return TEXTURE_2D_INDEX;
- case GL_TEXTURE_3D:
- return TEXTURE_3D_INDEX;
- case GL_TEXTURE_CUBE_MAP_ARB:
- return TEXTURE_CUBE_INDEX;
- case GL_TEXTURE_RECTANGLE_NV:
- return TEXTURE_RECT_INDEX;
- case GL_TEXTURE_1D_ARRAY_EXT:
- return TEXTURE_1D_ARRAY_INDEX;
- case GL_TEXTURE_2D_ARRAY_EXT:
- return TEXTURE_2D_ARRAY_INDEX;
- default:
- return -1;
- }
-}
-
-
-/**
- * Bind a named texture to a texturing target.
- *
- * \param target texture target.
- * \param texName texture name.
- *
- * \sa glBindTexture().
- *
- * Determines the old texture object bound and returns immediately if rebinding
- * the same texture. Get the current texture which is either a default texture
- * if name is null, a named texture from the hash, or a new texture if the
- * given texture name is new. Increments its reference count, binds it, and
- * calls dd_function_table::BindTexture. Decrements the old texture reference
- * count and deletes it if it reaches zero.
- */
-void GLAPIENTRY
-_mesa_BindTexture( GLenum target, GLuint texName )
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *newTexObj = NULL, *defaultTexObj = NULL;
- GLint targetIndex;
- GLboolean early_out = GL_FALSE;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glBindTexture %s %d\n",
- _mesa_lookup_enum_by_nr(target), (GLint) texName);
-
- targetIndex = target_enum_to_index(target);
- if (targetIndex < 0) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)");
- return;
- }
- assert(targetIndex < NUM_TEXTURE_TARGETS);
- defaultTexObj = ctx->Shared->DefaultTex[targetIndex];
-
- /*
- * Get pointer to new texture object (newTexObj)
- */
- if (texName == 0) {
- newTexObj = defaultTexObj;
- }
- else {
- /* non-default texture object */
- newTexObj = _mesa_lookup_texture(ctx, texName);
- if (newTexObj) {
- /* error checking */
- if (newTexObj->Target != 0 && newTexObj->Target != target) {
- /* the named texture object's target doesn't match the given target */
- _mesa_error( ctx, GL_INVALID_OPERATION,
- "glBindTexture(target mismatch)" );
- return;
- }
- if (newTexObj->Target == 0) {
- finish_texture_init(ctx, target, newTexObj);
- }
- }
- else {
- /* if this is a new texture id, allocate a texture object now */
- newTexObj = (*ctx->Driver.NewTextureObject)(ctx, texName, target);
- if (!newTexObj) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
- return;
- }
-
- /* and insert it into hash table */
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
- _mesa_HashInsert(ctx->Shared->TexObjects, texName, newTexObj);
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
- }
- newTexObj->Target = target;
- }
-
- assert(valid_texture_object(newTexObj));
-
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
- if ((ctx->Shared->RefCount == 1)
- && (newTexObj == texUnit->CurrentTex[targetIndex])) {
- early_out = GL_TRUE;
- }
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-
- if (early_out) {
- return;
- }
-
- /* flush before changing binding */
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-
- /* Do the actual binding. The refcount on the previously bound
- * texture object will be decremented. It'll be deleted if the
- * count hits zero.
- */
- _mesa_reference_texobj(&texUnit->CurrentTex[targetIndex], newTexObj);
- ASSERT(texUnit->CurrentTex[targetIndex]);
-
- /* Pass BindTexture call to device driver */
- if (ctx->Driver.BindTexture)
- (*ctx->Driver.BindTexture)( ctx, target, newTexObj );
-}
-
-
-/**
- * Set texture priorities.
- *
- * \param n number of textures.
- * \param texName texture names.
- * \param priorities corresponding texture priorities.
- *
- * \sa glPrioritizeTextures().
- *
- * Looks up each texture in the hash, clamps the corresponding priority between
- * 0.0 and 1.0, and calls dd_function_table::PrioritizeTexture.
- */
-void GLAPIENTRY
-_mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
- const GLclampf *priorities )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (n < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" );
- return;
- }
-
- if (!priorities)
- return;
-
- for (i = 0; i < n; i++) {
- if (texName[i] > 0) {
- struct gl_texture_object *t = _mesa_lookup_texture(ctx, texName[i]);
- if (t) {
- t->Priority = CLAMP( priorities[i], 0.0F, 1.0F );
- }
- }
- }
-
- ctx->NewState |= _NEW_TEXTURE;
-}
-
-
-
-/**
- * See if textures are loaded in texture memory.
- *
- * \param n number of textures to query.
- * \param texName array with the texture names.
- * \param residences array which will hold the residence status.
- *
- * \return GL_TRUE if all textures are resident and \p residences is left unchanged,
- *
- * \sa glAreTexturesResident().
- *
- * Looks up each texture in the hash and calls
- * dd_function_table::IsTextureResident.
- */
-GLboolean GLAPIENTRY
-_mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
- GLboolean *residences)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLboolean allResident = GL_TRUE;
- GLint i, j;
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
-
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)");
- return GL_FALSE;
- }
-
- if (!texName || !residences)
- return GL_FALSE;
-
- for (i = 0; i < n; i++) {
- struct gl_texture_object *t;
- if (texName[i] == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident");
- return GL_FALSE;
- }
- t = _mesa_lookup_texture(ctx, texName[i]);
- if (!t) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident");
- return GL_FALSE;
- }
- if (!ctx->Driver.IsTextureResident ||
- ctx->Driver.IsTextureResident(ctx, t)) {
- /* The texture is resident */
- if (!allResident)
- residences[i] = GL_TRUE;
- }
- else {
- /* The texture is not resident */
- if (allResident) {
- allResident = GL_FALSE;
- for (j = 0; j < i; j++)
- residences[j] = GL_TRUE;
- }
- residences[i] = GL_FALSE;
- }
- }
-
- return allResident;
-}
-
-
-/**
- * See if a name corresponds to a texture.
- *
- * \param texture texture name.
- *
- * \return GL_TRUE if texture name corresponds to a texture, or GL_FALSE
- * otherwise.
- *
- * \sa glIsTexture().
- *
- * Calls _mesa_HashLookup().
- */
-GLboolean GLAPIENTRY
-_mesa_IsTexture( GLuint texture )
-{
- struct gl_texture_object *t;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
-
- if (!texture)
- return GL_FALSE;
-
- t = _mesa_lookup_texture(ctx, texture);
-
- /* IsTexture is true only after object has been bound once. */
- return t && t->Target;
-}
-
-
-/**
- * Simplest implementation of texture locking: grab the shared tex
- * mutex. Examine the shared context state timestamp and if there has
- * been a change, set the appropriate bits in ctx->NewState.
- *
- * This is used to deal with synchronizing things when a texture object
- * is used/modified by different contexts (or threads) which are sharing
- * the texture.
- *
- * See also _mesa_lock/unlock_texture() in teximage.h
- */
-void
-_mesa_lock_context_textures( struct gl_context *ctx )
-{
- _glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
-
- if (ctx->Shared->TextureStateStamp != ctx->TextureStateTimestamp) {
- ctx->NewState |= _NEW_TEXTURE;
- ctx->TextureStateTimestamp = ctx->Shared->TextureStateStamp;
- }
-}
-
-
-void
-_mesa_unlock_context_textures( struct gl_context *ctx )
-{
- assert(ctx->Shared->TextureStateStamp == ctx->TextureStateTimestamp);
- _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
-}
-
-/*@}*/
diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
deleted file mode 100644
index 2461b06..0000000
--- a/src/mesa/main/texobj.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * \file texobj.h
- * Texture object management.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * 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 TEXTOBJ_H
-#define TEXTOBJ_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-/**
- * \name Internal functions
- */
-/*@{*/
-
-extern struct gl_texture_object *
-_mesa_lookup_texture(struct gl_context *ctx, GLuint id);
-
-extern struct gl_texture_object *
-_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target );
-
-extern void
-_mesa_initialize_texture_object( struct gl_texture_object *obj,
- GLuint name, GLenum target );
-
-extern void
-_mesa_delete_texture_object( struct gl_context *ctx, struct gl_texture_object *obj );
-
-extern void
-_mesa_copy_texture_object( struct gl_texture_object *dest,
- const struct gl_texture_object *src );
-
-extern void
-_mesa_clear_texture_object(struct gl_context *ctx, struct gl_texture_object *obj);
-
-extern void
-_mesa_reference_texobj(struct gl_texture_object **ptr,
- struct gl_texture_object *tex);
-
-extern void
-_mesa_test_texobj_completeness( const struct gl_context *ctx,
- struct gl_texture_object *obj );
-
-extern GLboolean
-_mesa_cube_complete(const struct gl_texture_object *texObj);
-
-extern void
-_mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
- GLboolean invalidate_state);
-
-extern struct gl_texture_object *
-_mesa_get_fallback_texture(struct gl_context *ctx);
-
-extern void
-_mesa_unlock_context_textures( struct gl_context *ctx );
-
-extern void
-_mesa_lock_context_textures( struct gl_context *ctx );
-
-/*@}*/
-
-/**
- * \name API functions
- */
-/*@{*/
-
-extern void GLAPIENTRY
-_mesa_GenTextures( GLsizei n, GLuint *textures );
-
-
-extern void GLAPIENTRY
-_mesa_DeleteTextures( GLsizei n, const GLuint *textures );
-
-
-extern void GLAPIENTRY
-_mesa_BindTexture( GLenum target, GLuint texture );
-
-
-extern void GLAPIENTRY
-_mesa_PrioritizeTextures( GLsizei n, const GLuint *textures,
- const GLclampf *priorities );
-
-
-extern GLboolean GLAPIENTRY
-_mesa_AreTexturesResident( GLsizei n, const GLuint *textures,
- GLboolean *residences );
-
-extern GLboolean GLAPIENTRY
-_mesa_IsTexture( GLuint texture );
-
-/*@}*/
-
-
-#endif
diff --git a/src/mesa/main/texpal.c b/src/mesa/main/texpal.c
deleted file mode 100644
index a25e7aa..0000000
--- a/src/mesa/main/texpal.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/**************************************************************************
- *
- * 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/src/mesa/main/texpal.h b/src/mesa/main/texpal.h
deleted file mode 100644
index eeff5a9..0000000
--- a/src/mesa/main/texpal.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.8
- *
- * 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"),
- * 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 TEXPAL_H
-#define TEXPAL_H
-
-
-#include "main/glheader.h"
-extern void
-_mesa_cpal_compressed_teximage2d(GLenum target, GLint level,
- GLenum internalFormat,
- GLsizei width, GLsizei height,
- GLsizei imageSize, const void *palette);
-
-
-#endif /* TEXPAL_H */
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
deleted file mode 100644
index d5c83de..0000000
--- a/src/mesa/main/texparam.c
+++ /dev/null
@@ -1,1417 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-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 texparam.c
- *
- * glTexParameter-related functions
- */
-
-
-#include "main/glheader.h"
-#include "main/colormac.h"
-#include "main/context.h"
-#include "main/formats.h"
-#include "main/macros.h"
-#include "main/texcompress.h"
-#include "main/texparam.h"
-#include "main/teximage.h"
-#include "main/texstate.h"
-#include "program/prog_instruction.h"
-
-
-/**
- * Check if a coordinate wrap mode is supported for the texture target.
- * \return GL_TRUE if legal, GL_FALSE otherwise
- */
-static GLboolean
-validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap)
-{
- const struct gl_extensions * const e = & ctx->Extensions;
-
- if (wrap == GL_CLAMP || wrap == GL_CLAMP_TO_EDGE ||
- (wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) {
- /* any texture target */
- return GL_TRUE;
- }
- else if (target != GL_TEXTURE_RECTANGLE_NV &&
- (wrap == GL_REPEAT ||
- (wrap == GL_MIRRORED_REPEAT &&
- e->ARB_texture_mirrored_repeat) ||
- (wrap == GL_MIRROR_CLAMP_EXT &&
- (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
- (wrap == GL_MIRROR_CLAMP_TO_EDGE_EXT &&
- (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
- (wrap == GL_MIRROR_CLAMP_TO_BORDER_EXT &&
- (e->EXT_texture_mirror_clamp)))) {
- /* non-rectangle texture */
- return GL_TRUE;
- }
-
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)", wrap );
- return GL_FALSE;
-}
-
-
-/**
- * Get current texture object for given target.
- * Return NULL if any error (and record the error).
- * Note that this is different from _mesa_select_tex_object() in that proxy
- * targets are not accepted.
- * Only the glGetTexLevelParameter() functions accept proxy targets.
- */
-static struct gl_texture_object *
-get_texobj(struct gl_context *ctx, GLenum target, GLboolean get)
-{
- struct gl_texture_unit *texUnit;
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxCombinedTextureImageUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "gl%sTexParameter(current unit)", get ? "Get" : "");
- return NULL;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- switch (target) {
- case GL_TEXTURE_1D:
- return texUnit->CurrentTex[TEXTURE_1D_INDEX];
- case GL_TEXTURE_2D:
- return texUnit->CurrentTex[TEXTURE_2D_INDEX];
- case GL_TEXTURE_3D:
- return texUnit->CurrentTex[TEXTURE_3D_INDEX];
- case GL_TEXTURE_CUBE_MAP:
- if (ctx->Extensions.ARB_texture_cube_map) {
- return texUnit->CurrentTex[TEXTURE_CUBE_INDEX];
- }
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- if (ctx->Extensions.NV_texture_rectangle) {
- return texUnit->CurrentTex[TEXTURE_RECT_INDEX];
- }
- break;
- case GL_TEXTURE_1D_ARRAY_EXT:
- if (ctx->Extensions.MESA_texture_array) {
- return texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX];
- }
- break;
- case GL_TEXTURE_2D_ARRAY_EXT:
- if (ctx->Extensions.MESA_texture_array) {
- return texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX];
- }
- break;
- default:
- ;
- }
-
- _mesa_error(ctx, GL_INVALID_ENUM,
- "gl%sTexParameter(target)", get ? "Get" : "");
- return NULL;
-}
-
-
-/**
- * Convert GL_RED/GREEN/BLUE/ALPHA/ZERO/ONE to SWIZZLE_X/Y/Z/W/ZERO/ONE.
- * \return -1 if error.
- */
-static GLint
-comp_to_swizzle(GLenum comp)
-{
- switch (comp) {
- case GL_RED:
- return SWIZZLE_X;
- case GL_GREEN:
- return SWIZZLE_Y;
- case GL_BLUE:
- return SWIZZLE_Z;
- case GL_ALPHA:
- return SWIZZLE_W;
- case GL_ZERO:
- return SWIZZLE_ZERO;
- case GL_ONE:
- return SWIZZLE_ONE;
- default:
- return -1;
- }
-}
-
-
-static void
-set_swizzle_component(GLuint *swizzle, GLuint comp, GLuint swz)
-{
- ASSERT(comp < 4);
- ASSERT(swz <= SWIZZLE_NIL);
- {
- GLuint mask = 0x7 << (3 * comp);
- GLuint s = (*swizzle & ~mask) | (swz << (3 * comp));
- *swizzle = s;
- }
-}
-
-
-/**
- * This is called just prior to changing any texture object state.
- * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE
- * state flag and then mark the texture object as 'incomplete' so that any
- * per-texture derived state gets recomputed.
- */
-static INLINE void
-flush(struct gl_context *ctx, struct gl_texture_object *texObj)
-{
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->_Complete = GL_FALSE;
-}
-
-
-/**
- * Set an integer-valued texture parameter
- * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
- */
-static GLboolean
-set_tex_parameteri(struct gl_context *ctx,
- struct gl_texture_object *texObj,
- GLenum pname, const GLint *params)
-{
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- if (texObj->MinFilter == params[0])
- return GL_FALSE;
- switch (params[0]) {
- case GL_NEAREST:
- case GL_LINEAR:
- flush(ctx, texObj);
- texObj->MinFilter = params[0];
- return GL_TRUE;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
- flush(ctx, texObj);
- texObj->MinFilter = params[0];
- return GL_TRUE;
- }
- /* fall-through */
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)",
- params[0] );
- }
- return GL_FALSE;
-
- case GL_TEXTURE_MAG_FILTER:
- if (texObj->MagFilter == params[0])
- return GL_FALSE;
- switch (params[0]) {
- case GL_NEAREST:
- case GL_LINEAR:
- flush(ctx, texObj);
- texObj->MagFilter = params[0];
- return GL_TRUE;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)",
- params[0]);
- }
- return GL_FALSE;
-
- case GL_TEXTURE_WRAP_S:
- if (texObj->WrapS == params[0])
- return GL_FALSE;
- if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
- flush(ctx, texObj);
- texObj->WrapS = params[0];
- return GL_TRUE;
- }
- return GL_FALSE;
-
- case GL_TEXTURE_WRAP_T:
- if (texObj->WrapT == params[0])
- return GL_FALSE;
- if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
- flush(ctx, texObj);
- texObj->WrapT = params[0];
- return GL_TRUE;
- }
- return GL_FALSE;
-
- case GL_TEXTURE_WRAP_R:
- if (texObj->WrapR == params[0])
- return GL_FALSE;
- if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
- flush(ctx, texObj);
- texObj->WrapR = params[0];
- return GL_TRUE;
- }
- return GL_FALSE;
-
- case GL_TEXTURE_BASE_LEVEL:
- if (texObj->BaseLevel == params[0])
- return GL_FALSE;
- if (params[0] < 0 ||
- (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexParameter(param=%d)", params[0]);
- return GL_FALSE;
- }
- flush(ctx, texObj);
- texObj->BaseLevel = params[0];
- return GL_TRUE;
-
- case GL_TEXTURE_MAX_LEVEL:
- if (texObj->MaxLevel == params[0])
- return GL_FALSE;
- if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexParameter(param=%d)", params[0]);
- return GL_FALSE;
- }
- flush(ctx, texObj);
- texObj->MaxLevel = params[0];
- return GL_TRUE;
-
- case GL_GENERATE_MIPMAP_SGIS:
- if (texObj->GenerateMipmap != params[0]) {
- flush(ctx, texObj);
- texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
- return GL_TRUE;
- }
- return GL_FALSE;
-
- case GL_TEXTURE_COMPARE_MODE_ARB:
- if (ctx->Extensions.ARB_shadow &&
- (params[0] == GL_NONE ||
- params[0] == GL_COMPARE_R_TO_TEXTURE_ARB)) {
- if (texObj->CompareMode != params[0]) {
- flush(ctx, texObj);
- texObj->CompareMode = params[0];
- return GL_TRUE;
- }
- return GL_FALSE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(GL_TEXTURE_COMPARE_MODE_ARB)");
- }
- return GL_FALSE;
-
- case GL_TEXTURE_COMPARE_FUNC_ARB:
- if (ctx->Extensions.ARB_shadow) {
- if (texObj->CompareFunc == params[0])
- return GL_FALSE;
- switch (params[0]) {
- case GL_LEQUAL:
- case GL_GEQUAL:
- flush(ctx, texObj);
- texObj->CompareFunc = params[0];
- return GL_TRUE;
- case GL_EQUAL:
- case GL_NOTEQUAL:
- case GL_LESS:
- case GL_GREATER:
- case GL_ALWAYS:
- case GL_NEVER:
- if (ctx->Extensions.EXT_shadow_funcs) {
- flush(ctx, texObj);
- texObj->CompareFunc = params[0];
- return GL_TRUE;
- }
- /* fall-through */
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(GL_TEXTURE_COMPARE_FUNC_ARB)");
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
- }
- return GL_FALSE;
-
- case GL_DEPTH_TEXTURE_MODE_ARB:
- if (ctx->Extensions.ARB_depth_texture &&
- (params[0] == GL_LUMINANCE ||
- params[0] == GL_INTENSITY ||
- params[0] == GL_ALPHA ||
- (ctx->Extensions.ARB_texture_rg && params[0] == GL_RED))) {
- if (texObj->DepthMode != params[0]) {
- flush(ctx, texObj);
- texObj->DepthMode = params[0];
- return GL_TRUE;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(GL_DEPTH_TEXTURE_MODE_ARB)");
- }
- return GL_FALSE;
-
-#if FEATURE_OES_draw_texture
- case GL_TEXTURE_CROP_RECT_OES:
- texObj->CropRect[0] = params[0];
- texObj->CropRect[1] = params[1];
- texObj->CropRect[2] = params[2];
- texObj->CropRect[3] = params[3];
- return GL_TRUE;
-#endif
-
- case GL_TEXTURE_SWIZZLE_R_EXT:
- case GL_TEXTURE_SWIZZLE_G_EXT:
- case GL_TEXTURE_SWIZZLE_B_EXT:
- case GL_TEXTURE_SWIZZLE_A_EXT:
- if (ctx->Extensions.EXT_texture_swizzle) {
- const GLuint comp = pname - GL_TEXTURE_SWIZZLE_R_EXT;
- const GLint swz = comp_to_swizzle(params[0]);
- if (swz < 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexParameter(swizzle 0x%x)", params[0]);
- return GL_FALSE;
- }
- ASSERT(comp < 4);
- if (swz >= 0) {
- flush(ctx, texObj);
- texObj->Swizzle[comp] = params[0];
- set_swizzle_component(&texObj->_Swizzle, comp, swz);
- return GL_TRUE;
- }
- }
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
- return GL_FALSE;
-
- case GL_TEXTURE_SWIZZLE_RGBA_EXT:
- if (ctx->Extensions.EXT_texture_swizzle) {
- GLuint comp;
- flush(ctx, texObj);
- for (comp = 0; comp < 4; comp++) {
- const GLint swz = comp_to_swizzle(params[comp]);
- if (swz >= 0) {
- texObj->Swizzle[comp] = params[comp];
- set_swizzle_component(&texObj->_Swizzle, comp, swz);
- }
- else {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexParameter(swizzle 0x%x)", params[comp]);
- return GL_FALSE;
- }
- }
- return GL_TRUE;
- }
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
- return GL_FALSE;
-
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
- }
- return GL_FALSE;
-}
-
-
-/**
- * Set a float-valued texture parameter
- * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
- */
-static GLboolean
-set_tex_parameterf(struct gl_context *ctx,
- struct gl_texture_object *texObj,
- GLenum pname, const GLfloat *params)
-{
- switch (pname) {
- case GL_TEXTURE_MIN_LOD:
- if (texObj->MinLod == params[0])
- return GL_FALSE;
- flush(ctx, texObj);
- texObj->MinLod = params[0];
- return GL_TRUE;
-
- case GL_TEXTURE_MAX_LOD:
- if (texObj->MaxLod == params[0])
- return GL_FALSE;
- flush(ctx, texObj);
- texObj->MaxLod = params[0];
- return GL_TRUE;
-
- case GL_TEXTURE_PRIORITY:
- flush(ctx, texObj);
- texObj->Priority = CLAMP(params[0], 0.0F, 1.0F);
- return GL_TRUE;
-
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (ctx->Extensions.EXT_texture_filter_anisotropic) {
- if (texObj->MaxAnisotropy == params[0])
- return GL_FALSE;
- if (params[0] < 1.0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
- return GL_FALSE;
- }
- flush(ctx, texObj);
- /* clamp to max, that's what NVIDIA does */
- texObj->MaxAnisotropy = MIN2(params[0],
- ctx->Const.MaxTextureMaxAnisotropy);
- return GL_TRUE;
- }
- else {
- static GLuint count = 0;
- if (count++ < 10)
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
- }
- return GL_FALSE;
-
- case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
- if (ctx->Extensions.ARB_shadow_ambient) {
- if (texObj->CompareFailValue != params[0]) {
- flush(ctx, texObj);
- texObj->CompareFailValue = CLAMP(params[0], 0.0F, 1.0F);
- return GL_TRUE;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)");
- }
- return GL_FALSE;
-
- case GL_TEXTURE_LOD_BIAS:
- /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
- if (ctx->Extensions.EXT_texture_lod_bias) {
- if (texObj->LodBias != params[0]) {
- flush(ctx, texObj);
- texObj->LodBias = params[0];
- return GL_TRUE;
- }
- return GL_FALSE;
- }
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- flush(ctx, texObj);
- texObj->BorderColor.f[RCOMP] = params[0];
- texObj->BorderColor.f[GCOMP] = params[1];
- texObj->BorderColor.f[BCOMP] = params[2];
- texObj->BorderColor.f[ACOMP] = params[3];
- return GL_TRUE;
-
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
- }
- return GL_FALSE;
-}
-
-
-void GLAPIENTRY
-_mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- GLboolean need_update;
- struct gl_texture_object *texObj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- texObj = get_texobj(ctx, target, GL_FALSE);
- if (!texObj)
- return;
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_GENERATE_MIPMAP_SGIS:
- case GL_TEXTURE_COMPARE_MODE_ARB:
- case GL_TEXTURE_COMPARE_FUNC_ARB:
- case GL_DEPTH_TEXTURE_MODE_ARB:
- {
- /* convert float param to int */
- GLint p[4];
- p[0] = (GLint) param;
- p[1] = p[2] = p[3] = 0;
- need_update = set_tex_parameteri(ctx, texObj, pname, p);
- }
- break;
- default:
- {
- /* this will generate an error if pname is illegal */
- GLfloat p[4];
- p[0] = param;
- p[1] = p[2] = p[3] = 0.0F;
- need_update = set_tex_parameterf(ctx, texObj, pname, p);
- }
- }
-
- if (ctx->Driver.TexParameter && need_update) {
- ctx->Driver.TexParameter(ctx, target, texObj, pname, &param);
- }
-}
-
-
-void GLAPIENTRY
-_mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- GLboolean need_update;
- struct gl_texture_object *texObj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- texObj = get_texobj(ctx, target, GL_FALSE);
- if (!texObj)
- return;
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_GENERATE_MIPMAP_SGIS:
- case GL_TEXTURE_COMPARE_MODE_ARB:
- case GL_TEXTURE_COMPARE_FUNC_ARB:
- case GL_DEPTH_TEXTURE_MODE_ARB:
- {
- /* convert float param to int */
- GLint p[4];
- p[0] = (GLint) params[0];
- p[1] = p[2] = p[3] = 0;
- need_update = set_tex_parameteri(ctx, texObj, pname, p);
- }
- break;
-
-#if FEATURE_OES_draw_texture
- case GL_TEXTURE_CROP_RECT_OES:
- {
- /* convert float params to int */
- GLint iparams[4];
- iparams[0] = (GLint) params[0];
- iparams[1] = (GLint) params[1];
- iparams[2] = (GLint) params[2];
- iparams[3] = (GLint) params[3];
- need_update = set_tex_parameteri(ctx, texObj, pname, iparams);
- }
- break;
-#endif
-
- default:
- /* this will generate an error if pname is illegal */
- need_update = set_tex_parameterf(ctx, texObj, pname, params);
- }
-
- if (ctx->Driver.TexParameter && need_update) {
- ctx->Driver.TexParameter(ctx, target, texObj, pname, params);
- }
-}
-
-
-void GLAPIENTRY
-_mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
-{
- GLboolean need_update;
- struct gl_texture_object *texObj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- texObj = get_texobj(ctx, target, GL_FALSE);
- if (!texObj)
- return;
-
- switch (pname) {
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- case GL_TEXTURE_PRIORITY:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- case GL_TEXTURE_LOD_BIAS:
- case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
- {
- GLfloat fparam[4];
- fparam[0] = (GLfloat) param;
- fparam[1] = fparam[2] = fparam[3] = 0.0F;
- /* convert int param to float */
- need_update = set_tex_parameterf(ctx, texObj, pname, fparam);
- }
- break;
- default:
- /* this will generate an error if pname is illegal */
- {
- GLint iparam[4];
- iparam[0] = param;
- iparam[1] = iparam[2] = iparam[3] = 0;
- need_update = set_tex_parameteri(ctx, texObj, pname, iparam);
- }
- }
-
- if (ctx->Driver.TexParameter && need_update) {
- GLfloat fparam = (GLfloat) param;
- ctx->Driver.TexParameter(ctx, target, texObj, pname, &fparam);
- }
-}
-
-
-void GLAPIENTRY
-_mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- GLboolean need_update;
- struct gl_texture_object *texObj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- texObj = get_texobj(ctx, target, GL_FALSE);
- if (!texObj)
- return;
-
- switch (pname) {
- case GL_TEXTURE_BORDER_COLOR:
- {
- /* convert int params to float */
- GLfloat fparams[4];
- fparams[0] = INT_TO_FLOAT(params[0]);
- fparams[1] = INT_TO_FLOAT(params[1]);
- fparams[2] = INT_TO_FLOAT(params[2]);
- fparams[3] = INT_TO_FLOAT(params[3]);
- need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
- }
- break;
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- case GL_TEXTURE_PRIORITY:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- case GL_TEXTURE_LOD_BIAS:
- case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
- {
- /* convert int param to float */
- GLfloat fparams[4];
- fparams[0] = (GLfloat) params[0];
- fparams[1] = fparams[2] = fparams[3] = 0.0F;
- need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
- }
- break;
- default:
- /* this will generate an error if pname is illegal */
- need_update = set_tex_parameteri(ctx, texObj, pname, params);
- }
-
- if (ctx->Driver.TexParameter && need_update) {
- GLfloat fparams[4];
- fparams[0] = INT_TO_FLOAT(params[0]);
- if (pname == GL_TEXTURE_BORDER_COLOR ||
- pname == GL_TEXTURE_CROP_RECT_OES) {
- fparams[1] = INT_TO_FLOAT(params[1]);
- fparams[2] = INT_TO_FLOAT(params[2]);
- fparams[3] = INT_TO_FLOAT(params[3]);
- }
- ctx->Driver.TexParameter(ctx, target, texObj, pname, fparams);
- }
-}
-
-
-/**
- * Set tex parameter to integer value(s). Primarily intended to set
- * integer-valued texture border color (for integer-valued textures).
- * New in GL 3.0.
- */
-void GLAPIENTRY
-_mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- struct gl_texture_object *texObj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- texObj = get_texobj(ctx, target, GL_FALSE);
- if (!texObj)
- return;
-
- switch (pname) {
- case GL_TEXTURE_BORDER_COLOR:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- /* set the integer-valued border color */
- COPY_4V(texObj->BorderColor.i, params);
- break;
- default:
- _mesa_TexParameteriv(target, pname, params);
- break;
- }
- /* XXX no driver hook for TexParameterIiv() yet */
-}
-
-
-/**
- * Set tex parameter to unsigned integer value(s). Primarily intended to set
- * uint-valued texture border color (for integer-valued textures).
- * New in GL 3.0
- */
-void GLAPIENTRY
-_mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- struct gl_texture_object *texObj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- texObj = get_texobj(ctx, target, GL_FALSE);
- if (!texObj)
- return;
-
- switch (pname) {
- case GL_TEXTURE_BORDER_COLOR:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- /* set the unsigned integer-valued border color */
- COPY_4V(texObj->BorderColor.ui, params);
- break;
- default:
- _mesa_TexParameteriv(target, pname, (const GLint *) params);
- break;
- }
- /* XXX no driver hook for TexParameterIuiv() yet */
-}
-
-
-
-
-void GLAPIENTRY
-_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
- GLenum pname, GLfloat *params )
-{
- GLint iparam;
- _mesa_GetTexLevelParameteriv( target, level, pname, &iparam );
- *params = (GLfloat) iparam;
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
- GLenum pname, GLint *params )
-{
- const struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- const struct gl_texture_image *img = NULL;
- GLboolean isProxy;
- GLint maxLevels;
- gl_format texFormat;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxCombinedTextureImageUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTexLevelParameteriv(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- /* this will catch bad target values */
- maxLevels = _mesa_max_texture_levels(ctx, target);
- if (maxLevels == 0) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(target=0x%x)", target);
- return;
- }
-
- if (level < 0 || level >= maxLevels) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" );
- return;
- }
-
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- _mesa_lock_texture(ctx, texObj);
-
- img = _mesa_select_tex_image(ctx, texObj, target, level);
- if (!img || !img->TexFormat) {
- /* undefined texture image */
- if (pname == GL_TEXTURE_COMPONENTS)
- *params = 1;
- else
- *params = 0;
- goto out;
- }
-
- texFormat = img->TexFormat;
-
- isProxy = _mesa_is_proxy_texture(target);
-
- switch (pname) {
- case GL_TEXTURE_WIDTH:
- *params = img->Width;
- break;
- case GL_TEXTURE_HEIGHT:
- *params = img->Height;
- break;
- case GL_TEXTURE_DEPTH:
- *params = img->Depth;
- break;
- case GL_TEXTURE_INTERNAL_FORMAT:
- if (_mesa_is_format_compressed(img->TexFormat)) {
- /* need to return the actual compressed format */
- *params = _mesa_compressed_format_to_glenum(ctx, img->TexFormat);
- }
- else {
- /* return the user's requested internal format */
- *params = img->InternalFormat;
- }
- break;
- case GL_TEXTURE_BORDER:
- *params = img->Border;
- break;
- case GL_TEXTURE_RED_SIZE:
- if (img->_BaseFormat == GL_RED) {
- *params = _mesa_get_format_bits(texFormat, pname);
- break;
- }
- /* FALLTHROUGH */
- case GL_TEXTURE_GREEN_SIZE:
- if (img->_BaseFormat == GL_RG) {
- *params = _mesa_get_format_bits(texFormat, pname);
- break;
- }
- /* FALLTHROUGH */
- case GL_TEXTURE_BLUE_SIZE:
- if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
- *params = _mesa_get_format_bits(texFormat, pname);
- else
- *params = 0;
- break;
- case GL_TEXTURE_ALPHA_SIZE:
- if (img->_BaseFormat == GL_ALPHA ||
- img->_BaseFormat == GL_LUMINANCE_ALPHA ||
- img->_BaseFormat == GL_RGBA)
- *params = _mesa_get_format_bits(texFormat, pname);
- else
- *params = 0;
- break;
- case GL_TEXTURE_INTENSITY_SIZE:
- if (img->_BaseFormat != GL_INTENSITY)
- *params = 0;
- else {
- *params = _mesa_get_format_bits(texFormat, pname);
- if (*params == 0) {
- /* intensity probably stored as rgb texture */
- *params = MIN2(_mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE),
- _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE));
- }
- }
- break;
- case GL_TEXTURE_LUMINANCE_SIZE:
- if (img->_BaseFormat != GL_LUMINANCE &&
- img->_BaseFormat != GL_LUMINANCE_ALPHA)
- *params = 0;
- else {
- *params = _mesa_get_format_bits(texFormat, pname);
- if (*params == 0) {
- /* luminance probably stored as rgb texture */
- *params = MIN2(_mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE),
- _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE));
- }
- }
- break;
- case GL_TEXTURE_INDEX_SIZE_EXT:
- if (img->_BaseFormat == GL_COLOR_INDEX)
- *params = _mesa_get_format_bits(texFormat, pname);
- else
- *params = 0;
- break;
- case GL_TEXTURE_DEPTH_SIZE_ARB:
- if (ctx->Extensions.ARB_depth_texture)
- *params = _mesa_get_format_bits(texFormat, pname);
- else
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- break;
- case GL_TEXTURE_STENCIL_SIZE_EXT:
- if (ctx->Extensions.EXT_packed_depth_stencil ||
- ctx->Extensions.ARB_framebuffer_object) {
- *params = _mesa_get_format_bits(texFormat, pname);
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "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:
- if (_mesa_is_format_compressed(img->TexFormat) && !isProxy) {
- *params = _mesa_format_image_size(texFormat, img->Width,
- img->Height, img->Depth);
- }
- else {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_COMPRESSED:
- *params = (GLint) _mesa_is_format_compressed(img->TexFormat);
- break;
-
- /* GL_ARB_texture_float */
- case GL_TEXTURE_RED_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_GREEN_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_BLUE_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_ALPHA_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_LUMINANCE_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_LUMINANCE_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_INTENSITY_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_INTENSITY_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_DEPTH_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE) ?
- _mesa_get_format_datatype(texFormat) : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
-
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
-
- out:
- _mesa_unlock_texture(ctx, texObj);
-}
-
-
-
-void GLAPIENTRY
-_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
-{
- struct gl_texture_object *obj;
- GLboolean error = GL_FALSE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- obj = get_texobj(ctx, target, GL_TRUE);
- if (!obj)
- return;
-
- _mesa_lock_texture(ctx, obj);
- switch (pname) {
- case GL_TEXTURE_MAG_FILTER:
- *params = ENUM_TO_FLOAT(obj->MagFilter);
- break;
- case GL_TEXTURE_MIN_FILTER:
- *params = ENUM_TO_FLOAT(obj->MinFilter);
- break;
- case GL_TEXTURE_WRAP_S:
- *params = ENUM_TO_FLOAT(obj->WrapS);
- break;
- case GL_TEXTURE_WRAP_T:
- *params = ENUM_TO_FLOAT(obj->WrapT);
- break;
- case GL_TEXTURE_WRAP_R:
- *params = ENUM_TO_FLOAT(obj->WrapR);
- break;
- case GL_TEXTURE_BORDER_COLOR:
- params[0] = CLAMP(obj->BorderColor.f[0], 0.0F, 1.0F);
- params[1] = CLAMP(obj->BorderColor.f[1], 0.0F, 1.0F);
- params[2] = CLAMP(obj->BorderColor.f[2], 0.0F, 1.0F);
- params[3] = CLAMP(obj->BorderColor.f[3], 0.0F, 1.0F);
- break;
- case GL_TEXTURE_RESIDENT:
- {
- GLboolean resident;
- if (ctx->Driver.IsTextureResident)
- resident = ctx->Driver.IsTextureResident(ctx, obj);
- else
- resident = GL_TRUE;
- *params = ENUM_TO_FLOAT(resident);
- }
- break;
- case GL_TEXTURE_PRIORITY:
- *params = obj->Priority;
- break;
- case GL_TEXTURE_MIN_LOD:
- *params = obj->MinLod;
- break;
- case GL_TEXTURE_MAX_LOD:
- *params = obj->MaxLod;
- break;
- case GL_TEXTURE_BASE_LEVEL:
- *params = (GLfloat) obj->BaseLevel;
- break;
- case GL_TEXTURE_MAX_LEVEL:
- *params = (GLfloat) obj->MaxLevel;
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (ctx->Extensions.EXT_texture_filter_anisotropic) {
- *params = obj->MaxAnisotropy;
- }
- else
- error = GL_TRUE;
- break;
- case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
- if (ctx->Extensions.ARB_shadow_ambient) {
- *params = obj->CompareFailValue;
- }
- else
- error = GL_TRUE;
- break;
- case GL_GENERATE_MIPMAP_SGIS:
- *params = (GLfloat) obj->GenerateMipmap;
- break;
- case GL_TEXTURE_COMPARE_MODE_ARB:
- if (ctx->Extensions.ARB_shadow) {
- *params = (GLfloat) obj->CompareMode;
- }
- else
- error = GL_TRUE;
- break;
- case GL_TEXTURE_COMPARE_FUNC_ARB:
- if (ctx->Extensions.ARB_shadow) {
- *params = (GLfloat) obj->CompareFunc;
- }
- else
- error = GL_TRUE;
- break;
- case GL_DEPTH_TEXTURE_MODE_ARB:
- if (ctx->Extensions.ARB_depth_texture) {
- *params = (GLfloat) obj->DepthMode;
- }
- else
- error = GL_TRUE;
- break;
- case GL_TEXTURE_LOD_BIAS:
- if (ctx->Extensions.EXT_texture_lod_bias) {
- *params = obj->LodBias;
- }
- else
- error = GL_TRUE;
- break;
-#if FEATURE_OES_draw_texture
- case GL_TEXTURE_CROP_RECT_OES:
- params[0] = obj->CropRect[0];
- params[1] = obj->CropRect[1];
- params[2] = obj->CropRect[2];
- params[3] = obj->CropRect[3];
- break;
-#endif
-
- case GL_TEXTURE_SWIZZLE_R_EXT:
- case GL_TEXTURE_SWIZZLE_G_EXT:
- case GL_TEXTURE_SWIZZLE_B_EXT:
- case GL_TEXTURE_SWIZZLE_A_EXT:
- if (ctx->Extensions.EXT_texture_swizzle) {
- GLuint comp = pname - GL_TEXTURE_SWIZZLE_R_EXT;
- *params = (GLfloat) obj->Swizzle[comp];
- }
- else {
- error = GL_TRUE;
- }
- break;
-
- case GL_TEXTURE_SWIZZLE_RGBA_EXT:
- if (ctx->Extensions.EXT_texture_swizzle) {
- GLuint comp;
- for (comp = 0; comp < 4; comp++) {
- params[comp] = (GLfloat) obj->Swizzle[comp];
- }
- }
- else {
- error = GL_TRUE;
- }
- break;
-
- default:
- error = GL_TRUE;
- break;
- }
-
- if (error)
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)",
- pname);
-
- _mesa_unlock_texture(ctx, obj);
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
-{
- struct gl_texture_object *obj;
- GLboolean error = GL_FALSE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- obj = get_texobj(ctx, target, GL_TRUE);
- if (!obj)
- return;
-
- _mesa_lock_texture(ctx, obj);
- switch (pname) {
- case GL_TEXTURE_MAG_FILTER:
- *params = (GLint) obj->MagFilter;
- break;;
- case GL_TEXTURE_MIN_FILTER:
- *params = (GLint) obj->MinFilter;
- break;;
- case GL_TEXTURE_WRAP_S:
- *params = (GLint) obj->WrapS;
- break;;
- case GL_TEXTURE_WRAP_T:
- *params = (GLint) obj->WrapT;
- break;;
- case GL_TEXTURE_WRAP_R:
- *params = (GLint) obj->WrapR;
- break;;
- case GL_TEXTURE_BORDER_COLOR:
- {
- GLfloat b[4];
- b[0] = CLAMP(obj->BorderColor.f[0], 0.0F, 1.0F);
- b[1] = CLAMP(obj->BorderColor.f[1], 0.0F, 1.0F);
- b[2] = CLAMP(obj->BorderColor.f[2], 0.0F, 1.0F);
- b[3] = CLAMP(obj->BorderColor.f[3], 0.0F, 1.0F);
- params[0] = FLOAT_TO_INT(b[0]);
- params[1] = FLOAT_TO_INT(b[1]);
- params[2] = FLOAT_TO_INT(b[2]);
- params[3] = FLOAT_TO_INT(b[3]);
- }
- break;;
- case GL_TEXTURE_RESIDENT:
- {
- GLboolean resident;
- if (ctx->Driver.IsTextureResident)
- resident = ctx->Driver.IsTextureResident(ctx, obj);
- else
- resident = GL_TRUE;
- *params = (GLint) resident;
- }
- break;;
- case GL_TEXTURE_PRIORITY:
- *params = FLOAT_TO_INT(obj->Priority);
- break;;
- case GL_TEXTURE_MIN_LOD:
- *params = (GLint) obj->MinLod;
- break;;
- case GL_TEXTURE_MAX_LOD:
- *params = (GLint) obj->MaxLod;
- break;;
- case GL_TEXTURE_BASE_LEVEL:
- *params = obj->BaseLevel;
- break;;
- case GL_TEXTURE_MAX_LEVEL:
- *params = obj->MaxLevel;
- break;;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (ctx->Extensions.EXT_texture_filter_anisotropic) {
- *params = (GLint) obj->MaxAnisotropy;
- }
- else {
- error = GL_TRUE;
- }
- break;
- case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
- if (ctx->Extensions.ARB_shadow_ambient) {
- *params = (GLint) FLOAT_TO_INT(obj->CompareFailValue);
- }
- else {
- error = GL_TRUE;
- }
- break;
- case GL_GENERATE_MIPMAP_SGIS:
- *params = (GLint) obj->GenerateMipmap;
- break;
- case GL_TEXTURE_COMPARE_MODE_ARB:
- if (ctx->Extensions.ARB_shadow) {
- *params = (GLint) obj->CompareMode;
- }
- else {
- error = GL_TRUE;
- }
- break;
- case GL_TEXTURE_COMPARE_FUNC_ARB:
- if (ctx->Extensions.ARB_shadow) {
- *params = (GLint) obj->CompareFunc;
- }
- else {
- error = GL_TRUE;
- }
- break;
- case GL_DEPTH_TEXTURE_MODE_ARB:
- if (ctx->Extensions.ARB_depth_texture) {
- *params = (GLint) obj->DepthMode;
- }
- else {
- error = GL_TRUE;
- }
- break;
- case GL_TEXTURE_LOD_BIAS:
- if (ctx->Extensions.EXT_texture_lod_bias) {
- *params = (GLint) obj->LodBias;
- }
- else {
- error = GL_TRUE;
- }
- break;
-#if FEATURE_OES_draw_texture
- case GL_TEXTURE_CROP_RECT_OES:
- params[0] = obj->CropRect[0];
- params[1] = obj->CropRect[1];
- params[2] = obj->CropRect[2];
- params[3] = obj->CropRect[3];
- break;
-#endif
- case GL_TEXTURE_SWIZZLE_R_EXT:
- case GL_TEXTURE_SWIZZLE_G_EXT:
- case GL_TEXTURE_SWIZZLE_B_EXT:
- case GL_TEXTURE_SWIZZLE_A_EXT:
- if (ctx->Extensions.EXT_texture_swizzle) {
- GLuint comp = pname - GL_TEXTURE_SWIZZLE_R_EXT;
- *params = obj->Swizzle[comp];
- }
- else {
- error = GL_TRUE;
- }
- break;
-
- case GL_TEXTURE_SWIZZLE_RGBA_EXT:
- if (ctx->Extensions.EXT_texture_swizzle) {
- COPY_4V(params, obj->Swizzle);
- }
- else {
- error = GL_TRUE;
- }
- break;
-
- default:
- ; /* silence warnings */
- }
-
- if (error)
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname=0x%x)",
- pname);
-
- _mesa_unlock_texture(ctx, obj);
-}
-
-
-/** New in GL 3.0 */
-void GLAPIENTRY
-_mesa_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- struct gl_texture_object *texObj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- texObj = get_texobj(ctx, target, GL_TRUE);
-
- switch (pname) {
- case GL_TEXTURE_BORDER_COLOR:
- COPY_4V(params, texObj->BorderColor.i);
- break;
- default:
- _mesa_GetTexParameteriv(target, pname, params);
- }
-}
-
-
-/** New in GL 3.0 */
-void GLAPIENTRY
-_mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- struct gl_texture_object *texObj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- texObj = get_texobj(ctx, target, GL_TRUE);
-
- switch (pname) {
- case GL_TEXTURE_BORDER_COLOR:
- COPY_4V(params, texObj->BorderColor.i);
- break;
- default:
- {
- GLint ip[4];
- _mesa_GetTexParameteriv(target, pname, ip);
- params[0] = ip[0];
- if (pname == GL_TEXTURE_SWIZZLE_RGBA_EXT ||
- pname == GL_TEXTURE_CROP_RECT_OES) {
- params[1] = ip[1];
- params[2] = ip[2];
- params[3] = ip[3];
- }
- }
- }
-}
diff --git a/src/mesa/main/texparam.h b/src/mesa/main/texparam.h
deleted file mode 100644
index 19b4116..0000000
--- a/src/mesa/main/texparam.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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 TEXPARAM_H
-#define TEXPARAM_H
-
-
-#include "main/glheader.h"
-
-
-extern void GLAPIENTRY
-_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
- GLenum pname, GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
- GLenum pname, GLint *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
-
-
-extern void GLAPIENTRY
-_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param );
-
-
-extern void GLAPIENTRY
-_mesa_TexParameteri( GLenum target, GLenum pname, GLint param );
-
-extern void GLAPIENTRY
-_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params );
-
-
-extern void GLAPIENTRY
-_mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params);
-
-extern void GLAPIENTRY
-_mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
-
-
-#endif /* TEXPARAM_H */
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c
deleted file mode 100644
index 8961b92..0000000
--- a/src/mesa/main/texrender.c
+++ /dev/null
@@ -1,635 +0,0 @@
-
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
-#include "texfetch.h"
-#include "texrender.h"
-#include "renderbuffer.h"
-
-
-/*
- * Render-to-texture code for GL_EXT_framebuffer_object
- */
-
-
-/**
- * Derived from gl_renderbuffer class
- */
-struct texture_renderbuffer
-{
- struct gl_renderbuffer Base; /**< Base class object */
- struct gl_texture_image *TexImage;
- StoreTexelFunc Store;
- GLint Yoffset; /**< Layer for 1D array textures. */
- GLint Zoffset; /**< Layer for 2D array textures, or slice
- * for 3D textures
- */
-};
-
-
-/**
- * Get row of values from the renderbuffer that wraps a texture image.
- */
-static void
-texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, void *values)
-{
- const struct texture_renderbuffer *trb
- = (const struct texture_renderbuffer *) rb;
- const GLint z = trb->Zoffset;
- GLuint i;
-
- ASSERT(trb->TexImage->Width == rb->Width);
- ASSERT(trb->TexImage->Height == rb->Height);
-
- y += trb->Yoffset;
-
- if (rb->DataType == CHAN_TYPE) {
- GLchan *rgbaOut = (GLchan *) values;
- for (i = 0; i < count; i++) {
- GLfloat rgba[4];
- trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, rgba);
- UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
- }
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- GLushort *zValues = (GLushort *) values;
- for (i = 0; i < count; i++) {
- GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
- zValues[i] = (GLushort) (flt * 0xffff);
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT) {
- GLuint *zValues = (GLuint *) values;
- /*
- const GLdouble scale = (GLdouble) 0xffffffff;
- */
- for (i = 0; i < count; i++) {
- GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
-#if 0
- /* this should work, but doesn't (overflow due to low precision) */
- zValues[i] = (GLuint) (flt * scale);
-#else
- /* temporary hack */
- zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
-#endif
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
- GLuint *zValues = (GLuint *) values;
- for (i = 0; i < count; i++) {
- GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
- zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
- GLuint *zValues = (GLuint *) values;
- for (i = 0; i < count; i++) {
- GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
- zValues[i] = (GLuint) (flt * 0xffffff);
- }
- }
- else {
- _mesa_problem(ctx, "invalid rb->DataType in texture_get_row");
- }
-}
-
-
-static void
-texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- const struct texture_renderbuffer *trb
- = (const struct texture_renderbuffer *) rb;
- const GLint z = trb->Zoffset;
- GLuint i;
-
- if (rb->DataType == CHAN_TYPE) {
- GLchan *rgbaOut = (GLchan *) values;
- for (i = 0; i < count; i++) {
- GLfloat rgba[4];
- trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
- z, rgba);
- UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
- }
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- GLushort *zValues = (GLushort *) values;
- for (i = 0; i < count; i++) {
- GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
- z, &flt);
- zValues[i] = (GLushort) (flt * 0xffff);
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT) {
- GLuint *zValues = (GLuint *) values;
- for (i = 0; i < count; i++) {
- GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
- z, &flt);
-#if 0
- zValues[i] = (GLuint) (flt * 0xffffffff);
-#else
- zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
-#endif
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
- GLuint *zValues = (GLuint *) values;
- for (i = 0; i < count; i++) {
- GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
- z, &flt);
- zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
- GLuint *zValues = (GLuint *) values;
- for (i = 0; i < count; i++) {
- GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
- z, &flt);
- zValues[i] = (GLuint) (flt * 0xffffff);
- }
- }
- else {
- _mesa_problem(ctx, "invalid rb->DataType in texture_get_values");
- }
-}
-
-
-/**
- * Put row of values into a renderbuffer that wraps a texture image.
- */
-static void
-texture_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- const struct texture_renderbuffer *trb
- = (const struct texture_renderbuffer *) rb;
- const GLint z = trb->Zoffset;
- GLuint i;
-
- y += trb->Yoffset;
-
- if (rb->DataType == CHAN_TYPE) {
- const GLchan *rgba = (const GLchan *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, rgba);
- }
- rgba += 4;
- }
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- const GLushort *zValues = (const GLushort *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, zValues + i);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT) {
- const GLuint *zValues = (const GLuint *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, zValues + i);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
- const GLuint *zValues = (const GLuint *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLfloat flt = (GLfloat) ((zValues[i] >> 8) * (1.0 / 0xffffff));
- trb->Store(trb->TexImage, x + i, y, z, &flt);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
- const GLuint *zValues = (const GLuint *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLfloat flt = (GLfloat) ((zValues[i] & 0xffffff) * (1.0 / 0xffffff));
- trb->Store(trb->TexImage, x + i, y, z, &flt);
- }
- }
- }
- else {
- _mesa_problem(ctx, "invalid rb->DataType in texture_put_row");
- }
-}
-
-/**
- * Put row of RGB values into a renderbuffer that wraps a texture image.
- */
-static void
-texture_put_row_rgb(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- const struct texture_renderbuffer *trb
- = (const struct texture_renderbuffer *) rb;
- const GLint z = trb->Zoffset;
- GLuint i;
-
- y += trb->Yoffset;
-
- if (rb->DataType == CHAN_TYPE) {
- const GLchan *rgb = (const GLchan *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, rgb);
- }
- rgb += 3;
- }
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- const GLushort *zValues = (const GLushort *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, zValues + i);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT) {
- const GLuint *zValues = (const GLuint *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, zValues + i);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
- const GLuint *zValues = (const GLuint *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLfloat flt = (GLfloat) ((zValues[i] >> 8) * (1.0 / 0xffffff));
- trb->Store(trb->TexImage, x + i, y, z, &flt);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
- const GLuint *zValues = (const GLuint *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLfloat flt = (GLfloat) ((zValues[i] & 0xffffff) * (1.0 / 0xffffff));
- trb->Store(trb->TexImage, x + i, y, z, &flt);
- }
- }
- }
- else {
- _mesa_problem(ctx, "invalid rb->DataType in texture_put_row");
- }
-}
-
-
-static void
-texture_put_mono_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- GLint x, GLint y, const void *value, const GLubyte *mask)
-{
- const struct texture_renderbuffer *trb
- = (const struct texture_renderbuffer *) rb;
- const GLint z = trb->Zoffset;
- GLuint i;
-
- y += trb->Yoffset;
-
- if (rb->DataType == CHAN_TYPE) {
- const GLchan *rgba = (const GLchan *) value;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, rgba);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- const GLushort zValue = *((const GLushort *) value);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, &zValue);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT) {
- const GLuint zValue = *((const GLuint *) value);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, &zValue);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
- const GLuint zValue = *((const GLuint *) value);
- const GLfloat flt = (GLfloat) ((zValue >> 8) * (1.0 / 0xffffff));
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, &flt);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
- const GLuint zValue = *((const GLuint *) value);
- const GLfloat flt = (GLfloat) ((zValue & 0xffffff) * (1.0 / 0xffffff));
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x + i, y, z, &flt);
- }
- }
- }
- else {
- _mesa_problem(ctx, "invalid rb->DataType in texture_put_mono_row");
- }
-}
-
-
-static void
-texture_put_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
- const GLint x[], const GLint y[], const void *values,
- const GLubyte *mask)
-{
- const struct texture_renderbuffer *trb
- = (const struct texture_renderbuffer *) rb;
- const GLint z = trb->Zoffset;
- GLuint i;
-
- if (rb->DataType == CHAN_TYPE) {
- const GLchan *rgba = (const GLchan *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, rgba);
- }
- rgba += 4;
- }
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- const GLushort *zValues = (const GLushort *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, zValues + i);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT) {
- const GLuint *zValues = (const GLuint *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, zValues + i);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
- const GLuint *zValues = (const GLuint *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLfloat flt = (GLfloat) ((zValues[i] >> 8) * (1.0 / 0xffffff));
- trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
- const GLuint *zValues = (const GLuint *) values;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLfloat flt = (GLfloat) ((zValues[i] & 0xffffff) * (1.0 / 0xffffff));
- trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt);
- }
- }
- }
- else {
- _mesa_problem(ctx, "invalid rb->DataType in texture_put_values");
- }
-}
-
-
-static void
-texture_put_mono_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, const GLint x[], const GLint y[],
- const void *value, const GLubyte *mask)
-{
- const struct texture_renderbuffer *trb
- = (const struct texture_renderbuffer *) rb;
- const GLint z = trb->Zoffset;
- GLuint i;
-
- if (rb->DataType == CHAN_TYPE) {
- const GLchan *rgba = (const GLchan *) value;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, rgba);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT) {
- const GLuint zValue = *((const GLuint *) value);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &zValue);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- const GLushort zValue = *((const GLushort *) value);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &zValue);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
- const GLuint zValue = *((const GLuint *) value);
- const GLfloat flt = (GLfloat) ((zValue >> 8) * (1.0 / 0xffffff));
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt);
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
- const GLuint zValue = *((const GLuint *) value);
- const GLfloat flt = (GLfloat) ((zValue & 0xffffff) * (1.0 / 0xffffff));
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt);
- }
- }
- }
- else {
- _mesa_problem(ctx, "invalid rb->DataType in texture_put_mono_values");
- }
-}
-
-
-static void
-store_nop(struct gl_texture_image *texImage,
- GLint col, GLint row, GLint img,
- const void *texel)
-{
-}
-
-
-static void
-delete_texture_wrapper(struct gl_renderbuffer *rb)
-{
- ASSERT(rb->RefCount == 0);
- free(rb);
-}
-
-
-/**
- * This function creates a renderbuffer object which wraps a texture image.
- * The new renderbuffer is plugged into the given attachment point.
- * This allows rendering into the texture as if it were a renderbuffer.
- */
-static void
-wrap_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
-{
- struct texture_renderbuffer *trb;
- const GLuint name = 0;
-
- ASSERT(att->Type == GL_TEXTURE);
- ASSERT(att->Renderbuffer == NULL);
-
- trb = CALLOC_STRUCT(texture_renderbuffer);
- if (!trb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "wrap_texture");
- return;
- }
-
- /* init base gl_renderbuffer fields */
- _mesa_init_renderbuffer(&trb->Base, name);
- /* plug in our texture_renderbuffer-specific functions */
- trb->Base.Delete = delete_texture_wrapper;
- trb->Base.AllocStorage = NULL; /* illegal! */
- trb->Base.GetRow = texture_get_row;
- trb->Base.GetValues = texture_get_values;
- trb->Base.PutRow = texture_put_row;
- trb->Base.PutRowRGB = texture_put_row_rgb;
- trb->Base.PutMonoRow = texture_put_mono_row;
- trb->Base.PutValues = texture_put_values;
- trb->Base.PutMonoValues = texture_put_mono_values;
-
- /* update attachment point */
- _mesa_reference_renderbuffer(&att->Renderbuffer, &(trb->Base));
-}
-
-
-
-/**
- * Update the renderbuffer wrapper for rendering to a texture.
- * For example, update the width, height of the RB based on the texture size,
- * update the internal format info, etc.
- */
-static void
-update_wrapper(struct gl_context *ctx, const struct gl_renderbuffer_attachment *att)
-{
- struct texture_renderbuffer *trb
- = (struct texture_renderbuffer *) att->Renderbuffer;
-
- (void) ctx;
- ASSERT(trb);
-
- trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
- ASSERT(trb->TexImage);
-
- trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat);
- if (!trb->Store) {
- /* we'll never draw into some textures (compressed formats) */
- trb->Store = store_nop;
- }
-
- if (att->Texture->Target == GL_TEXTURE_1D_ARRAY_EXT) {
- trb->Yoffset = att->Zoffset;
- trb->Zoffset = 0;
- }
- else {
- trb->Yoffset = 0;
- trb->Zoffset = att->Zoffset;
- }
-
- trb->Base.Width = trb->TexImage->Width;
- trb->Base.Height = trb->TexImage->Height;
- trb->Base.InternalFormat = trb->TexImage->InternalFormat;
- trb->Base.Format = trb->TexImage->TexFormat;
-
- /* XXX may need more special cases here */
- switch (trb->TexImage->TexFormat) {
- case MESA_FORMAT_Z24_S8:
- trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
- trb->Base._BaseFormat = GL_DEPTH_STENCIL;
- break;
- case MESA_FORMAT_S8_Z24:
- trb->Base.DataType = GL_UNSIGNED_INT_8_24_REV_MESA;
- trb->Base._BaseFormat = GL_DEPTH_STENCIL;
- break;
- case MESA_FORMAT_Z24_X8:
- trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
- trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- break;
- case MESA_FORMAT_X8_Z24:
- trb->Base.DataType = GL_UNSIGNED_INT_8_24_REV_MESA;
- trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- break;
- case MESA_FORMAT_Z16:
- trb->Base.DataType = GL_UNSIGNED_SHORT;
- trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- break;
- case MESA_FORMAT_Z32:
- trb->Base.DataType = GL_UNSIGNED_INT;
- trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- break;
- default:
- trb->Base.DataType = CHAN_TYPE;
- trb->Base._BaseFormat = GL_RGBA;
- }
- trb->Base.Data = trb->TexImage->Data;
-}
-
-
-
-/**
- * Called when rendering to a texture image begins, or when changing
- * the dest mipmap level, cube face, etc.
- * This is a fallback routine for software render-to-texture.
- *
- * Called via the glRenderbufferTexture1D/2D/3D() functions
- * and elsewhere (such as glTexImage2D).
- *
- * The image we're rendering into is
- * att->Texture->Image[att->CubeMapFace][att->TextureLevel];
- * It'll never be NULL.
- *
- * \param fb the framebuffer object the texture is being bound to
- * \param att the fb attachment point of the texture
- *
- * \sa _mesa_framebuffer_renderbuffer
- */
-void
-_mesa_render_texture(struct gl_context *ctx,
- struct gl_framebuffer *fb,
- struct gl_renderbuffer_attachment *att)
-{
- (void) fb;
-
- if (!att->Renderbuffer) {
- wrap_texture(ctx, att);
- }
- update_wrapper(ctx, att);
-}
-
-
-void
-_mesa_finish_render_texture(struct gl_context *ctx,
- struct gl_renderbuffer_attachment *att)
-{
- /* do nothing */
- /* The renderbuffer texture wrapper will get deleted by the
- * normal mechanism for deleting renderbuffers.
- */
- (void) ctx;
- (void) att;
-}
diff --git a/src/mesa/main/texrender.h b/src/mesa/main/texrender.h
deleted file mode 100644
index cacd091..0000000
--- a/src/mesa/main/texrender.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef TEXRENDER_H
-#define TEXRENDER_H
-
-struct gl_context;
-struct gl_framebuffer;
-struct gl_renderbuffer_attachment;
-
-extern void
-_mesa_render_texture(struct gl_context *ctx,
- struct gl_framebuffer *fb,
- struct gl_renderbuffer_attachment *att);
-
-extern void
-_mesa_finish_render_texture(struct gl_context *ctx,
- struct gl_renderbuffer_attachment *att);
-
-
-#endif /* TEXRENDER_H */
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
deleted file mode 100644
index f4d7718..0000000
--- a/src/mesa/main/texstate.c
+++ /dev/null
@@ -1,844 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * 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.
- */
-
-/**
- * \file texstate.c
- *
- * Texture state handling.
- */
-
-#include "glheader.h"
-#include "mfeatures.h"
-#include "colormac.h"
-#include "colortab.h"
-#include "context.h"
-#include "enums.h"
-#include "macros.h"
-#include "texobj.h"
-#include "teximage.h"
-#include "texstate.h"
-#include "mtypes.h"
-
-
-
-/**
- * Default texture combine environment state. This is used to initialize
- * a context's texture units and as the basis for converting "classic"
- * texture environmnets to ARB_texture_env_combine style values.
- */
-static const struct gl_tex_env_combine_state default_combine_state = {
- GL_MODULATE, GL_MODULATE,
- { GL_TEXTURE, GL_PREVIOUS, GL_CONSTANT, GL_CONSTANT },
- { GL_TEXTURE, GL_PREVIOUS, GL_CONSTANT, GL_CONSTANT },
- { GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_ALPHA, GL_SRC_ALPHA },
- { GL_SRC_ALPHA, GL_SRC_ALPHA, GL_SRC_ALPHA, GL_SRC_ALPHA },
- 0, 0,
- 2, 2
-};
-
-
-
-/**
- * Used by glXCopyContext to copy texture state from one context to another.
- */
-void
-_mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst )
-{
- GLuint u, tex;
-
- ASSERT(src);
- ASSERT(dst);
-
- dst->Texture.CurrentUnit = src->Texture.CurrentUnit;
- dst->Texture._GenFlags = src->Texture._GenFlags;
- dst->Texture._TexGenEnabled = src->Texture._TexGenEnabled;
- dst->Texture._TexMatEnabled = src->Texture._TexMatEnabled;
- dst->Texture.SharedPalette = src->Texture.SharedPalette;
-
- /* per-unit state */
- for (u = 0; u < src->Const.MaxCombinedTextureImageUnits; u++) {
- dst->Texture.Unit[u].Enabled = src->Texture.Unit[u].Enabled;
- dst->Texture.Unit[u].EnvMode = src->Texture.Unit[u].EnvMode;
- COPY_4V(dst->Texture.Unit[u].EnvColor, src->Texture.Unit[u].EnvColor);
- dst->Texture.Unit[u].TexGenEnabled = src->Texture.Unit[u].TexGenEnabled;
- dst->Texture.Unit[u].GenS = src->Texture.Unit[u].GenS;
- dst->Texture.Unit[u].GenT = src->Texture.Unit[u].GenT;
- dst->Texture.Unit[u].GenR = src->Texture.Unit[u].GenR;
- dst->Texture.Unit[u].GenQ = src->Texture.Unit[u].GenQ;
- dst->Texture.Unit[u].LodBias = src->Texture.Unit[u].LodBias;
-
- /* GL_EXT_texture_env_combine */
- dst->Texture.Unit[u].Combine = src->Texture.Unit[u].Combine;
-
- /* GL_ATI_envmap_bumpmap - need this? */
- dst->Texture.Unit[u].BumpTarget = src->Texture.Unit[u].BumpTarget;
- COPY_4V(dst->Texture.Unit[u].RotMatrix, src->Texture.Unit[u].RotMatrix);
-
- /*
- * XXX strictly speaking, we should compare texture names/ids and
- * bind textures in the dest context according to id. For now, only
- * copy bindings if the contexts share the same pool of textures to
- * avoid refcounting bugs.
- */
- if (dst->Shared == src->Shared) {
- /* copy texture object bindings, not contents of texture objects */
- _mesa_lock_context_textures(dst);
-
- for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
- _mesa_reference_texobj(&dst->Texture.Unit[u].CurrentTex[tex],
- src->Texture.Unit[u].CurrentTex[tex]);
- }
- _mesa_unlock_context_textures(dst);
- }
- }
-}
-
-
-/*
- * For debugging
- */
-void
-_mesa_print_texunit_state( struct gl_context *ctx, GLuint unit )
-{
- const struct gl_texture_unit *texUnit = ctx->Texture.Unit + unit;
- printf("Texture Unit %d\n", unit);
- printf(" GL_TEXTURE_ENV_MODE = %s\n", _mesa_lookup_enum_by_nr(texUnit->EnvMode));
- printf(" GL_COMBINE_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeRGB));
- printf(" GL_COMBINE_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeA));
- printf(" GL_SOURCE0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[0]));
- printf(" GL_SOURCE1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[1]));
- printf(" GL_SOURCE2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[2]));
- printf(" GL_SOURCE0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[0]));
- printf(" GL_SOURCE1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[1]));
- printf(" GL_SOURCE2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[2]));
- printf(" GL_OPERAND0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[0]));
- printf(" GL_OPERAND1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[1]));
- printf(" GL_OPERAND2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[2]));
- printf(" GL_OPERAND0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[0]));
- printf(" GL_OPERAND1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[1]));
- printf(" GL_OPERAND2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[2]));
- printf(" GL_RGB_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftRGB);
- printf(" GL_ALPHA_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftA);
- printf(" GL_TEXTURE_ENV_COLOR = (%f, %f, %f, %f)\n", texUnit->EnvColor[0], texUnit->EnvColor[1], texUnit->EnvColor[2], texUnit->EnvColor[3]);
-}
-
-
-
-/**********************************************************************/
-/* Texture Environment */
-/**********************************************************************/
-
-/**
- * Convert "classic" texture environment to ARB_texture_env_combine style
- * environments.
- *
- * \param state texture_env_combine state vector to be filled-in.
- * \param mode Classic texture environment mode (i.e., \c GL_REPLACE,
- * \c GL_BLEND, \c GL_DECAL, etc.).
- * \param texBaseFormat Base format of the texture associated with the
- * texture unit.
- */
-static void
-calculate_derived_texenv( struct gl_tex_env_combine_state *state,
- GLenum mode, GLenum texBaseFormat )
-{
- GLenum mode_rgb;
- GLenum mode_a;
-
- *state = default_combine_state;
-
- switch (texBaseFormat) {
- case GL_ALPHA:
- state->SourceRGB[0] = GL_PREVIOUS;
- break;
-
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- case GL_RGBA:
- break;
-
- case GL_LUMINANCE:
- case GL_RED:
- case GL_RG:
- case GL_RGB:
- case GL_YCBCR_MESA:
- case GL_DUDV_ATI:
- state->SourceA[0] = GL_PREVIOUS;
- break;
-
- default:
- _mesa_problem(NULL,
- "Invalid texBaseFormat 0x%x in calculate_derived_texenv",
- texBaseFormat);
- return;
- }
-
- if (mode == GL_REPLACE_EXT)
- mode = GL_REPLACE;
-
- switch (mode) {
- case GL_REPLACE:
- case GL_MODULATE:
- mode_rgb = (texBaseFormat == GL_ALPHA) ? GL_REPLACE : mode;
- mode_a = mode;
- break;
-
- case GL_DECAL:
- mode_rgb = GL_INTERPOLATE;
- mode_a = GL_REPLACE;
-
- state->SourceA[0] = GL_PREVIOUS;
-
- /* Having alpha / luminance / intensity textures replace using the
- * incoming fragment color matches the definition in NV_texture_shader.
- * The 1.5 spec simply marks these as "undefined".
- */
- switch (texBaseFormat) {
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- state->SourceRGB[0] = GL_PREVIOUS;
- break;
- case GL_RED:
- case GL_RG:
- case GL_RGB:
- case GL_YCBCR_MESA:
- case GL_DUDV_ATI:
- mode_rgb = GL_REPLACE;
- break;
- case GL_RGBA:
- state->SourceRGB[2] = GL_TEXTURE;
- break;
- }
- break;
-
- case GL_BLEND:
- mode_rgb = GL_INTERPOLATE;
- mode_a = GL_MODULATE;
-
- switch (texBaseFormat) {
- case GL_ALPHA:
- mode_rgb = GL_REPLACE;
- break;
- case GL_INTENSITY:
- mode_a = GL_INTERPOLATE;
- state->SourceA[0] = GL_CONSTANT;
- state->OperandA[2] = GL_SRC_ALPHA;
- /* FALLTHROUGH */
- case GL_LUMINANCE:
- case GL_RED:
- case GL_RG:
- case GL_RGB:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- case GL_YCBCR_MESA:
- case GL_DUDV_ATI:
- state->SourceRGB[2] = GL_TEXTURE;
- state->SourceA[2] = GL_TEXTURE;
- state->SourceRGB[0] = GL_CONSTANT;
- state->OperandRGB[2] = GL_SRC_COLOR;
- break;
- }
- break;
-
- case GL_ADD:
- mode_rgb = (texBaseFormat == GL_ALPHA) ? GL_REPLACE : GL_ADD;
- mode_a = (texBaseFormat == GL_INTENSITY) ? GL_ADD : GL_MODULATE;
- break;
-
- default:
- _mesa_problem(NULL,
- "Invalid texture env mode 0x%x in calculate_derived_texenv",
- mode);
- return;
- }
-
- state->ModeRGB = (state->SourceRGB[0] != GL_PREVIOUS)
- ? mode_rgb : GL_REPLACE;
- state->ModeA = (state->SourceA[0] != GL_PREVIOUS)
- ? mode_a : GL_REPLACE;
-}
-
-
-
-
-/* GL_ARB_multitexture */
-void GLAPIENTRY
-_mesa_ActiveTextureARB(GLenum texture)
-{
- const GLuint texUnit = texture - GL_TEXTURE0;
- GLuint k;
- GET_CURRENT_CONTEXT(ctx);
-
- /* See OpenGL spec for glActiveTexture: */
- k = MAX2(ctx->Const.MaxCombinedTextureImageUnits,
- ctx->Const.MaxTextureCoordUnits);
-
- ASSERT(k <= Elements(ctx->Texture.Unit));
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glActiveTexture %s\n",
- _mesa_lookup_enum_by_nr(texture));
-
- if (texUnit >= k) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture=%s)",
- _mesa_lookup_enum_by_nr(texture));
- return;
- }
-
- if (ctx->Texture.CurrentUnit == texUnit)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-
- ctx->Texture.CurrentUnit = texUnit;
- if (ctx->Transform.MatrixMode == GL_TEXTURE) {
- /* update current stack pointer */
- ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit];
- }
-}
-
-
-/* GL_ARB_multitexture */
-void GLAPIENTRY
-_mesa_ClientActiveTextureARB(GLenum texture)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint texUnit = texture - GL_TEXTURE0;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glClientActiveTexture %s\n",
- _mesa_lookup_enum_by_nr(texture));
-
- if (texUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(texture)");
- return;
- }
-
- if (ctx->Array.ActiveTexture == texUnit)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_ARRAY);
- ctx->Array.ActiveTexture = texUnit;
-}
-
-
-
-/**********************************************************************/
-/***** State management *****/
-/**********************************************************************/
-
-
-/**
- * \note This routine refers to derived texture attribute values to
- * compute the ENABLE_TEXMAT flags, but is only called on
- * _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE, the ENABLE_TEXMAT
- * flags are updated by _mesa_update_textures(), below.
- *
- * \param ctx GL context.
- */
-static void
-update_texture_matrices( struct gl_context *ctx )
-{
- GLuint u;
-
- ctx->Texture._TexMatEnabled = 0x0;
-
- for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
- ASSERT(u < Elements(ctx->TextureMatrixStack));
- if (_math_matrix_is_dirty(ctx->TextureMatrixStack[u].Top)) {
- _math_matrix_analyse( ctx->TextureMatrixStack[u].Top );
-
- if (ctx->Texture.Unit[u]._ReallyEnabled &&
- ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY)
- ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u);
- }
- }
-}
-
-
-/**
- * Examine texture unit's combine/env state to update derived state.
- */
-static void
-update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
-{
- struct gl_tex_env_combine_state *combine;
-
- /* Set the texUnit->_CurrentCombine field to point to the user's combiner
- * state, or the combiner state which is derived from traditional texenv
- * mode.
- */
- if (texUnit->EnvMode == GL_COMBINE ||
- texUnit->EnvMode == GL_COMBINE4_NV) {
- texUnit->_CurrentCombine = & texUnit->Combine;
- }
- else {
- const struct gl_texture_object *texObj = texUnit->_Current;
- GLenum format = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
- if (format == GL_COLOR_INDEX) {
- format = GL_RGBA; /* a bit of a hack */
- }
- else if (format == GL_DEPTH_COMPONENT ||
- format == GL_DEPTH_STENCIL_EXT) {
- format = texObj->DepthMode;
- }
- calculate_derived_texenv(&texUnit->_EnvMode, texUnit->EnvMode, format);
- texUnit->_CurrentCombine = & texUnit->_EnvMode;
- }
-
- combine = texUnit->_CurrentCombine;
-
- /* Determine number of source RGB terms in the combiner function */
- switch (combine->ModeRGB) {
- case GL_REPLACE:
- combine->_NumArgsRGB = 1;
- break;
- case GL_ADD:
- case GL_ADD_SIGNED:
- if (texUnit->EnvMode == GL_COMBINE4_NV)
- combine->_NumArgsRGB = 4;
- else
- combine->_NumArgsRGB = 2;
- break;
- case GL_MODULATE:
- case GL_SUBTRACT:
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- combine->_NumArgsRGB = 2;
- break;
- case GL_INTERPOLATE:
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- combine->_NumArgsRGB = 3;
- break;
- case GL_BUMP_ENVMAP_ATI:
- /* no real arguments for this case */
- combine->_NumArgsRGB = 0;
- break;
- default:
- combine->_NumArgsRGB = 0;
- _mesa_problem(ctx, "invalid RGB combine mode in update_texture_state");
- return;
- }
-
- /* Determine number of source Alpha terms in the combiner function */
- switch (combine->ModeA) {
- case GL_REPLACE:
- combine->_NumArgsA = 1;
- break;
- case GL_ADD:
- case GL_ADD_SIGNED:
- if (texUnit->EnvMode == GL_COMBINE4_NV)
- combine->_NumArgsA = 4;
- else
- combine->_NumArgsA = 2;
- break;
- case GL_MODULATE:
- case GL_SUBTRACT:
- combine->_NumArgsA = 2;
- break;
- case GL_INTERPOLATE:
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- combine->_NumArgsA = 3;
- break;
- default:
- combine->_NumArgsA = 0;
- _mesa_problem(ctx, "invalid Alpha combine mode in update_texture_state");
- break;
- }
-}
-
-
-/**
- * \note This routine refers to derived texture matrix values to
- * compute the ENABLE_TEXMAT flags, but is only called on
- * _NEW_TEXTURE. On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT
- * flags are updated by _mesa_update_texture_matrices, above.
- *
- * \param ctx GL context.
- */
-static void
-update_texture_state( struct gl_context *ctx )
-{
- GLuint unit;
- struct gl_fragment_program *fprog = NULL;
- struct gl_vertex_program *vprog = NULL;
- GLbitfield enabledFragUnits = 0x0;
-
- if (ctx->Shader.CurrentVertexProgram &&
- ctx->Shader.CurrentVertexProgram->LinkStatus) {
- vprog = ctx->Shader.CurrentVertexProgram->VertexProgram;
- } else if (ctx->VertexProgram._Enabled) {
- /* XXX enable this if/when non-shader vertex programs get
- * texture fetches:
- vprog = ctx->VertexProgram.Current;
- */
- }
-
- if (ctx->Shader.CurrentFragmentProgram &&
- ctx->Shader.CurrentFragmentProgram->LinkStatus) {
- fprog = ctx->Shader.CurrentFragmentProgram->FragmentProgram;
- }
- else if (ctx->FragmentProgram._Enabled) {
- fprog = ctx->FragmentProgram.Current;
- }
-
- /* FINISHME: Geometry shader texture accesses should also be considered
- * FINISHME: here.
- */
-
- /* TODO: only set this if there are actual changes */
- ctx->NewState |= _NEW_TEXTURE;
-
- ctx->Texture._EnabledUnits = 0x0;
- ctx->Texture._GenFlags = 0x0;
- ctx->Texture._TexMatEnabled = 0x0;
- ctx->Texture._TexGenEnabled = 0x0;
-
- /*
- * Update texture unit state.
- */
- for (unit = 0; unit < ctx->Const.MaxCombinedTextureImageUnits; unit++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLbitfield enabledVertTargets = 0x0;
- GLbitfield enabledFragTargets = 0x0;
- GLbitfield enabledTargets = 0x0;
- GLuint texIndex;
-
- /* 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 program/program. When multiple flags are set, we'll
- * settle on the one with highest priority (see below).
- */
- if (vprog) {
- enabledVertTargets |= vprog->Base.TexturesUsed[unit];
- }
-
- if (fprog) {
- enabledFragTargets |= fprog->Base.TexturesUsed[unit];
- }
- else {
- /* fixed-function fragment program */
- enabledFragTargets |= texUnit->Enabled;
- }
-
- enabledTargets = enabledVertTargets | enabledFragTargets;
-
- texUnit->_ReallyEnabled = 0x0;
-
- if (enabledTargets == 0x0) {
- /* neither vertex nor fragment processing uses this unit */
- continue;
- }
-
- /* Look for the highest priority texture target that's enabled (or used
- * by the vert/frag shaders) and "complete". That's the one we'll use
- * for texturing. If we're using vert/frag program we're guaranteed
- * that bitcount(enabledBits) <= 1.
- * Note that the TEXTURE_x_INDEX values are in high to low priority.
- */
- for (texIndex = 0; texIndex < NUM_TEXTURE_TARGETS; texIndex++) {
- if (enabledTargets & (1 << texIndex)) {
- struct gl_texture_object *texObj = texUnit->CurrentTex[texIndex];
- if (!texObj->_Complete) {
- _mesa_test_texobj_completeness(ctx, texObj);
- }
- if (texObj->_Complete) {
- texUnit->_ReallyEnabled = 1 << texIndex;
- _mesa_reference_texobj(&texUnit->_Current, texObj);
- break;
- }
- }
- }
-
- if (!texUnit->_ReallyEnabled) {
- if (fprog) {
- /* If we get here it means the shader is expecting a texture
- * object, but there isn't one (or it's incomplete). Use the
- * fallback texture.
- */
- struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx);
- texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX;
- _mesa_reference_texobj(&texUnit->_Current, texObj);
- }
- else {
- /* fixed-function: texture unit is really disabled */
- continue;
- }
- }
-
- /* if we get here, we know this texture unit is enabled */
-
- ctx->Texture._EnabledUnits |= (1 << unit);
-
- if (enabledFragTargets)
- enabledFragUnits |= (1 << unit);
-
- update_tex_combine(ctx, texUnit);
- }
-
-
- /* Determine which texture coordinate sets are actually needed */
- if (fprog) {
- const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1;
- ctx->Texture._EnabledCoordUnits
- = (fprog->Base.InputsRead >> FRAG_ATTRIB_TEX0) & coordMask;
- }
- else {
- ctx->Texture._EnabledCoordUnits = enabledFragUnits;
- }
-
- /* Setup texgen for those texture coordinate sets that are in use */
- for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- texUnit->_GenFlags = 0x0;
-
- if (!(ctx->Texture._EnabledCoordUnits & (1 << unit)))
- continue;
-
- if (texUnit->TexGenEnabled) {
- if (texUnit->TexGenEnabled & S_BIT) {
- texUnit->_GenFlags |= texUnit->GenS._ModeBit;
- }
- if (texUnit->TexGenEnabled & T_BIT) {
- texUnit->_GenFlags |= texUnit->GenT._ModeBit;
- }
- if (texUnit->TexGenEnabled & R_BIT) {
- texUnit->_GenFlags |= texUnit->GenR._ModeBit;
- }
- if (texUnit->TexGenEnabled & Q_BIT) {
- texUnit->_GenFlags |= texUnit->GenQ._ModeBit;
- }
-
- ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
- ctx->Texture._GenFlags |= texUnit->_GenFlags;
- }
-
- ASSERT(unit < Elements(ctx->TextureMatrixStack));
- if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
- ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
- }
-}
-
-
-/**
- * Update texture-related derived state.
- */
-void
-_mesa_update_texture( struct gl_context *ctx, GLuint new_state )
-{
- if (new_state & _NEW_TEXTURE_MATRIX)
- update_texture_matrices( ctx );
-
- if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM))
- update_texture_state( ctx );
-}
-
-
-/**********************************************************************/
-/***** Initialization *****/
-/**********************************************************************/
-
-/**
- * Allocate the proxy textures for the given context.
- *
- * \param ctx the context to allocate proxies for.
- *
- * \return GL_TRUE on success, or GL_FALSE on failure
- *
- * If run out of memory part way through the allocations, clean up and return
- * GL_FALSE.
- */
-static GLboolean
-alloc_proxy_textures( struct gl_context *ctx )
-{
- static const GLenum targets[] = {
- GL_TEXTURE_1D,
- GL_TEXTURE_2D,
- GL_TEXTURE_3D,
- GL_TEXTURE_CUBE_MAP_ARB,
- GL_TEXTURE_RECTANGLE_NV,
- GL_TEXTURE_1D_ARRAY_EXT,
- GL_TEXTURE_2D_ARRAY_EXT
- };
- GLint tgt;
-
- ASSERT(Elements(targets) == NUM_TEXTURE_TARGETS);
-
- for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
- if (!(ctx->Texture.ProxyTex[tgt]
- = ctx->Driver.NewTextureObject(ctx, 0, targets[tgt]))) {
- /* out of memory, free what we did allocate */
- while (--tgt >= 0) {
- ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
- }
- return GL_FALSE;
- }
- }
-
- assert(ctx->Texture.ProxyTex[0]->RefCount == 1); /* sanity check */
- return GL_TRUE;
-}
-
-
-/**
- * Initialize a texture unit.
- *
- * \param ctx GL context.
- * \param unit texture unit number to be initialized.
- */
-static void
-init_texture_unit( struct gl_context *ctx, GLuint unit )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint tex;
-
- texUnit->EnvMode = GL_MODULATE;
- ASSIGN_4V( texUnit->EnvColor, 0.0, 0.0, 0.0, 0.0 );
-
- texUnit->Combine = default_combine_state;
- texUnit->_EnvMode = default_combine_state;
- texUnit->_CurrentCombine = & texUnit->_EnvMode;
- texUnit->BumpTarget = GL_TEXTURE0;
-
- texUnit->TexGenEnabled = 0x0;
- texUnit->GenS.Mode = GL_EYE_LINEAR;
- texUnit->GenT.Mode = GL_EYE_LINEAR;
- texUnit->GenR.Mode = GL_EYE_LINEAR;
- texUnit->GenQ.Mode = GL_EYE_LINEAR;
- texUnit->GenS._ModeBit = TEXGEN_EYE_LINEAR;
- texUnit->GenT._ModeBit = TEXGEN_EYE_LINEAR;
- texUnit->GenR._ModeBit = TEXGEN_EYE_LINEAR;
- texUnit->GenQ._ModeBit = TEXGEN_EYE_LINEAR;
-
- /* Yes, these plane coefficients are correct! */
- ASSIGN_4V( texUnit->GenS.ObjectPlane, 1.0, 0.0, 0.0, 0.0 );
- ASSIGN_4V( texUnit->GenT.ObjectPlane, 0.0, 1.0, 0.0, 0.0 );
- ASSIGN_4V( texUnit->GenR.ObjectPlane, 0.0, 0.0, 0.0, 0.0 );
- ASSIGN_4V( texUnit->GenQ.ObjectPlane, 0.0, 0.0, 0.0, 0.0 );
- ASSIGN_4V( texUnit->GenS.EyePlane, 1.0, 0.0, 0.0, 0.0 );
- ASSIGN_4V( texUnit->GenT.EyePlane, 0.0, 1.0, 0.0, 0.0 );
- ASSIGN_4V( texUnit->GenR.EyePlane, 0.0, 0.0, 0.0, 0.0 );
- ASSIGN_4V( texUnit->GenQ.EyePlane, 0.0, 0.0, 0.0, 0.0 );
-
- /* no mention of this in spec, but maybe id matrix expected? */
- ASSIGN_4V( texUnit->RotMatrix, 1.0, 0.0, 0.0, 1.0 );
-
- /* initialize current texture object ptrs to the shared default objects */
- for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
- _mesa_reference_texobj(&texUnit->CurrentTex[tex],
- ctx->Shared->DefaultTex[tex]);
- }
-}
-
-
-/**
- * Initialize texture state for the given context.
- */
-GLboolean
-_mesa_init_texture(struct gl_context *ctx)
-{
- GLuint u;
-
- /* Texture group */
- ctx->Texture.CurrentUnit = 0; /* multitexture */
- ctx->Texture._EnabledUnits = 0x0;
- ctx->Texture.SharedPalette = GL_FALSE;
- _mesa_init_colortable(&ctx->Texture.Palette);
-
- for (u = 0; u < Elements(ctx->Texture.Unit); u++)
- init_texture_unit(ctx, u);
-
- /* After we're done initializing the context's texture state the default
- * texture objects' refcounts should be at least
- * MAX_COMBINED_TEXTURE_IMAGE_UNITS + 1.
- */
- assert(ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount
- >= MAX_COMBINED_TEXTURE_IMAGE_UNITS + 1);
-
- /* Allocate proxy textures */
- if (!alloc_proxy_textures( ctx ))
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-/**
- * Free dynamically-allocted texture data attached to the given context.
- */
-void
-_mesa_free_texture_data(struct gl_context *ctx)
-{
- GLuint u, tgt;
-
- /* unreference current textures */
- for (u = 0; u < Elements(ctx->Texture.Unit); u++) {
- /* The _Current texture could account for another reference */
- _mesa_reference_texobj(&ctx->Texture.Unit[u]._Current, NULL);
-
- for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
- _mesa_reference_texobj(&ctx->Texture.Unit[u].CurrentTex[tgt], NULL);
- }
- }
-
- /* Free proxy texture objects */
- for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++)
- ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
-
- for (u = 0; u < Elements(ctx->Texture.Unit); u++)
- _mesa_free_colortable_data(&ctx->Texture.Unit[u].ColorTable);
-}
-
-
-/**
- * Update the default texture objects in the given context to reference those
- * specified in the shared state and release those referencing the old
- * shared state.
- */
-void
-_mesa_update_default_objects_texture(struct gl_context *ctx)
-{
- GLuint u, tex;
-
- for (u = 0; u < Elements(ctx->Texture.Unit); u++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u];
- for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
- _mesa_reference_texobj(&texUnit->CurrentTex[tex],
- ctx->Shared->DefaultTex[tex]);
- }
- }
-}
diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h
deleted file mode 100644
index 9871230..0000000
--- a/src/mesa/main/texstate.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * \file texstate.h
- * Texture state management.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#ifndef TEXSTATE_H
-#define TEXSTATE_H
-
-
-#include "compiler.h"
-#include "mtypes.h"
-
-
-/**
- * Return pointer to current texture unit.
- * This the texture unit set by glActiveTexture(), not glClientActiveTexture().
- */
-static INLINE struct gl_texture_unit *
-_mesa_get_current_tex_unit(struct gl_context *ctx)
-{
- ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->Texture.Unit));
- return &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]);
-}
-
-
-extern void
-_mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst );
-
-extern void
-_mesa_print_texunit_state( struct gl_context *ctx, GLuint unit );
-
-
-
-/**
- * \name Called from API
- */
-/*@{*/
-
-extern void GLAPIENTRY
-_mesa_ActiveTextureARB( GLenum target );
-
-extern void GLAPIENTRY
-_mesa_ClientActiveTextureARB( GLenum target );
-
-/*@}*/
-
-
-/**
- * \name Initialization, state maintenance
- */
-/*@{*/
-
-extern void
-_mesa_update_texture( struct gl_context *ctx, GLuint new_state );
-
-extern GLboolean
-_mesa_init_texture( struct gl_context *ctx );
-
-extern void
-_mesa_free_texture_data( struct gl_context *ctx );
-
-extern void
-_mesa_update_default_objects_texture(struct gl_context *ctx);
-
-/*@}*/
-
-#endif
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
deleted file mode 100644
index 89677c5..0000000
--- a/src/mesa/main/texstore.c
+++ /dev/null
@@ -1,4648 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2008-2009 VMware, 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
- * 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.
- */
-
-/*
- * Authors:
- * Brian Paul
- */
-
-/**
- * The GL texture image functions in teximage.c basically just do
- * error checking and data structure allocation. They in turn call
- * device driver functions which actually copy/convert/store the user's
- * texture image data.
- *
- * However, most device drivers will be able to use the fallback functions
- * in this file. That is, most drivers will have the following bit of
- * code:
- * ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- * ctx->Driver.TexImage2D = _mesa_store_teximage2d;
- * ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- * etc...
- *
- * Texture image processing is actually kind of complicated. We have to do:
- * Format/type conversions
- * pixel unpacking
- * pixel transfer (scale, bais, lookup, etc)
- *
- * These functions can handle most everything, including processing full
- * images and sub-images.
- */
-
-
-#include "glheader.h"
-#include "bufferobj.h"
-#include "colormac.h"
-#include "image.h"
-#include "macros.h"
-#include "mipmap.h"
-#include "pack.h"
-#include "imports.h"
-#include "pack.h"
-#include "texcompress.h"
-#include "texcompress_fxt1.h"
-#include "texcompress_s3tc.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "enums.h"
-
-
-enum {
- ZERO = 4,
- ONE = 5
-};
-
-
-/**
- * Texture image storage function.
- */
-typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS);
-
-
-/**
- * Return GL_TRUE if the given image format is one that be converted
- * to another format by swizzling.
- */
-static GLboolean
-can_swizzle(GLenum logicalBaseFormat)
-{
- switch (logicalBaseFormat) {
- case GL_RGBA:
- case GL_RGB:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_BGR:
- case GL_BGRA:
- case GL_ABGR_EXT:
- case GL_RG:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
-
-enum {
- IDX_LUMINANCE = 0,
- IDX_ALPHA,
- IDX_INTENSITY,
- IDX_LUMINANCE_ALPHA,
- IDX_RGB,
- IDX_RGBA,
- IDX_RED,
- IDX_GREEN,
- IDX_BLUE,
- IDX_BGR,
- IDX_BGRA,
- IDX_ABGR,
- IDX_RG,
- MAX_IDX
-};
-
-#define MAP1(x) MAP4(x, ZERO, ZERO, ZERO)
-#define MAP2(x,y) MAP4(x, y, ZERO, ZERO)
-#define MAP3(x,y,z) MAP4(x, y, z, ZERO)
-#define MAP4(x,y,z,w) { x, y, z, w, ZERO, ONE }
-
-
-static const struct {
- GLubyte format_idx;
- GLubyte to_rgba[6];
- GLubyte from_rgba[6];
-} mappings[MAX_IDX] =
-{
- {
- IDX_LUMINANCE,
- MAP4(0,0,0,ONE),
- MAP1(0)
- },
-
- {
- IDX_ALPHA,
- MAP4(ZERO, ZERO, ZERO, 0),
- MAP1(3)
- },
-
- {
- IDX_INTENSITY,
- MAP4(0, 0, 0, 0),
- MAP1(0),
- },
-
- {
- IDX_LUMINANCE_ALPHA,
- MAP4(0,0,0,1),
- MAP2(0,3)
- },
-
- {
- IDX_RGB,
- MAP4(0,1,2,ONE),
- MAP3(0,1,2)
- },
-
- {
- IDX_RGBA,
- MAP4(0,1,2,3),
- MAP4(0,1,2,3),
- },
-
- {
- IDX_RED,
- MAP4(0, ZERO, ZERO, ONE),
- MAP1(0),
- },
-
- {
- IDX_GREEN,
- MAP4(ZERO, 0, ZERO, ONE),
- MAP1(1),
- },
-
- {
- IDX_BLUE,
- MAP4(ZERO, ZERO, 0, ONE),
- MAP1(2),
- },
-
- {
- IDX_BGR,
- MAP4(2,1,0,ONE),
- MAP3(2,1,0)
- },
-
- {
- IDX_BGRA,
- MAP4(2,1,0,3),
- MAP4(2,1,0,3)
- },
-
- {
- IDX_ABGR,
- MAP4(3,2,1,0),
- MAP4(3,2,1,0)
- },
-
- {
- IDX_RG,
- MAP4(0, 1, ZERO, ONE),
- MAP2(0, 1)
- },
-};
-
-
-
-/**
- * Convert a GL image format enum to an IDX_* value (see above).
- */
-static int
-get_map_idx(GLenum value)
-{
- switch (value) {
- case GL_LUMINANCE: return IDX_LUMINANCE;
- case GL_ALPHA: return IDX_ALPHA;
- case GL_INTENSITY: return IDX_INTENSITY;
- case GL_LUMINANCE_ALPHA: return IDX_LUMINANCE_ALPHA;
- case GL_RGB: return IDX_RGB;
- case GL_RGBA: return IDX_RGBA;
- case GL_RED: return IDX_RED;
- case GL_GREEN: return IDX_GREEN;
- case GL_BLUE: return IDX_BLUE;
- case GL_BGR: return IDX_BGR;
- case GL_BGRA: return IDX_BGRA;
- case GL_ABGR_EXT: return IDX_ABGR;
- case GL_RG: return IDX_RG;
- default:
- _mesa_problem(NULL, "Unexpected inFormat");
- return 0;
- }
-}
-
-
-/**
- * When promoting texture formats (see below) we need to compute the
- * mapping of dest components back to source components.
- * This function does that.
- * \param inFormat the incoming format of the texture
- * \param outFormat the final texture format
- * \return map[6] a full 6-component map
- */
-static void
-compute_component_mapping(GLenum inFormat, GLenum outFormat,
- GLubyte *map)
-{
- const int inFmt = get_map_idx(inFormat);
- const int outFmt = get_map_idx(outFormat);
- const GLubyte *in2rgba = mappings[inFmt].to_rgba;
- const GLubyte *rgba2out = mappings[outFmt].from_rgba;
- int i;
-
- for (i = 0; i < 4; i++)
- map[i] = in2rgba[rgba2out[i]];
-
- map[ZERO] = ZERO;
- map[ONE] = ONE;
-
-#if 0
- printf("from %x/%s to %x/%s map %d %d %d %d %d %d\n",
- inFormat, _mesa_lookup_enum_by_nr(inFormat),
- outFormat, _mesa_lookup_enum_by_nr(outFormat),
- map[0],
- map[1],
- map[2],
- map[3],
- map[4],
- map[5]);
-#endif
-}
-
-
-/**
- * Make a temporary (color) texture image with GLfloat components.
- * Apply all needed pixel unpacking and pixel transfer operations.
- * Note that there are both logicalBaseFormat and textureBaseFormat parameters.
- * Suppose the user specifies GL_LUMINANCE as the internal texture format
- * but the graphics hardware doesn't support luminance textures. So, we might
- * use an RGB hardware format instead.
- * If logicalBaseFormat != textureBaseFormat we have some extra work to do.
- *
- * \param ctx the rendering context
- * \param dims image dimensions: 1, 2 or 3
- * \param logicalBaseFormat basic texture derived from the user's
- * internal texture format value
- * \param textureBaseFormat the actual basic format of the texture
- * \param srcWidth source image width
- * \param srcHeight source image height
- * \param srcDepth source image depth
- * \param srcFormat source image format
- * \param srcType source image type
- * \param srcAddr source image address
- * \param srcPacking source image pixel packing
- * \return resulting image with format = textureBaseFormat and type = GLfloat.
- */
-static GLfloat *
-make_temp_float_image(struct gl_context *ctx, GLuint dims,
- GLenum logicalBaseFormat,
- GLenum textureBaseFormat,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps)
-{
- GLfloat *tempImage;
- const GLint components = _mesa_components_in_format(logicalBaseFormat);
- const GLint srcStride =
- _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
- GLfloat *dst;
- GLint img, row;
-
- ASSERT(dims >= 1 && dims <= 3);
-
- ASSERT(logicalBaseFormat == GL_RGBA ||
- logicalBaseFormat == GL_RGB ||
- logicalBaseFormat == GL_RG ||
- logicalBaseFormat == GL_RED ||
- logicalBaseFormat == GL_LUMINANCE_ALPHA ||
- logicalBaseFormat == GL_LUMINANCE ||
- logicalBaseFormat == GL_ALPHA ||
- logicalBaseFormat == GL_INTENSITY ||
- logicalBaseFormat == GL_COLOR_INDEX ||
- logicalBaseFormat == GL_DEPTH_COMPONENT);
-
- ASSERT(textureBaseFormat == GL_RGBA ||
- textureBaseFormat == GL_RGB ||
- textureBaseFormat == GL_RG ||
- textureBaseFormat == GL_RED ||
- textureBaseFormat == GL_LUMINANCE_ALPHA ||
- textureBaseFormat == GL_LUMINANCE ||
- textureBaseFormat == GL_ALPHA ||
- textureBaseFormat == GL_INTENSITY ||
- textureBaseFormat == GL_COLOR_INDEX ||
- textureBaseFormat == GL_DEPTH_COMPONENT);
-
- tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
- * components * sizeof(GLfloat));
- if (!tempImage)
- return NULL;
-
- dst = tempImage;
- for (img = 0; img < srcDepth; img++) {
- const GLubyte *src
- = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
- for (row = 0; row < srcHeight; row++) {
- _mesa_unpack_color_span_float(ctx, srcWidth, logicalBaseFormat,
- dst, srcFormat, srcType, src,
- srcPacking, transferOps);
- dst += srcWidth * components;
- src += srcStride;
- }
- }
-
- if (logicalBaseFormat != textureBaseFormat) {
- /* more work */
- GLint texComponents = _mesa_components_in_format(textureBaseFormat);
- GLint logComponents = _mesa_components_in_format(logicalBaseFormat);
- GLfloat *newImage;
- GLint i, n;
- GLubyte map[6];
-
- /* we only promote up to RGB, RGBA and LUMINANCE_ALPHA formats for now */
- ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA ||
- textureBaseFormat == GL_LUMINANCE_ALPHA);
-
- /* The actual texture format should have at least as many components
- * as the logical texture format.
- */
- ASSERT(texComponents >= logComponents);
-
- newImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
- * texComponents * sizeof(GLfloat));
- if (!newImage) {
- free(tempImage);
- return NULL;
- }
-
- compute_component_mapping(logicalBaseFormat, textureBaseFormat, map);
-
- n = srcWidth * srcHeight * srcDepth;
- for (i = 0; i < n; i++) {
- GLint k;
- for (k = 0; k < texComponents; k++) {
- GLint j = map[k];
- if (j == ZERO)
- newImage[i * texComponents + k] = 0.0F;
- else if (j == ONE)
- newImage[i * texComponents + k] = 1.0F;
- else
- newImage[i * texComponents + k] = tempImage[i * logComponents + j];
- }
- }
-
- free(tempImage);
- tempImage = newImage;
- }
-
- return tempImage;
-}
-
-
-/**
- * Make temporary image with uint pixel values. Used for unsigned
- * integer-valued textures.
- */
-static GLuint *
-make_temp_uint_image(struct gl_context *ctx, GLuint dims,
- GLenum logicalBaseFormat,
- GLenum textureBaseFormat,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking)
-{
- GLuint *tempImage;
- const GLint components = _mesa_components_in_format(logicalBaseFormat);
- const GLint srcStride =
- _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
- GLuint *dst;
- GLint img, row;
-
- ASSERT(dims >= 1 && dims <= 3);
-
- ASSERT(logicalBaseFormat == GL_RGBA ||
- logicalBaseFormat == GL_RGB ||
- logicalBaseFormat == GL_RG ||
- logicalBaseFormat == GL_RED ||
- logicalBaseFormat == GL_LUMINANCE_ALPHA ||
- logicalBaseFormat == GL_LUMINANCE ||
- logicalBaseFormat == GL_INTENSITY ||
- logicalBaseFormat == GL_ALPHA);
-
- ASSERT(textureBaseFormat == GL_RGBA ||
- textureBaseFormat == GL_RGB ||
- textureBaseFormat == GL_RG ||
- textureBaseFormat == GL_RED ||
- textureBaseFormat == GL_LUMINANCE_ALPHA ||
- textureBaseFormat == GL_LUMINANCE ||
- textureBaseFormat == GL_ALPHA);
-
- tempImage = (GLuint *) malloc(srcWidth * srcHeight * srcDepth
- * components * sizeof(GLuint));
- if (!tempImage)
- return NULL;
-
- dst = tempImage;
- for (img = 0; img < srcDepth; img++) {
- const GLubyte *src
- = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
- for (row = 0; row < srcHeight; row++) {
- _mesa_unpack_color_span_uint(ctx, srcWidth, logicalBaseFormat,
- dst, srcFormat, srcType, src,
- srcPacking);
- dst += srcWidth * components;
- src += srcStride;
- }
- }
-
- if (logicalBaseFormat != textureBaseFormat) {
- /* more work */
- GLint texComponents = _mesa_components_in_format(textureBaseFormat);
- GLint logComponents = _mesa_components_in_format(logicalBaseFormat);
- GLuint *newImage;
- GLint i, n;
- GLubyte map[6];
-
- /* we only promote up to RGB, RGBA and LUMINANCE_ALPHA formats for now */
- ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA ||
- textureBaseFormat == GL_LUMINANCE_ALPHA);
-
- /* The actual texture format should have at least as many components
- * as the logical texture format.
- */
- ASSERT(texComponents >= logComponents);
-
- newImage = (GLuint *) malloc(srcWidth * srcHeight * srcDepth
- * texComponents * sizeof(GLuint));
- if (!newImage) {
- free(tempImage);
- return NULL;
- }
-
- compute_component_mapping(logicalBaseFormat, textureBaseFormat, map);
-
- n = srcWidth * srcHeight * srcDepth;
- for (i = 0; i < n; i++) {
- GLint k;
- for (k = 0; k < texComponents; k++) {
- GLint j = map[k];
- if (j == ZERO)
- newImage[i * texComponents + k] = 0.0F;
- else if (j == ONE)
- newImage[i * texComponents + k] = 1.0F;
- else
- newImage[i * texComponents + k] = tempImage[i * logComponents + j];
- }
- }
-
- free(tempImage);
- tempImage = newImage;
- }
-
- return tempImage;
-}
-
-
-
-/**
- * Make a temporary (color) texture image with GLchan components.
- * Apply all needed pixel unpacking and pixel transfer operations.
- * Note that there are both logicalBaseFormat and textureBaseFormat parameters.
- * Suppose the user specifies GL_LUMINANCE as the internal texture format
- * but the graphics hardware doesn't support luminance textures. So, we might
- * use an RGB hardware format instead.
- * If logicalBaseFormat != textureBaseFormat we have some extra work to do.
- *
- * \param ctx the rendering context
- * \param dims image dimensions: 1, 2 or 3
- * \param logicalBaseFormat basic texture derived from the user's
- * internal texture format value
- * \param textureBaseFormat the actual basic format of the texture
- * \param srcWidth source image width
- * \param srcHeight source image height
- * \param srcDepth source image depth
- * \param srcFormat source image format
- * \param srcType source image type
- * \param srcAddr source image address
- * \param srcPacking source image pixel packing
- * \return resulting image with format = textureBaseFormat and type = GLchan.
- */
-GLchan *
-_mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims,
- GLenum logicalBaseFormat,
- GLenum textureBaseFormat,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking)
-{
- GLuint transferOps = ctx->_ImageTransferState;
- const GLint components = _mesa_components_in_format(logicalBaseFormat);
- GLint img, row;
- GLchan *tempImage, *dst;
-
- ASSERT(dims >= 1 && dims <= 3);
-
- ASSERT(logicalBaseFormat == GL_RGBA ||
- logicalBaseFormat == GL_RGB ||
- logicalBaseFormat == GL_RG ||
- logicalBaseFormat == GL_RED ||
- logicalBaseFormat == GL_LUMINANCE_ALPHA ||
- logicalBaseFormat == GL_LUMINANCE ||
- logicalBaseFormat == GL_ALPHA ||
- logicalBaseFormat == GL_INTENSITY);
-
- ASSERT(textureBaseFormat == GL_RGBA ||
- textureBaseFormat == GL_RGB ||
- textureBaseFormat == GL_RG ||
- textureBaseFormat == GL_RED ||
- textureBaseFormat == GL_LUMINANCE_ALPHA ||
- textureBaseFormat == GL_LUMINANCE ||
- textureBaseFormat == GL_ALPHA ||
- textureBaseFormat == GL_INTENSITY);
-
- /* unpack and transfer the source image */
- tempImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth
- * components * sizeof(GLchan));
- if (!tempImage) {
- return NULL;
- }
-
- dst = tempImage;
- for (img = 0; img < srcDepth; img++) {
- const GLint srcStride =
- _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
- const GLubyte *src =
- (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
- for (row = 0; row < srcHeight; row++) {
- _mesa_unpack_color_span_chan(ctx, srcWidth, logicalBaseFormat, dst,
- srcFormat, srcType, src, srcPacking,
- transferOps);
- dst += srcWidth * components;
- src += srcStride;
- }
- }
-
- if (logicalBaseFormat != textureBaseFormat) {
- /* one more conversion step */
- GLint texComponents = _mesa_components_in_format(textureBaseFormat);
- GLint logComponents = _mesa_components_in_format(logicalBaseFormat);
- GLchan *newImage;
- GLint i, n;
- GLubyte map[6];
-
- /* we only promote up to RGB, RGBA and LUMINANCE_ALPHA formats for now */
- ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA ||
- textureBaseFormat == GL_LUMINANCE_ALPHA);
-
- /* The actual texture format should have at least as many components
- * as the logical texture format.
- */
- ASSERT(texComponents >= logComponents);
-
- newImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth
- * texComponents * sizeof(GLchan));
- if (!newImage) {
- free(tempImage);
- return NULL;
- }
-
- compute_component_mapping(logicalBaseFormat, textureBaseFormat, map);
-
- n = srcWidth * srcHeight * srcDepth;
- for (i = 0; i < n; i++) {
- GLint k;
- for (k = 0; k < texComponents; k++) {
- GLint j = map[k];
- if (j == ZERO)
- newImage[i * texComponents + k] = 0;
- else if (j == ONE)
- newImage[i * texComponents + k] = CHAN_MAX;
- else
- newImage[i * texComponents + k] = tempImage[i * logComponents + j];
- }
- }
-
- free(tempImage);
- tempImage = newImage;
- }
-
- return tempImage;
-}
-
-
-/**
- * Copy GLubyte pixels from <src> to <dst> with swizzling.
- * \param dst destination pixels
- * \param dstComponents number of color components in destination pixels
- * \param src source pixels
- * \param srcComponents number of color components in source pixels
- * \param map the swizzle mapping. map[X] says where to find the X component
- * in the source image's pixels. For example, if the source image
- * is GL_BGRA and X = red, map[0] yields 2.
- * \param count number of pixels to copy/swizzle.
- */
-static void
-swizzle_copy(GLubyte *dst, GLuint dstComponents, const GLubyte *src,
- GLuint srcComponents, const GLubyte *map, GLuint count)
-{
-#define SWZ_CPY(dst, src, count, dstComps, srcComps) \
- do { \
- GLuint i; \
- for (i = 0; i < count; i++) { \
- GLuint j; \
- if (srcComps == 4) { \
- COPY_4UBV(tmp, src); \
- } \
- else { \
- for (j = 0; j < srcComps; j++) { \
- tmp[j] = src[j]; \
- } \
- } \
- src += srcComps; \
- for (j = 0; j < dstComps; j++) { \
- dst[j] = tmp[map[j]]; \
- } \
- dst += dstComps; \
- } \
- } while (0)
-
- GLubyte tmp[6];
-
- tmp[ZERO] = 0x0;
- tmp[ONE] = 0xff;
-
- ASSERT(srcComponents <= 4);
- ASSERT(dstComponents <= 4);
-
- switch (dstComponents) {
- case 4:
- switch (srcComponents) {
- case 4:
- SWZ_CPY(dst, src, count, 4, 4);
- break;
- case 3:
- SWZ_CPY(dst, src, count, 4, 3);
- break;
- case 2:
- SWZ_CPY(dst, src, count, 4, 2);
- break;
- case 1:
- SWZ_CPY(dst, src, count, 4, 1);
- break;
- default:
- ;
- }
- break;
- case 3:
- switch (srcComponents) {
- case 4:
- SWZ_CPY(dst, src, count, 3, 4);
- break;
- case 3:
- SWZ_CPY(dst, src, count, 3, 3);
- break;
- case 2:
- SWZ_CPY(dst, src, count, 3, 2);
- break;
- case 1:
- SWZ_CPY(dst, src, count, 3, 1);
- break;
- default:
- ;
- }
- break;
- case 2:
- switch (srcComponents) {
- case 4:
- SWZ_CPY(dst, src, count, 2, 4);
- break;
- case 3:
- SWZ_CPY(dst, src, count, 2, 3);
- break;
- case 2:
- SWZ_CPY(dst, src, count, 2, 2);
- break;
- case 1:
- SWZ_CPY(dst, src, count, 2, 1);
- break;
- default:
- ;
- }
- break;
- case 1:
- switch (srcComponents) {
- case 4:
- SWZ_CPY(dst, src, count, 1, 4);
- break;
- case 3:
- SWZ_CPY(dst, src, count, 1, 3);
- break;
- case 2:
- SWZ_CPY(dst, src, count, 1, 2);
- break;
- case 1:
- SWZ_CPY(dst, src, count, 1, 1);
- break;
- default:
- ;
- }
- break;
- default:
- ;
- }
-#undef SWZ_CPY
-}
-
-
-
-static const GLubyte map_identity[6] = { 0, 1, 2, 3, ZERO, ONE };
-static const GLubyte map_3210[6] = { 3, 2, 1, 0, ZERO, ONE };
-
-
-/**
- * For 1-byte/pixel formats (or 8_8_8_8 packed formats), return a
- * mapping array depending on endianness.
- */
-static const GLubyte *
-type_mapping( GLenum srcType )
-{
- switch (srcType) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- return map_identity;
- case GL_UNSIGNED_INT_8_8_8_8:
- return _mesa_little_endian() ? map_3210 : map_identity;
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- return _mesa_little_endian() ? map_identity : map_3210;
- default:
- return NULL;
- }
-}
-
-
-/**
- * For 1-byte/pixel formats (or 8_8_8_8 packed formats), return a
- * mapping array depending on pixelstore byte swapping state.
- */
-static const GLubyte *
-byteswap_mapping( GLboolean swapBytes,
- GLenum srcType )
-{
- if (!swapBytes)
- return map_identity;
-
- switch (srcType) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- return map_identity;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- return map_3210;
- default:
- return NULL;
- }
-}
-
-
-
-/**
- * Transfer a GLubyte texture image with component swizzling.
- */
-static void
-_mesa_swizzle_ubyte_image(struct gl_context *ctx,
- GLuint dimensions,
- GLenum srcFormat,
- GLenum srcType,
-
- GLenum baseInternalFormat,
-
- const GLubyte *rgba2dst,
- GLuint dstComponents,
-
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride,
- const GLuint *dstImageOffsets,
-
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking )
-{
- GLint srcComponents = _mesa_components_in_format(srcFormat);
- const GLubyte *srctype2ubyte, *swap;
- GLubyte map[4], src2base[6], base2rgba[6];
- GLint i;
- const GLint srcRowStride =
- _mesa_image_row_stride(srcPacking, srcWidth,
- srcFormat, GL_UNSIGNED_BYTE);
- const GLint srcImageStride
- = _mesa_image_image_stride(srcPacking, srcWidth, srcHeight, srcFormat,
- GL_UNSIGNED_BYTE);
- const GLubyte *srcImage
- = (const GLubyte *) _mesa_image_address(dimensions, srcPacking, srcAddr,
- srcWidth, srcHeight, srcFormat,
- GL_UNSIGNED_BYTE, 0, 0, 0);
-
- (void) ctx;
-
- /* Translate from src->baseInternal->GL_RGBA->dst. This will
- * correctly deal with RGBA->RGB->RGBA conversions where the final
- * A value must be 0xff regardless of the incoming alpha values.
- */
- compute_component_mapping(srcFormat, baseInternalFormat, src2base);
- compute_component_mapping(baseInternalFormat, GL_RGBA, base2rgba);
- swap = byteswap_mapping(srcPacking->SwapBytes, srcType);
- srctype2ubyte = type_mapping(srcType);
-
-
- for (i = 0; i < 4; i++)
- map[i] = srctype2ubyte[swap[src2base[base2rgba[rgba2dst[i]]]]];
-
-/* printf("map %d %d %d %d\n", map[0], map[1], map[2], map[3]); */
-
- if (srcComponents == dstComponents &&
- srcRowStride == dstRowStride &&
- srcRowStride == srcWidth * srcComponents &&
- dimensions < 3) {
- /* 1 and 2D images only */
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstYoffset * dstRowStride
- + dstXoffset * dstComponents;
- swizzle_copy(dstImage, dstComponents, srcImage, srcComponents, map,
- srcWidth * srcHeight);
- }
- else {
- GLint img, row;
- for (img = 0; img < srcDepth; img++) {
- const GLubyte *srcRow = srcImage;
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * dstComponents
- + dstYoffset * dstRowStride
- + dstXoffset * dstComponents;
- for (row = 0; row < srcHeight; row++) {
- swizzle_copy(dstRow, dstComponents, srcRow, srcComponents, map, srcWidth);
- dstRow += dstRowStride;
- srcRow += srcRowStride;
- }
- srcImage += srcImageStride;
- }
- }
-}
-
-
-/**
- * Teximage storage routine for when a simple memcpy will do.
- * No pixel transfer operations or special texel encodings allowed.
- * 1D, 2D and 3D images supported.
- */
-static void
-memcpy_texture(struct gl_context *ctx,
- GLuint dimensions,
- gl_format dstFormat,
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride,
- const GLuint *dstImageOffsets,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking)
-{
- const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth,
- srcFormat, srcType);
- const GLint srcImageStride = _mesa_image_image_stride(srcPacking,
- srcWidth, srcHeight, srcFormat, srcType);
- const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(dimensions,
- srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0);
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLint bytesPerRow = srcWidth * texelBytes;
-
-#if 0
- /* XXX update/re-enable for dstImageOffsets array */
- const GLint bytesPerImage = srcHeight * bytesPerRow;
- const GLint bytesPerTexture = srcDepth * bytesPerImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
-
- if (dstRowStride == srcRowStride &&
- dstRowStride == bytesPerRow &&
- ((dstImageStride == srcImageStride &&
- dstImageStride == bytesPerImage) ||
- (srcDepth == 1))) {
- /* one big memcpy */
- ctx->Driver.TextureMemCpy(dstImage, srcImage, bytesPerTexture);
- }
- else
- {
- GLint img, row;
- for (img = 0; img < srcDepth; img++) {
- const GLubyte *srcRow = srcImage;
- GLubyte *dstRow = dstImage;
- for (row = 0; row < srcHeight; row++) {
- ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow);
- dstRow += dstRowStride;
- srcRow += srcRowStride;
- }
- srcImage += srcImageStride;
- dstImage += dstImageStride;
- }
- }
-#endif
-
- GLint img, row;
- for (img = 0; img < srcDepth; img++) {
- const GLubyte *srcRow = srcImage;
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow);
- dstRow += dstRowStride;
- srcRow += srcRowStride;
- }
- srcImage += srcImageStride;
- }
-}
-
-
-
-/**
- * Store a 32-bit integer depth component texture image.
- */
-static GLboolean
-_mesa_texstore_z32(TEXSTORE_PARAMS)
-{
- const GLuint depthScale = 0xffffffff;
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- (void) dims;
- ASSERT(dstFormat == MESA_FORMAT_Z32);
- ASSERT(texelBytes == sizeof(GLuint));
-
- if (ctx->Pixel.DepthScale == 1.0f &&
- ctx->Pixel.DepthBias == 0.0f &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_DEPTH_COMPONENT &&
- srcFormat == GL_DEPTH_COMPONENT &&
- 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 */
- GLint img, row;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- const GLvoid *src = _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
- _mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT, (GLuint *) dstRow,
- depthScale, srcType, src, srcPacking);
- dstRow += dstRowStride;
- }
- }
- }
- return GL_TRUE;
-}
-
-
-/**
- * Store a 24-bit integer depth component texture image.
- */
-static GLboolean
-_mesa_texstore_x8_z24(TEXSTORE_PARAMS)
-{
- const GLuint depthScale = 0xffffff;
- const GLuint texelBytes = 4;
-
- (void) dims;
- ASSERT(dstFormat == MESA_FORMAT_X8_Z24);
-
- {
- /* general path */
- GLint img, row;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- const GLvoid *src = _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
- _mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT, (GLuint *) dstRow,
- depthScale, srcType, src, srcPacking);
- dstRow += dstRowStride;
- }
- }
- }
- return GL_TRUE;
-}
-
-
-/**
- * Store a 24-bit integer depth component texture image.
- */
-static GLboolean
-_mesa_texstore_z24_x8(TEXSTORE_PARAMS)
-{
- const GLuint depthScale = 0xffffff;
- const GLuint texelBytes = 4;
-
- (void) dims;
- ASSERT(dstFormat == MESA_FORMAT_Z24_X8);
-
- {
- /* general path */
- GLint img, row;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- const GLvoid *src = _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
- GLuint *dst = (GLuint *) dstRow;
- GLint i;
- _mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT, dst,
- depthScale, srcType, src, srcPacking);
- for (i = 0; i < srcWidth; i++)
- dst[i] <<= 8;
- dstRow += dstRowStride;
- }
- }
- }
- return GL_TRUE;
-}
-
-
-/**
- * Store a 16-bit integer depth component texture image.
- */
-static GLboolean
-_mesa_texstore_z16(TEXSTORE_PARAMS)
-{
- const GLuint depthScale = 0xffff;
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- (void) dims;
- ASSERT(dstFormat == MESA_FORMAT_Z16);
- ASSERT(texelBytes == sizeof(GLushort));
-
- if (ctx->Pixel.DepthScale == 1.0f &&
- ctx->Pixel.DepthBias == 0.0f &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_DEPTH_COMPONENT &&
- srcFormat == GL_DEPTH_COMPONENT &&
- 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 */
- GLint img, row;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- const GLvoid *src = _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
- GLushort *dst16 = (GLushort *) dstRow;
- _mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_SHORT, dst16, depthScale,
- srcType, src, srcPacking);
- dstRow += dstRowStride;
- }
- }
- }
- return GL_TRUE;
-}
-
-
-/**
- * Store an rgb565 or rgb565_rev texture image.
- */
-static GLboolean
-_mesa_texstore_rgb565(TEXSTORE_PARAMS)
-{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_RGB565 ||
- dstFormat == MESA_FORMAT_RGB565_REV);
- ASSERT(texelBytes == 2);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_RGB565 &&
- baseInternalFormat == GL_RGB &&
- srcFormat == GL_RGB &&
- srcType == GL_UNSIGNED_SHORT_5_6_5) {
- /* simple memcpy path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_RGB &&
- srcFormat == GL_RGB &&
- srcType == GL_UNSIGNED_BYTE &&
- dims == 2) {
- /* do optimized tex store */
- const GLint srcRowStride =
- _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
- const GLubyte *src = (const GLubyte *)
- _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight,
- srcFormat, srcType, 0, 0, 0);
- GLubyte *dst = (GLubyte *) dstAddr
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- GLint row, col;
- for (row = 0; row < srcHeight; row++) {
- const GLubyte *srcUB = (const GLubyte *) src;
- GLushort *dstUS = (GLushort *) dst;
- /* check for byteswapped format */
- if (dstFormat == MESA_FORMAT_RGB565) {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_565( srcUB[0], srcUB[1], srcUB[2] );
- srcUB += 3;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_565_REV( srcUB[0], srcUB[1], srcUB[2] );
- srcUB += 3;
- }
- }
- dst += dstRowStride;
- src += srcRowStride;
- }
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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;
- /* check for byteswapped format */
- if (dstFormat == MESA_FORMAT_RGB565) {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_565( CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 3;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_565_REV( CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 3;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-/**
- * Store a texture in MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV.
- */
-static GLboolean
-_mesa_texstore_rgba8888(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_RGBA8888 ||
- dstFormat == MESA_FORMAT_RGBA8888_REV);
- ASSERT(texelBytes == 4);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_RGBA8888 &&
- baseInternalFormat == GL_RGBA &&
- ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
- (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
- (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) ||
- (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && littleEndian))) {
- /* simple memcpy path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_RGBA8888_REV &&
- baseInternalFormat == GL_RGBA &&
- ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) ||
- (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && littleEndian) ||
- (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
- (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && !littleEndian))) {
- /* simple memcpy path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- (srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_UNSIGNED_INT_8_8_8_8 ||
- srcType == GL_UNSIGNED_INT_8_8_8_8_REV) &&
- can_swizzle(baseInternalFormat) &&
- can_swizzle(srcFormat)) {
-
- GLubyte dstmap[4];
-
- /* dstmap - how to swizzle from RGBA to dst format:
- */
- if ((littleEndian && dstFormat == MESA_FORMAT_RGBA8888) ||
- (!littleEndian && dstFormat == MESA_FORMAT_RGBA8888_REV)) {
- dstmap[3] = 0;
- dstmap[2] = 1;
- dstmap[1] = 2;
- dstmap[0] = 3;
- }
- else {
- dstmap[3] = 3;
- dstmap[2] = 2;
- dstmap[1] = 1;
- dstmap[0] = 0;
- }
-
- _mesa_swizzle_ubyte_image(ctx, dims,
- srcFormat,
- srcType,
- baseInternalFormat,
- dstmap, 4,
- dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcAddr,
- srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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;
- if (dstFormat == MESA_FORMAT_RGBA8888) {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]),
- CHAN_TO_UBYTE(src[ACOMP]) );
- src += 4;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888_REV( CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]),
- CHAN_TO_UBYTE(src[ACOMP]) );
- src += 4;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-_mesa_texstore_argb8888(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = GL_RGBA;
-
- ASSERT(dstFormat == MESA_FORMAT_ARGB8888 ||
- dstFormat == MESA_FORMAT_ARGB8888_REV ||
- dstFormat == MESA_FORMAT_XRGB8888 ||
- dstFormat == MESA_FORMAT_XRGB8888_REV );
- ASSERT(texelBytes == 4);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- (dstFormat == MESA_FORMAT_ARGB8888 ||
- dstFormat == MESA_FORMAT_XRGB8888) &&
- baseInternalFormat == GL_RGBA &&
- srcFormat == GL_BGRA &&
- ((srcType == GL_UNSIGNED_BYTE && littleEndian) ||
- srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) {
- /* simple memcpy path (little endian) */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- (dstFormat == MESA_FORMAT_ARGB8888_REV ||
- dstFormat == MESA_FORMAT_XRGB8888_REV) &&
- baseInternalFormat == GL_RGBA &&
- srcFormat == GL_BGRA &&
- ((srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
- srcType == GL_UNSIGNED_INT_8_8_8_8)) {
- /* simple memcpy path (big endian) */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- (dstFormat == MESA_FORMAT_ARGB8888 ||
- dstFormat == MESA_FORMAT_XRGB8888) &&
- srcFormat == GL_RGB &&
- (baseInternalFormat == GL_RGBA ||
- baseInternalFormat == GL_RGB) &&
- srcType == GL_UNSIGNED_BYTE) {
- int img, row, col;
- for (img = 0; img < srcDepth; img++) {
- const GLint srcRowStride =
- _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
- GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- GLuint *d4 = (GLuint *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- d4[col] = PACK_COLOR_8888(0xff,
- srcRow[col * 3 + RCOMP],
- srcRow[col * 3 + GCOMP],
- srcRow[col * 3 + BCOMP]);
- }
- dstRow += dstRowStride;
- srcRow += srcRowStride;
- }
- }
- }
- else if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_ARGB8888 &&
- srcFormat == GL_RGBA &&
- baseInternalFormat == GL_RGBA &&
- srcType == GL_UNSIGNED_BYTE) {
- /* same as above case, but src data has alpha too */
- GLint img, row, col;
- /* For some reason, streaming copies to write-combined regions
- * are extremely sensitive to the characteristics of how the
- * source data is retrieved. By reordering the source reads to
- * be in-order, the speed of this operation increases by half.
- * Strangely the same isn't required for the RGB path, above.
- */
- for (img = 0; img < srcDepth; img++) {
- const GLint srcRowStride =
- _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
- GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- GLuint *d4 = (GLuint *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- d4[col] = PACK_COLOR_8888(srcRow[col * 4 + ACOMP],
- srcRow[col * 4 + RCOMP],
- srcRow[col * 4 + GCOMP],
- srcRow[col * 4 + BCOMP]);
- }
- dstRow += dstRowStride;
- srcRow += srcRowStride;
- }
- }
- }
- else if (!ctx->_ImageTransferState &&
- (srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_UNSIGNED_INT_8_8_8_8 ||
- srcType == GL_UNSIGNED_INT_8_8_8_8_REV) &&
- can_swizzle(baseInternalFormat) &&
- can_swizzle(srcFormat)) {
-
- GLubyte dstmap[4];
-
- /* dstmap - how to swizzle from RGBA to dst format:
- */
- if ((littleEndian && dstFormat == MESA_FORMAT_ARGB8888) ||
- (littleEndian && dstFormat == MESA_FORMAT_XRGB8888) ||
- (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) ||
- (!littleEndian && dstFormat == MESA_FORMAT_XRGB8888_REV)) {
- dstmap[3] = 3; /* alpha */
- dstmap[2] = 0; /* red */
- dstmap[1] = 1; /* green */
- dstmap[0] = 2; /* blue */
- }
- else {
- assert((littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) ||
- (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888) ||
- (littleEndian && dstFormat == MESA_FORMAT_XRGB8888_REV) ||
- (!littleEndian && dstFormat == MESA_FORMAT_XRGB8888));
- dstmap[3] = 2;
- dstmap[2] = 1;
- dstmap[1] = 0;
- dstmap[0] = 3;
- }
-
- _mesa_swizzle_ubyte_image(ctx, dims,
- srcFormat,
- srcType,
- baseInternalFormat,
- dstmap, 4,
- dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcAddr,
- srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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;
- if (dstFormat == MESA_FORMAT_ARGB8888) {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]),
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 4;
- }
- }
- else if (dstFormat == MESA_FORMAT_XRGB8888) {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888( 0xff,
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 4;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888_REV( CHAN_TO_UBYTE(src[ACOMP]),
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 4;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-_mesa_texstore_rgb888(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_RGB888);
- ASSERT(texelBytes == 3);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_RGB &&
- srcFormat == GL_BGR &&
- srcType == GL_UNSIGNED_BYTE &&
- littleEndian) {
- /* simple memcpy path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- srcFormat == GL_RGBA &&
- srcType == GL_UNSIGNED_BYTE) {
- /* extract RGB from RGBA */
- GLint img, row, col;
- for (img = 0; img < srcDepth; img++) {
- const GLint srcRowStride =
- _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
- GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + 0] = srcRow[col * 4 + BCOMP];
- dstRow[col * 3 + 1] = srcRow[col * 4 + GCOMP];
- dstRow[col * 3 + 2] = srcRow[col * 4 + RCOMP];
- }
- dstRow += dstRowStride;
- srcRow += srcRowStride;
- }
- }
- }
- else if (!ctx->_ImageTransferState &&
- srcType == GL_UNSIGNED_BYTE &&
- can_swizzle(baseInternalFormat) &&
- can_swizzle(srcFormat)) {
-
- GLubyte dstmap[4];
-
- /* dstmap - how to swizzle from RGBA to dst format:
- */
- dstmap[0] = 2;
- dstmap[1] = 1;
- dstmap[2] = 0;
- dstmap[3] = ONE; /* ? */
-
- _mesa_swizzle_ubyte_image(ctx, dims,
- srcFormat,
- srcType,
- baseInternalFormat,
- dstmap, 3,
- dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcAddr,
- srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = (const GLchan *) tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
-#if 0
- if (littleEndian) {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]);
- dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]);
- dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[BCOMP]);
- srcUB += 3;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + 0] = srcUB[BCOMP];
- dstRow[col * 3 + 1] = srcUB[GCOMP];
- dstRow[col * 3 + 2] = srcUB[RCOMP];
- srcUB += 3;
- }
- }
-#else
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[BCOMP]);
- dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]);
- dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[RCOMP]);
- src += 3;
- }
-#endif
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-_mesa_texstore_bgr888(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_BGR888);
- ASSERT(texelBytes == 3);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_RGB &&
- srcFormat == GL_RGB &&
- srcType == GL_UNSIGNED_BYTE &&
- littleEndian) {
- /* simple memcpy path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- srcFormat == GL_RGBA &&
- srcType == GL_UNSIGNED_BYTE) {
- /* extract BGR from RGBA */
- int img, row, col;
- for (img = 0; img < srcDepth; img++) {
- const GLint srcRowStride =
- _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
- GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + 0] = srcRow[col * 4 + RCOMP];
- dstRow[col * 3 + 1] = srcRow[col * 4 + GCOMP];
- dstRow[col * 3 + 2] = srcRow[col * 4 + BCOMP];
- }
- dstRow += dstRowStride;
- srcRow += srcRowStride;
- }
- }
- }
- else if (!ctx->_ImageTransferState &&
- srcType == GL_UNSIGNED_BYTE &&
- can_swizzle(baseInternalFormat) &&
- can_swizzle(srcFormat)) {
-
- GLubyte dstmap[4];
-
- /* dstmap - how to swizzle from RGBA to dst format:
- */
- dstmap[0] = 0;
- dstmap[1] = 1;
- dstmap[2] = 2;
- dstmap[3] = ONE; /* ? */
-
- _mesa_swizzle_ubyte_image(ctx, dims,
- srcFormat,
- srcType,
- baseInternalFormat,
- dstmap, 3,
- dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcAddr,
- srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = (const GLchan *) tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]);
- dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]);
- dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[BCOMP]);
- src += 3;
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-_mesa_texstore_argb4444(TEXSTORE_PARAMS)
-{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_ARGB4444 ||
- dstFormat == MESA_FORMAT_ARGB4444_REV);
- ASSERT(texelBytes == 2);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_ARGB4444 &&
- baseInternalFormat == GL_RGBA &&
- srcFormat == GL_BGRA &&
- srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
- /* 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 GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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;
- if (dstFormat == MESA_FORMAT_ARGB4444) {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[ACOMP]),
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 4;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_4444_REV( CHAN_TO_UBYTE(src[ACOMP]),
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 4;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-static GLboolean
-_mesa_texstore_rgba5551(TEXSTORE_PARAMS)
-{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_RGBA5551);
- ASSERT(texelBytes == 2);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_RGBA5551 &&
- baseInternalFormat == GL_RGBA &&
- srcFormat == GL_RGBA &&
- srcType == GL_UNSIGNED_SHORT_5_5_5_1) {
- /* 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 GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src =tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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_5551( CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]),
- CHAN_TO_UBYTE(src[ACOMP]) );
- src += 4;
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-static GLboolean
-_mesa_texstore_argb1555(TEXSTORE_PARAMS)
-{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_ARGB1555 ||
- dstFormat == MESA_FORMAT_ARGB1555_REV);
- ASSERT(texelBytes == 2);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_ARGB1555 &&
- baseInternalFormat == GL_RGBA &&
- srcFormat == GL_BGRA &&
- srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
- /* 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 GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src =tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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;
- if (dstFormat == MESA_FORMAT_ARGB1555) {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_1555( CHAN_TO_UBYTE(src[ACOMP]),
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 4;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_1555_REV( CHAN_TO_UBYTE(src[ACOMP]),
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 4;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-/**
- * Do texstore for 2-channel, 8-bit/channel, unsigned normalized formats.
- */
-static GLboolean
-_mesa_texstore_unorm88(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_AL88 ||
- dstFormat == MESA_FORMAT_AL88_REV ||
- dstFormat == MESA_FORMAT_RG88 ||
- dstFormat == MESA_FORMAT_RG88_REV);
- ASSERT(texelBytes == 2);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- (dstFormat == MESA_FORMAT_AL88 || dstFormat == MESA_FORMAT_RG88) &&
- baseInternalFormat == srcFormat &&
- srcType == GL_UNSIGNED_BYTE &&
- littleEndian) {
- /* simple memcpy path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- littleEndian &&
- srcType == GL_UNSIGNED_BYTE &&
- can_swizzle(baseInternalFormat) &&
- can_swizzle(srcFormat)) {
- GLubyte dstmap[4];
-
- /* dstmap - how to swizzle from RGBA to dst format:
- */
- if (dstFormat == MESA_FORMAT_AL88 || dstFormat == MESA_FORMAT_AL88_REV) {
- if ((littleEndian && dstFormat == MESA_FORMAT_AL88) ||
- (!littleEndian && dstFormat == MESA_FORMAT_AL88_REV)) {
- dstmap[0] = 0;
- dstmap[1] = 3;
- }
- else {
- dstmap[0] = 3;
- dstmap[1] = 0;
- }
- }
- else {
- if ((littleEndian && dstFormat == MESA_FORMAT_RG88) ||
- (!littleEndian && dstFormat == MESA_FORMAT_RG88_REV)) {
- dstmap[0] = 0;
- dstmap[1] = 1;
- }
- else {
- dstmap[0] = 1;
- dstmap[1] = 0;
- }
- }
- dstmap[2] = ZERO; /* ? */
- dstmap[3] = ONE; /* ? */
-
- _mesa_swizzle_ubyte_image(ctx, dims,
- srcFormat,
- srcType,
- baseInternalFormat,
- dstmap, 2,
- dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcAddr,
- srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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;
- if (dstFormat == MESA_FORMAT_AL88 ||
- dstFormat == MESA_FORMAT_RG88) {
- for (col = 0; col < srcWidth; col++) {
- /* src[0] is luminance, src[1] is alpha */
- dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[1]),
- CHAN_TO_UBYTE(src[0]) );
- src += 2;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- /* src[0] is luminance, src[1] is alpha */
- dstUS[col] = PACK_COLOR_88_REV( CHAN_TO_UBYTE(src[1]),
- CHAN_TO_UBYTE(src[0]) );
- src += 2;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-/**
- * Do texstore for 2-channel, 16-bit/channel, unsigned normalized formats.
- */
-static GLboolean
-_mesa_texstore_unorm1616(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_AL1616 ||
- dstFormat == MESA_FORMAT_AL1616_REV ||
- dstFormat == MESA_FORMAT_RG1616 ||
- dstFormat == MESA_FORMAT_RG1616_REV);
- ASSERT(texelBytes == 4);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- (dstFormat == MESA_FORMAT_AL1616 || dstFormat == MESA_FORMAT_RG1616) &&
- baseInternalFormat == srcFormat &&
- srcType == GL_UNSIGNED_SHORT &&
- littleEndian) {
- /* 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,
- ctx->_ImageTransferState);
- const GLfloat *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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;
- if (dstFormat == MESA_FORMAT_AL1616 ||
- dstFormat == MESA_FORMAT_RG1616) {
- for (col = 0; col < srcWidth; col++) {
- GLushort l, a;
-
- UNCLAMPED_FLOAT_TO_USHORT(l, src[0]);
- UNCLAMPED_FLOAT_TO_USHORT(a, src[1]);
- dstUI[col] = PACK_COLOR_1616(a, l);
- src += 2;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- GLushort l, a;
-
- UNCLAMPED_FLOAT_TO_USHORT(l, src[0]);
- UNCLAMPED_FLOAT_TO_USHORT(a, src[1]);
- dstUI[col] = PACK_COLOR_1616_REV(a, l);
- src += 2;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-_mesa_texstore_r16(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_R16);
- ASSERT(texelBytes == 2);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_R16 &&
- baseInternalFormat == GL_RED &&
- srcFormat == GL_RED &&
- srcType == GL_UNSIGNED_SHORT &&
- littleEndian) {
- /* 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,
- ctx->_ImageTransferState);
- const GLfloat *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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;
-
- UNCLAMPED_FLOAT_TO_USHORT(r, src[0]);
- dstUS[col] = r;
- src += 1;
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-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,
- ctx->_ImageTransferState);
- const GLfloat *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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,
- ctx->_ImageTransferState);
- const GLfloat *src = tempImage;
- const GLuint comps = _mesa_get_format_bytes(dstFormat) / 2;
- GLint img, row, col;
-
- if (!tempImage)
- return GL_FALSE;
-
- /* 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);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_RGB332);
- ASSERT(texelBytes == 1);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_RGB &&
- srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE_3_3_2) {
- /* 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 GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col] = PACK_COLOR_332( CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 3;
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-/**
- * Texstore for _mesa_texformat_a8, _mesa_texformat_l8, _mesa_texformat_i8.
- */
-static GLboolean
-_mesa_texstore_a8(TEXSTORE_PARAMS)
-{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_A8 ||
- dstFormat == MESA_FORMAT_L8 ||
- dstFormat == MESA_FORMAT_I8 ||
- dstFormat == MESA_FORMAT_R8);
- ASSERT(texelBytes == 1);
-
- 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 if (!ctx->_ImageTransferState &&
- srcType == GL_UNSIGNED_BYTE &&
- can_swizzle(baseInternalFormat) &&
- can_swizzle(srcFormat)) {
- GLubyte dstmap[4];
-
- /* dstmap - how to swizzle from RGBA to dst format:
- */
- if (dstFormat == MESA_FORMAT_A8) {
- dstmap[0] = 3;
- }
- else {
- dstmap[0] = 0;
- }
- dstmap[1] = ZERO; /* ? */
- dstmap[2] = ZERO; /* ? */
- dstmap[3] = ONE; /* ? */
-
- _mesa_swizzle_ubyte_image(ctx, dims,
- srcFormat,
- srcType,
- baseInternalFormat,
- dstmap, 1,
- dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcAddr,
- srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col] = CHAN_TO_UBYTE(src[col]);
- }
- dstRow += dstRowStride;
- src += srcWidth;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-
-static GLboolean
-_mesa_texstore_ci8(TEXSTORE_PARAMS)
-{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
-
- (void) dims; (void) baseInternalFormat;
- ASSERT(dstFormat == MESA_FORMAT_CI8);
- ASSERT(texelBytes == 1);
- ASSERT(baseInternalFormat == GL_COLOR_INDEX);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- srcFormat == GL_COLOR_INDEX &&
- 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 */
- GLint img, row;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- const GLvoid *src = _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
- _mesa_unpack_index_span(ctx, srcWidth, GL_UNSIGNED_BYTE, dstRow,
- srcType, src, srcPacking,
- ctx->_ImageTransferState);
- dstRow += dstRowStride;
- }
- }
- }
- return GL_TRUE;
-}
-
-
-/**
- * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_REV.
- */
-static GLboolean
-_mesa_texstore_ycbcr(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
-
- (void) ctx; (void) dims; (void) baseInternalFormat;
-
- ASSERT((dstFormat == MESA_FORMAT_YCBCR) ||
- (dstFormat == MESA_FORMAT_YCBCR_REV));
- ASSERT(texelBytes == 2);
- ASSERT(ctx->Extensions.MESA_ycbcr_texture);
- ASSERT(srcFormat == GL_YCBCR_MESA);
- ASSERT((srcType == GL_UNSIGNED_SHORT_8_8_MESA) ||
- (srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA));
- ASSERT(baseInternalFormat == GL_YCBCR_MESA);
-
- /* always just memcpy since no pixel transfer ops apply */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
-
- /* Check if we need byte swapping */
- /* XXX the logic here _might_ be wrong */
- if (srcPacking->SwapBytes ^
- (srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA) ^
- (dstFormat == MESA_FORMAT_YCBCR_REV) ^
- !littleEndian) {
- GLint img, row;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- _mesa_swap2((GLushort *) dstRow, srcWidth);
- dstRow += dstRowStride;
- }
- }
- }
- return GL_TRUE;
-}
-
-static GLboolean
-_mesa_texstore_dudv8(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_DUDV8);
- ASSERT(texelBytes == 2);
- ASSERT(ctx->Extensions.ATI_envmap_bumpmap);
- ASSERT((srcFormat == GL_DU8DV8_ATI) ||
- (srcFormat == GL_DUDV_ATI));
- ASSERT(baseInternalFormat == GL_DUDV_ATI);
-
- if (!srcPacking->SwapBytes && srcType == GL_BYTE &&
- littleEndian) {
- /* simple memcpy path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (srcType == GL_BYTE) {
- GLubyte dstmap[4];
-
- /* dstmap - how to swizzle from RGBA to dst format:
- */
- if (littleEndian) {
- dstmap[0] = 0;
- dstmap[1] = 3;
- }
- else {
- dstmap[0] = 3;
- dstmap[1] = 0;
- }
- dstmap[2] = ZERO; /* ? */
- dstmap[3] = ONE; /* ? */
-
- _mesa_swizzle_ubyte_image(ctx, dims,
- GL_LUMINANCE_ALPHA, /* hack */
- GL_UNSIGNED_BYTE, /* hack */
- GL_LUMINANCE_ALPHA, /* hack */
- dstmap, 2,
- dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcAddr,
- srcPacking);
- }
- else {
- /* general path - note this is defined for 2d textures only */
- const GLint components = _mesa_components_in_format(baseInternalFormat);
- const GLint srcStride = _mesa_image_row_stride(srcPacking, srcWidth,
- srcFormat, srcType);
- GLbyte *tempImage, *dst, *src;
- GLint row;
-
- tempImage = (GLbyte *) malloc(srcWidth * srcHeight * srcDepth
- * components * sizeof(GLbyte));
- if (!tempImage)
- return GL_FALSE;
-
- src = (GLbyte *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- 0, 0, 0);
-
- dst = tempImage;
- for (row = 0; row < srcHeight; row++) {
- _mesa_unpack_dudv_span_byte(ctx, srcWidth, baseInternalFormat,
- dst, srcFormat, srcType, src,
- srcPacking, 0);
- dst += srcWidth * components;
- src += srcStride;
- }
-
- src = tempImage;
- dst = (GLbyte *) dstAddr
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- memcpy(dst, src, srcWidth * texelBytes);
- dst += dstRowStride;
- src += srcWidth * texelBytes;
- }
- free((void *) tempImage);
- }
- 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,
- ctx->_ImageTransferState);
- const GLfloat *srcRow = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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,
- ctx->_ImageTransferState);
- const GLfloat *srcRow = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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,
- ctx->_ImageTransferState);
- const GLfloat *srcRow = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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
- */
-static GLboolean
-_mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBA8888 ||
- dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV);
- ASSERT(texelBytes == 4);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_SIGNED_RGBA8888 &&
- baseInternalFormat == GL_RGBA &&
- ((srcFormat == GL_RGBA && srcType == GL_BYTE && !littleEndian) ||
- (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && littleEndian))) {
- /* simple memcpy path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV &&
- baseInternalFormat == GL_RGBA &&
- ((srcFormat == GL_RGBA && srcType == GL_BYTE && littleEndian) ||
- (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && !littleEndian))) {
- /* simple memcpy path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- (srcType == GL_BYTE) &&
- can_swizzle(baseInternalFormat) &&
- can_swizzle(srcFormat)) {
-
- GLubyte dstmap[4];
-
- /* dstmap - how to swizzle from RGBA to dst format:
- */
- if ((littleEndian && dstFormat == MESA_FORMAT_SIGNED_RGBA8888) ||
- (!littleEndian && dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV)) {
- dstmap[3] = 0;
- dstmap[2] = 1;
- dstmap[1] = 2;
- dstmap[0] = 3;
- }
- else {
- dstmap[3] = 3;
- dstmap[2] = 2;
- dstmap[1] = 1;
- dstmap[0] = 0;
- }
-
- _mesa_swizzle_ubyte_image(ctx, dims,
- srcFormat,
- srcType,
- baseInternalFormat,
- dstmap, 4,
- dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcAddr,
- srcPacking);
- }
- else {
- /* general path */
- const GLfloat *tempImage = make_temp_float_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking,
- ctx->_ImageTransferState);
- const GLfloat *srcRow = tempImage;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- 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;
- if (dstFormat == MESA_FORMAT_SIGNED_RGBA8888) {
- 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]),
- FLOAT_TO_BYTE_TEX(srcRow[ACOMP]) );
- srcRow += 4;
- }
- }
- else {
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888_REV( FLOAT_TO_BYTE_TEX(srcRow[RCOMP]),
- FLOAT_TO_BYTE_TEX(srcRow[GCOMP]),
- FLOAT_TO_BYTE_TEX(srcRow[BCOMP]),
- FLOAT_TO_BYTE_TEX(srcRow[ACOMP]) );
- srcRow += 4;
- }
- }
- dstRow += dstRowStride;
- }
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-/**
- * Store a combined depth/stencil texture image.
- */
-static GLboolean
-_mesa_texstore_z24_s8(TEXSTORE_PARAMS)
-{
- const GLuint depthScale = 0xffffff;
- const GLint srcRowStride
- = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
- / sizeof(GLuint);
- GLint img, row;
-
- ASSERT(dstFormat == MESA_FORMAT_Z24_S8);
- ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT);
- ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
-
- if (srcFormat != GL_DEPTH_COMPONENT && ctx->Pixel.DepthScale == 1.0f &&
- ctx->Pixel.DepthBias == 0.0f &&
- !srcPacking->SwapBytes) {
- /* simple path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (srcFormat == GL_DEPTH_COMPONENT) {
- /* In case we only upload depth we need to preserve the stencil */
- for (img = 0; img < srcDepth; img++) {
- GLuint *dstRow = (GLuint *) dstAddr
- + dstImageOffsets[dstZoffset + img]
- + dstYoffset * dstRowStride / sizeof(GLuint)
- + dstXoffset;
- const GLuint *src
- = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
- for (row = 0; row < srcHeight; row++) {
- GLuint depth[MAX_WIDTH];
- GLubyte stencil[MAX_WIDTH];
- GLint i;
- GLboolean keepdepth = GL_FALSE, keepstencil = GL_FALSE;
-
- if (srcFormat == GL_DEPTH_COMPONENT) { /* preserve stencil */
- keepstencil = GL_TRUE;
- }
- else if (srcFormat == GL_STENCIL_INDEX) { /* preserve depth */
- keepdepth = GL_TRUE;
- }
-
- if (keepdepth == GL_FALSE)
- /* the 24 depth bits will be in the low position: */
- _mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT, /* dst type */
- keepstencil ? depth : dstRow, /* dst addr */
- depthScale,
- srcType, src, srcPacking);
-
- if (keepstencil == GL_FALSE)
- /* get the 8-bit stencil values */
- _mesa_unpack_stencil_span(ctx, srcWidth,
- GL_UNSIGNED_BYTE, /* dst type */
- stencil, /* dst addr */
- srcType, src, srcPacking,
- ctx->_ImageTransferState);
-
- for (i = 0; i < srcWidth; i++) {
- if (keepstencil)
- dstRow[i] = depth[i] << 8 | (dstRow[i] & 0x000000FF);
- else
- dstRow[i] = (dstRow[i] & 0xFFFFFF00) | (stencil[i] & 0xFF);
- }
-
- src += srcRowStride;
- dstRow += dstRowStride / sizeof(GLuint);
- }
- }
- }
- return GL_TRUE;
-}
-
-
-/**
- * Store a combined depth/stencil texture image.
- */
-static GLboolean
-_mesa_texstore_s8_z24(TEXSTORE_PARAMS)
-{
- const GLuint depthScale = 0xffffff;
- const GLint srcRowStride
- = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
- / sizeof(GLuint);
- GLint img, row;
-
- ASSERT(dstFormat == MESA_FORMAT_S8_Z24);
- ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT ||
- srcFormat == GL_DEPTH_COMPONENT ||
- srcFormat == GL_STENCIL_INDEX);
- ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT ||
- srcType == GL_UNSIGNED_INT_24_8_EXT);
-
- for (img = 0; img < srcDepth; img++) {
- GLuint *dstRow = (GLuint *) dstAddr
- + dstImageOffsets[dstZoffset + img]
- + dstYoffset * dstRowStride / sizeof(GLuint)
- + dstXoffset;
- const GLuint *src
- = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
- for (row = 0; row < srcHeight; row++) {
- GLuint depth[MAX_WIDTH];
- GLubyte stencil[MAX_WIDTH];
- GLint i;
- GLboolean keepdepth = GL_FALSE, keepstencil = GL_FALSE;
-
- if (srcFormat == GL_DEPTH_COMPONENT) { /* preserve stencil */
- keepstencil = GL_TRUE;
- }
- else if (srcFormat == GL_STENCIL_INDEX) { /* preserve depth */
- keepdepth = GL_TRUE;
- }
-
- if (keepdepth == GL_FALSE)
- /* the 24 depth bits will be in the low position: */
- _mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT, /* dst type */
- keepstencil ? depth : dstRow, /* dst addr */
- depthScale,
- srcType, src, srcPacking);
-
- if (keepstencil == GL_FALSE)
- /* get the 8-bit stencil values */
- _mesa_unpack_stencil_span(ctx, srcWidth,
- GL_UNSIGNED_BYTE, /* dst type */
- stencil, /* dst addr */
- srcType, src, srcPacking,
- ctx->_ImageTransferState);
-
- /* merge stencil values into depth values */
- for (i = 0; i < srcWidth; i++) {
- if (keepstencil)
- dstRow[i] = depth[i] | (dstRow[i] & 0xFF000000);
- else
- dstRow[i] = (dstRow[i] & 0xFFFFFF) | (stencil[i] << 24);
-
- }
- src += srcRowStride;
- dstRow += dstRowStride / sizeof(GLuint);
- }
- }
- return GL_TRUE;
-}
-
-
-/**
- * Store simple 8-bit/value stencil texture data.
- */
-static GLboolean
-_mesa_texstore_s8(TEXSTORE_PARAMS)
-{
- ASSERT(dstFormat == MESA_FORMAT_S8);
- ASSERT(srcFormat == GL_STENCIL_INDEX);
-
- 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 {
- const GLint srcRowStride
- = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
- / sizeof(GLuint);
- GLint img, row;
-
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img]
- + dstYoffset * dstRowStride / sizeof(GLuint)
- + dstXoffset;
- const GLuint *src
- = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
- for (row = 0; row < srcHeight; row++) {
- GLubyte stencil[MAX_WIDTH];
- GLint i;
-
- /* get the 8-bit stencil values */
- _mesa_unpack_stencil_span(ctx, srcWidth,
- GL_UNSIGNED_BYTE, /* dst type */
- stencil, /* dst addr */
- srcType, src, srcPacking,
- ctx->_ImageTransferState);
- /* merge stencil values into depth values */
- for (i = 0; i < srcWidth; i++)
- dstRow[i] = stencil[i];
-
- src += srcRowStride;
- dstRow += dstRowStride / sizeof(GLubyte);
- }
- }
-
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Store an image in any of the formats:
- * _mesa_texformat_rgba_float32
- * _mesa_texformat_rgb_float32
- * _mesa_texformat_alpha_float32
- * _mesa_texformat_luminance_float32
- * _mesa_texformat_luminance_alpha_float32
- * _mesa_texformat_intensity_float32
- */
-static GLboolean
-_mesa_texstore_rgba_float32(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_FLOAT32 ||
- dstFormat == MESA_FORMAT_RGB_FLOAT32 ||
- dstFormat == MESA_FORMAT_ALPHA_FLOAT32 ||
- dstFormat == MESA_FORMAT_LUMINANCE_FLOAT32 ||
- dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32 ||
- dstFormat == MESA_FORMAT_INTENSITY_FLOAT32);
- ASSERT(baseInternalFormat == GL_RGBA ||
- baseInternalFormat == GL_RGB ||
- baseInternalFormat == GL_ALPHA ||
- baseInternalFormat == GL_LUMINANCE ||
- baseInternalFormat == GL_LUMINANCE_ALPHA ||
- baseInternalFormat == GL_INTENSITY);
- ASSERT(texelBytes == components * sizeof(GLfloat));
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == srcFormat &&
- srcType == GL_FLOAT) {
- /* 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,
- ctx->_ImageTransferState);
- const GLfloat *srcRow = tempImage;
- GLint bytesPerRow;
- GLint img, row;
- if (!tempImage)
- return GL_FALSE;
- bytesPerRow = srcWidth * components * sizeof(GLfloat);
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- memcpy(dstRow, srcRow, bytesPerRow);
- dstRow += dstRowStride;
- srcRow += srcWidth * components;
- }
- }
-
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-
-/**
- * As above, but store 16-bit floats.
- */
-static GLboolean
-_mesa_texstore_rgba_float16(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_FLOAT16 ||
- dstFormat == MESA_FORMAT_RGB_FLOAT16 ||
- dstFormat == MESA_FORMAT_ALPHA_FLOAT16 ||
- dstFormat == MESA_FORMAT_LUMINANCE_FLOAT16 ||
- dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16 ||
- dstFormat == MESA_FORMAT_INTENSITY_FLOAT16);
- ASSERT(baseInternalFormat == GL_RGBA ||
- baseInternalFormat == GL_RGB ||
- baseInternalFormat == GL_ALPHA ||
- baseInternalFormat == GL_LUMINANCE ||
- baseInternalFormat == GL_LUMINANCE_ALPHA ||
- baseInternalFormat == GL_INTENSITY);
- ASSERT(texelBytes == components * sizeof(GLhalfARB));
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == srcFormat &&
- srcType == GL_HALF_FLOAT_ARB) {
- /* 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,
- ctx->_ImageTransferState);
- const GLfloat *src = tempImage;
- GLint img, row;
- if (!tempImage)
- return GL_FALSE;
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- GLhalfARB *dstTexel = (GLhalfARB *) dstRow;
- GLint i;
- for (i = 0; i < srcWidth * components; i++) {
- dstTexel[i] = _mesa_float_to_half(src[i]);
- }
- dstRow += dstRowStride;
- src += srcWidth * components;
- }
- }
-
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-/* 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));
-
- /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply
- * to integer formats.
- */
- if (!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, 0x0);
- const GLfloat *src = tempImage;
- GLint img, row;
- if (!tempImage)
- return GL_FALSE;
- 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));
-
- /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply
- * to integer formats.
- */
- if (!srcPacking->SwapBytes &&
- baseInternalFormat == srcFormat &&
- 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, 0x0);
- const GLfloat *src = tempImage;
- GLint img, row;
- if (!tempImage)
- return GL_FALSE;
- 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));
-
- /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply
- * to integer formats.
- */
- if (!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, 0x0);
- const GLfloat *src = tempImage;
- GLint img, row;
- if (!tempImage)
- return GL_FALSE;
- 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));
-
- /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply
- * to integer formats.
- */
- if (!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 GLuint *tempImage =
- make_temp_uint_image(ctx, dims, baseInternalFormat, baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr, srcPacking);
- const GLuint *src = tempImage;
- GLint img, row;
- if (!tempImage)
- return GL_FALSE;
- 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) CLAMP(src[i], 0, 0xff);
- }
- 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));
-
- /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply
- * to integer formats.
- */
- if (!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 GLuint *tempImage =
- make_temp_uint_image(ctx, dims, baseInternalFormat, baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr, srcPacking);
- const GLuint *src = tempImage;
- GLint img, row;
- if (!tempImage)
- return GL_FALSE;
- 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) CLAMP(src[i], 0, 0xffff);
- }
- 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));
-
- /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply
- * to integer formats.
- */
- if (!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 GLuint *tempImage =
- make_temp_uint_image(ctx, dims, baseInternalFormat, baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr, srcPacking);
- const GLuint *src = tempImage;
- GLint img, row;
- if (!tempImage)
- return GL_FALSE;
- 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] = 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)
-{
- gl_format newDstFormat;
- GLboolean k;
-
- ASSERT(dstFormat == MESA_FORMAT_SRGB8);
-
- /* reuse normal rgb texstore code */
- newDstFormat = MESA_FORMAT_RGB888;
-
- k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat,
- newDstFormat, dstAddr,
- dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType,
- srcAddr, srcPacking);
- return k;
-}
-
-
-static GLboolean
-_mesa_texstore_srgba8(TEXSTORE_PARAMS)
-{
- gl_format newDstFormat;
- GLboolean k;
-
- ASSERT(dstFormat == MESA_FORMAT_SRGBA8);
-
- /* reuse normal rgba texstore code */
- newDstFormat = MESA_FORMAT_RGBA8888;
- k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat,
- newDstFormat, dstAddr,
- dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType,
- srcAddr, srcPacking);
- return k;
-}
-
-
-static GLboolean
-_mesa_texstore_sargb8(TEXSTORE_PARAMS)
-{
- gl_format newDstFormat;
- GLboolean k;
-
- ASSERT(dstFormat == MESA_FORMAT_SARGB8);
-
- /* reuse normal rgba texstore code */
- newDstFormat = MESA_FORMAT_ARGB8888;
-
- k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat,
- newDstFormat, dstAddr,
- dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType,
- srcAddr, srcPacking);
- return k;
-}
-
-
-static GLboolean
-_mesa_texstore_sl8(TEXSTORE_PARAMS)
-{
- gl_format newDstFormat;
- GLboolean k;
-
- ASSERT(dstFormat == MESA_FORMAT_SL8);
-
- newDstFormat = MESA_FORMAT_L8;
-
- /* _mesa_textore_a8 handles luminance8 too */
- k = _mesa_texstore_a8(ctx, dims, baseInternalFormat,
- newDstFormat, dstAddr,
- dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType,
- srcAddr, srcPacking);
- return k;
-}
-
-
-static GLboolean
-_mesa_texstore_sla8(TEXSTORE_PARAMS)
-{
- gl_format newDstFormat;
- GLboolean k;
-
- ASSERT(dstFormat == MESA_FORMAT_SLA8);
-
- /* reuse normal luminance/alpha texstore code */
- newDstFormat = MESA_FORMAT_AL88;
-
- k = _mesa_texstore_unorm88(ctx, dims, baseInternalFormat,
- newDstFormat, dstAddr,
- dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType,
- srcAddr, srcPacking);
- return k;
-}
-
-#else
-
-/* these are used only in texstore_funcs[] below */
-#define _mesa_texstore_srgb8 NULL
-#define _mesa_texstore_srgba8 NULL
-#define _mesa_texstore_sargb8 NULL
-#define _mesa_texstore_sl8 NULL
-#define _mesa_texstore_sla8 NULL
-
-#endif /* FEATURE_EXT_texture_sRGB */
-
-
-
-
-/**
- * Table mapping MESA_FORMAT_* to _mesa_texstore_*()
- * XXX this is somewhat temporary.
- */
-static const struct {
- gl_format Name;
- StoreTexImageFunc Store;
-}
-texstore_funcs[MESA_FORMAT_COUNT] =
-{
- { MESA_FORMAT_NONE, NULL },
- { MESA_FORMAT_RGBA8888, _mesa_texstore_rgba8888 },
- { MESA_FORMAT_RGBA8888_REV, _mesa_texstore_rgba8888 },
- { MESA_FORMAT_ARGB8888, _mesa_texstore_argb8888 },
- { MESA_FORMAT_ARGB8888_REV, _mesa_texstore_argb8888 },
- { MESA_FORMAT_XRGB8888, _mesa_texstore_argb8888 },
- { MESA_FORMAT_XRGB8888_REV, _mesa_texstore_argb8888 },
- { MESA_FORMAT_RGB888, _mesa_texstore_rgb888 },
- { MESA_FORMAT_BGR888, _mesa_texstore_bgr888 },
- { MESA_FORMAT_RGB565, _mesa_texstore_rgb565 },
- { MESA_FORMAT_RGB565_REV, _mesa_texstore_rgb565 },
- { MESA_FORMAT_ARGB4444, _mesa_texstore_argb4444 },
- { MESA_FORMAT_ARGB4444_REV, _mesa_texstore_argb4444 },
- { MESA_FORMAT_RGBA5551, _mesa_texstore_rgba5551 },
- { MESA_FORMAT_ARGB1555, _mesa_texstore_argb1555 },
- { MESA_FORMAT_ARGB1555_REV, _mesa_texstore_argb1555 },
- { MESA_FORMAT_AL88, _mesa_texstore_unorm88 },
- { MESA_FORMAT_AL88_REV, _mesa_texstore_unorm88 },
- { MESA_FORMAT_AL1616, _mesa_texstore_unorm1616 },
- { MESA_FORMAT_AL1616_REV, _mesa_texstore_unorm1616 },
- { MESA_FORMAT_RGB332, _mesa_texstore_rgb332 },
- { MESA_FORMAT_A8, _mesa_texstore_a8 },
- { MESA_FORMAT_L8, _mesa_texstore_a8 },
- { MESA_FORMAT_I8, _mesa_texstore_a8 },
- { MESA_FORMAT_CI8, _mesa_texstore_ci8 },
- { MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr },
- { MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr },
- { MESA_FORMAT_R8, _mesa_texstore_a8 },
- { MESA_FORMAT_RG88, _mesa_texstore_unorm88 },
- { MESA_FORMAT_RG88_REV, _mesa_texstore_unorm88 },
- { MESA_FORMAT_R16, _mesa_texstore_r16 },
- { MESA_FORMAT_RG1616, _mesa_texstore_unorm1616 },
- { MESA_FORMAT_RG1616_REV, _mesa_texstore_unorm1616 },
- { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 },
- { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 },
- { MESA_FORMAT_Z16, _mesa_texstore_z16 },
- { MESA_FORMAT_X8_Z24, _mesa_texstore_x8_z24 },
- { MESA_FORMAT_Z24_X8, _mesa_texstore_z24_x8 },
- { MESA_FORMAT_Z32, _mesa_texstore_z32 },
- { MESA_FORMAT_S8, _mesa_texstore_s8 },
- { MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 },
- { MESA_FORMAT_SRGBA8, _mesa_texstore_srgba8 },
- { MESA_FORMAT_SARGB8, _mesa_texstore_sargb8 },
- { MESA_FORMAT_SL8, _mesa_texstore_sl8 },
- { MESA_FORMAT_SLA8, _mesa_texstore_sla8 },
- { MESA_FORMAT_SRGB_DXT1, _mesa_texstore_rgb_dxt1 },
- { MESA_FORMAT_SRGBA_DXT1, _mesa_texstore_rgba_dxt1 },
- { MESA_FORMAT_SRGBA_DXT3, _mesa_texstore_rgba_dxt3 },
- { MESA_FORMAT_SRGBA_DXT5, _mesa_texstore_rgba_dxt5 },
- { MESA_FORMAT_RGB_FXT1, _mesa_texstore_rgb_fxt1 },
- { MESA_FORMAT_RGBA_FXT1, _mesa_texstore_rgba_fxt1 },
- { MESA_FORMAT_RGB_DXT1, _mesa_texstore_rgb_dxt1 },
- { MESA_FORMAT_RGBA_DXT1, _mesa_texstore_rgba_dxt1 },
- { MESA_FORMAT_RGBA_DXT3, _mesa_texstore_rgba_dxt3 },
- { MESA_FORMAT_RGBA_DXT5, _mesa_texstore_rgba_dxt5 },
- { MESA_FORMAT_RGBA_FLOAT32, _mesa_texstore_rgba_float32 },
- { MESA_FORMAT_RGBA_FLOAT16, _mesa_texstore_rgba_float16 },
- { MESA_FORMAT_RGB_FLOAT32, _mesa_texstore_rgba_float32 },
- { MESA_FORMAT_RGB_FLOAT16, _mesa_texstore_rgba_float16 },
- { MESA_FORMAT_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 },
- { MESA_FORMAT_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 },
- { MESA_FORMAT_LUMINANCE_FLOAT32, _mesa_texstore_rgba_float32 },
- { MESA_FORMAT_LUMINANCE_FLOAT16, _mesa_texstore_rgba_float16 },
- { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 },
- { 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_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 }
-};
-
-
-static GLboolean
-_mesa_texstore_null(TEXSTORE_PARAMS)
-{
- (void) ctx; (void) dims;
- (void) baseInternalFormat;
- (void) dstFormat;
- (void) dstAddr;
- (void) dstXoffset; (void) dstYoffset; (void) dstZoffset;
- (void) dstRowStride; (void) dstImageOffsets;
- (void) srcWidth; (void) srcHeight; (void) srcDepth;
- (void) srcFormat; (void) srcType;
- (void) srcAddr;
- (void) srcPacking;
-
- /* should never happen */
- _mesa_problem(NULL, "_mesa_texstore_null() is called");
- return GL_FALSE;
-}
-
-
-/**
- * Return the StoreTexImageFunc pointer to store an image in the given format.
- */
-static StoreTexImageFunc
-_mesa_get_texstore_func(gl_format format)
-{
-#ifdef DEBUG
- GLuint i;
- for (i = 0; i < MESA_FORMAT_COUNT; i++) {
- ASSERT(texstore_funcs[i].Name == i);
- }
-#endif
- ASSERT(texstore_funcs[format].Name == format);
-
- if (texstore_funcs[format].Store)
- return texstore_funcs[format].Store;
- else
- return _mesa_texstore_null;
-}
-
-
-/**
- * Store user data into texture memory.
- * Called via glTex[Sub]Image1/2/3D()
- */
-GLboolean
-_mesa_texstore(TEXSTORE_PARAMS)
-{
- StoreTexImageFunc storeImage;
- GLboolean success;
-
- storeImage = _mesa_get_texstore_func(dstFormat);
-
- success = storeImage(ctx, dims, baseInternalFormat,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr, srcPacking);
- return success;
-}
-
-
-/**
- * Check if an unpack PBO is active prior to fetching a texture image.
- * If so, do bounds checking and map the buffer into main memory.
- * Any errors detected will be recorded.
- * The caller _must_ call _mesa_unmap_teximage_pbo() too!
- */
-const GLvoid *
-_mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *unpack,
- const char *funcName)
-{
- GLubyte *buf;
-
- if (!_mesa_is_bufferobj(unpack->BufferObj)) {
- /* no PBO */
- return pixels;
- }
- if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
- format, type, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access)");
- return NULL;
- }
-
- buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
- GL_READ_ONLY_ARB, unpack->BufferObj);
- if (!buf) {
- _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped)");
- return NULL;
- }
-
- return ADD_POINTERS(buf, pixels);
-}
-
-
-/**
- * Check if an unpack PBO is active prior to fetching a compressed texture
- * image.
- * If so, do bounds checking and map the buffer into main memory.
- * Any errors detected will be recorded.
- * The caller _must_ call _mesa_unmap_teximage_pbo() too!
- */
-const GLvoid *
-_mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
- GLsizei imageSize, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- const char *funcName)
-{
- GLubyte *buf;
-
- if (!_mesa_is_bufferobj(packing->BufferObj)) {
- /* not using a PBO - return pointer unchanged */
- return pixels;
- }
- if ((const GLubyte *) pixels + imageSize >
- ((const GLubyte *) 0) + packing->BufferObj->Size) {
- /* out of bounds read! */
- _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access)");
- return NULL;
- }
-
- buf = (GLubyte*) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
- GL_READ_ONLY_ARB, packing->BufferObj);
- if (!buf) {
- _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped");
- return NULL;
- }
-
- return ADD_POINTERS(buf, pixels);
-}
-
-
-/**
- * This function must be called after either of the validate_pbo_*_teximage()
- * functions. It unmaps the PBO buffer if it was mapped earlier.
- */
-void
-_mesa_unmap_teximage_pbo(struct gl_context *ctx,
- const struct gl_pixelstore_attrib *unpack)
-{
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
- ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
- unpack->BufferObj);
- }
-}
-
-
-/** Return texture size in bytes */
-static GLuint
-texture_size(const struct gl_texture_image *texImage)
-{
- GLuint sz = _mesa_format_image_size(texImage->TexFormat, texImage->Width,
- texImage->Height, texImage->Depth);
- return sz;
-}
-
-
-/** Return row stride in bytes */
-static GLuint
-texture_row_stride(const struct gl_texture_image *texImage)
-{
- GLuint stride = _mesa_format_row_stride(texImage->TexFormat,
- texImage->Width);
- return stride;
-}
-
-
-
-/**
- * This is the software fallback for Driver.TexImage1D()
- * and Driver.CopyTexImage1D().
- * \sa _mesa_store_teximage2d()
- */
-void
-_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- GLuint sizeInBytes;
- (void) border;
-
- /* allocate memory */
- sizeInBytes = texture_size(texImage);
- texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
- if (!texImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- return;
- }
-
- pixels = _mesa_validate_pbo_teximage(ctx, 1, width, 1, 1, format, type,
- pixels, packing, "glTexImage1D");
- if (!pixels) {
- /* Note: we check for a NULL image pointer here, _after_ we allocated
- * memory for the texture. That's what the GL spec calls for.
- */
- return;
- }
- else {
- const GLint dstRowStride = 0;
- GLboolean success = _mesa_texstore(ctx, 1, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- texImage->ImageOffsets,
- width, 1, 1,
- format, type, pixels, packing);
- if (!success) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- }
- }
-
- _mesa_unmap_teximage_pbo(ctx, packing);
-}
-
-
-/**
- * This is the software fallback for Driver.TexImage2D()
- * and Driver.CopyTexImage2D().
- *
- * This function is oriented toward storing images in main memory, rather
- * than VRAM. Device driver's can easily plug in their own replacement.
- */
-void
-_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- GLuint sizeInBytes;
- (void) border;
-
- /* allocate memory */
- sizeInBytes = texture_size(texImage);
- texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
- if (!texImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
-
- pixels = _mesa_validate_pbo_teximage(ctx, 2, width, height, 1, format, type,
- pixels, packing, "glTexImage2D");
- if (!pixels) {
- /* Note: we check for a NULL image pointer here, _after_ we allocated
- * memory for the texture. That's what the GL spec calls for.
- */
- return;
- }
- else {
- GLint dstRowStride = texture_row_stride(texImage);
- GLboolean success = _mesa_texstore(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- texImage->ImageOffsets,
- width, height, 1,
- format, type, pixels, packing);
- if (!success) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- }
- }
-
- _mesa_unmap_teximage_pbo(ctx, packing);
-}
-
-
-
-/**
- * This is the software fallback for Driver.TexImage3D()
- * and Driver.CopyTexImage3D().
- * \sa _mesa_store_teximage2d()
- */
-void
-_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth, GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- GLuint sizeInBytes;
- (void) border;
-
- /* allocate memory */
- sizeInBytes = texture_size(texImage);
- texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
- if (!texImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
- return;
- }
-
- pixels = _mesa_validate_pbo_teximage(ctx, 3, width, height, depth, format,
- type, pixels, packing, "glTexImage3D");
- if (!pixels) {
- /* Note: we check for a NULL image pointer here, _after_ we allocated
- * memory for the texture. That's what the GL spec calls for.
- */
- return;
- }
- else {
- GLint dstRowStride = texture_row_stride(texImage);
- GLboolean success = _mesa_texstore(ctx, 3, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- texImage->ImageOffsets,
- width, height, depth,
- format, type, pixels, packing);
- if (!success) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
- }
- }
-
- _mesa_unmap_teximage_pbo(ctx, packing);
-}
-
-
-
-
-/*
- * This is the software fallback for Driver.TexSubImage1D()
- * and Driver.CopyTexSubImage1D().
- */
-void
-_mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint width,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- /* get pointer to src pixels (may be in a pbo which we'll map here) */
- pixels = _mesa_validate_pbo_teximage(ctx, 1, width, 1, 1, format, type,
- pixels, packing, "glTexSubImage1D");
- if (!pixels)
- return;
-
- {
- const GLint dstRowStride = 0;
- GLboolean success = _mesa_texstore(ctx, 1, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, 0, 0, /* offsets */
- dstRowStride,
- texImage->ImageOffsets,
- width, 1, 1,
- format, type, pixels, packing);
- if (!success) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
- }
- }
-
- _mesa_unmap_teximage_pbo(ctx, packing);
-}
-
-
-
-/**
- * This is the software fallback for Driver.TexSubImage2D()
- * and Driver.CopyTexSubImage2D().
- */
-void
-_mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint width, GLint height,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- /* get pointer to src pixels (may be in a pbo which we'll map here) */
- pixels = _mesa_validate_pbo_teximage(ctx, 2, width, height, 1, format, type,
- pixels, packing, "glTexSubImage2D");
- if (!pixels)
- return;
-
- {
- GLint dstRowStride = texture_row_stride(texImage);
- GLboolean success = _mesa_texstore(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, yoffset, 0,
- dstRowStride,
- texImage->ImageOffsets,
- width, height, 1,
- format, type, pixels, packing);
- if (!success) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- }
- }
-
- _mesa_unmap_teximage_pbo(ctx, packing);
-}
-
-
-/*
- * This is the software fallback for Driver.TexSubImage3D().
- * and Driver.CopyTexSubImage3D().
- */
-void
-_mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint width, GLint height, GLint depth,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- /* get pointer to src pixels (may be in a pbo which we'll map here) */
- pixels = _mesa_validate_pbo_teximage(ctx, 3, width, height, depth, format,
- type, pixels, packing,
- "glTexSubImage3D");
- if (!pixels)
- return;
-
- {
- GLint dstRowStride = texture_row_stride(texImage);
- GLboolean success = _mesa_texstore(ctx, 3, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, yoffset, zoffset,
- dstRowStride,
- texImage->ImageOffsets,
- width, height, depth,
- format, type, pixels, packing);
- if (!success) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D");
- }
- }
-
- _mesa_unmap_teximage_pbo(ctx, packing);
-}
-
-
-/*
- * Fallback for Driver.CompressedTexImage1D()
- */
-void
-_mesa_store_compressed_teximage1d(struct gl_context *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- /* this space intentionally left blank */
- (void) ctx;
- (void) target; (void) level;
- (void) internalFormat;
- (void) width; (void) border;
- (void) imageSize; (void) data;
- (void) texObj;
- (void) texImage;
-}
-
-
-
-/**
- * Fallback for Driver.CompressedTexImage2D()
- */
-void
-_mesa_store_compressed_teximage2d(struct gl_context *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- (void) width; (void) height; (void) border;
-
- /* This is pretty simple, basically just do a memcpy without worrying
- * about the usual image unpacking or image transfer operations.
- */
- ASSERT(texObj);
- ASSERT(texImage);
- ASSERT(texImage->Width > 0);
- ASSERT(texImage->Height > 0);
- ASSERT(texImage->Depth == 1);
- ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */
-
- /* allocate storage */
- texImage->Data = _mesa_alloc_texmemory(imageSize);
- if (!texImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
- return;
- }
-
- data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data,
- &ctx->Unpack,
- "glCompressedTexImage2D");
- if (!data)
- return;
-
- /* copy the data */
- memcpy(texImage->Data, data, imageSize);
-
- _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack);
-}
-
-
-
-/*
- * Fallback for Driver.CompressedTexImage3D()
- */
-void
-_mesa_store_compressed_teximage3d(struct gl_context *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- /* this space intentionally left blank */
- (void) ctx;
- (void) target; (void) level;
- (void) internalFormat;
- (void) width; (void) height; (void) depth;
- (void) border;
- (void) imageSize; (void) data;
- (void) texObj;
- (void) texImage;
-}
-
-
-
-/**
- * Fallback for Driver.CompressedTexSubImage1D()
- */
-void
-_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target,
- GLint level,
- GLint xoffset, GLsizei width,
- GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- /* there are no compressed 1D texture formats yet */
- (void) ctx;
- (void) target; (void) level;
- (void) xoffset; (void) width;
- (void) format;
- (void) imageSize; (void) data;
- (void) texObj;
- (void) texImage;
-}
-
-
-/**
- * Fallback for Driver.CompressedTexSubImage2D()
- */
-void
-_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- GLint bytesPerRow, destRowStride, srcRowStride;
- GLint i, rows;
- GLubyte *dest;
- const GLubyte *src;
- const gl_format texFormat = texImage->TexFormat;
- const GLint destWidth = texImage->Width;
- GLuint bw, bh;
-
- _mesa_get_format_block_size(texFormat, &bw, &bh);
-
- (void) level;
- (void) format;
-
- /* these should have been caught sooner */
- ASSERT((width % bw) == 0 || width == 2 || width == 1);
- ASSERT((height % bh) == 0 || height == 2 || height == 1);
- ASSERT((xoffset % bw) == 0);
- ASSERT((yoffset % bh) == 0);
-
- /* get pointer to src pixels (may be in a pbo which we'll map here) */
- data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data,
- &ctx->Unpack,
- "glCompressedTexSubImage2D");
- if (!data)
- return;
-
- srcRowStride = _mesa_format_row_stride(texFormat, width);
- src = (const GLubyte *) data;
-
- destRowStride = _mesa_format_row_stride(texFormat, destWidth);
- dest = _mesa_compressed_image_address(xoffset, yoffset, 0,
- texFormat, destWidth,
- (GLubyte *) texImage->Data);
-
- bytesPerRow = srcRowStride; /* bytes per row of blocks */
- rows = height / bh; /* rows in blocks */
-
- /* copy rows of blocks */
- for (i = 0; i < rows; i++) {
- memcpy(dest, src, bytesPerRow);
- dest += destRowStride;
- src += srcRowStride;
- }
-
- _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack);
-}
-
-
-/**
- * Fallback for Driver.CompressedTexSubImage3D()
- */
-void
-_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- /* there are no compressed 3D texture formats yet */
- (void) ctx;
- (void) target; (void) level;
- (void) xoffset; (void) yoffset; (void) zoffset;
- (void) width; (void) height; (void) depth;
- (void) format;
- (void) imageSize; (void) data;
- (void) texObj;
- (void) texImage;
-}
diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h
deleted file mode 100644
index 177ede4..0000000
--- a/src/mesa/main/texstore.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.1
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- * Copyright (c) 2008 VMware, 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
- * 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 texstore.h
- * Texture image storage routines.
- *
- * \author Brian Paul
- */
-
-
-#ifndef TEXSTORE_H
-#define TEXSTORE_H
-
-
-#include "mtypes.h"
-#include "formats.h"
-
-
-/**
- * This macro defines the (many) parameters to the texstore functions.
- * \param dims either 1 or 2 or 3
- * \param baseInternalFormat user-specified base internal format
- * \param dstFormat destination Mesa texture format
- * \param dstAddr destination image address
- * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels
- * \param dstRowStride destination image row stride, in bytes
- * \param dstImageOffsets offset of each 2D slice within 3D texture, in texels
- * \param srcWidth/Height/Depth source image size, in pixels
- * \param srcFormat incoming image format
- * \param srcType incoming image data type
- * \param srcAddr source image address
- * \param srcPacking source image packing parameters
- */
-#define TEXSTORE_PARAMS \
- struct gl_context *ctx, GLuint dims, \
- GLenum baseInternalFormat, \
- gl_format dstFormat, \
- GLvoid *dstAddr, \
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
- GLint dstRowStride, const GLuint *dstImageOffsets, \
- GLint srcWidth, GLint srcHeight, GLint srcDepth, \
- GLenum srcFormat, GLenum srcType, \
- const GLvoid *srcAddr, \
- const struct gl_pixelstore_attrib *srcPacking
-
-
-extern GLboolean
-_mesa_texstore(TEXSTORE_PARAMS);
-
-
-extern GLchan *
-_mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims,
- GLenum logicalBaseFormat,
- GLenum textureBaseFormat,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking);
-
-
-extern void
-_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint width,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint width, GLint height,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint width, GLint height, GLint depth,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_store_compressed_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-extern void
-_mesa_store_compressed_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-extern void
-_mesa_store_compressed_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target,
- GLint level,
- GLint xoffset, GLsizei width,
- GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-extern void
-_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-extern void
-_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-
-extern const GLvoid *
-_mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *unpack,
- const char *funcName);
-
-extern const GLvoid *
-_mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
- GLsizei imageSize, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- const char *funcName);
-
-extern void
-_mesa_unmap_teximage_pbo(struct gl_context *ctx,
- const struct gl_pixelstore_attrib *unpack);
-
-
-#endif
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
deleted file mode 100644
index d297b5e..0000000
--- a/src/mesa/main/transformfeedback.c
+++ /dev/null
@@ -1,944 +0,0 @@
-/*
- * 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(struct gl_context *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(struct gl_context *ctx)
-{
- /* XXX to do */
- return GL_TRUE;
-}
-
-
-
-/**
- * Per-context init for transform feedback.
- */
-void
-_mesa_init_transform_feedback(struct gl_context *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)
-{
- struct gl_context *ctx = (struct gl_context *) 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(struct gl_context *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(struct gl_context *ctx, GLuint name);
-
-static void
-delete_transform_feedback(struct gl_context *ctx,
- struct gl_transform_feedback_object *obj);
-
-/* dummy per-context init/clean-up for transform feedback */
-void
-_mesa_init_transform_feedback(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *ctx, GLenum mode,
- struct gl_transform_feedback_object *obj)
-{
- /* nop */
-}
-
-/** Default fallback for ctx->Driver.EndTransformFeedback() */
-static void
-end_transform_feedback(struct gl_context *ctx,
- struct gl_transform_feedback_object *obj)
-{
- /* nop */
-}
-
-/** Default fallback for ctx->Driver.PauseTransformFeedback() */
-static void
-pause_transform_feedback(struct gl_context *ctx,
- struct gl_transform_feedback_object *obj)
-{
- /* nop */
-}
-
-/** Default fallback for ctx->Driver.ResumeTransformFeedback() */
-static void
-resume_transform_feedback(struct gl_context *ctx,
- struct gl_transform_feedback_object *obj)
-{
- /* nop */
-}
-
-/** Default fallback for ctx->Driver.DrawTransformFeedback() */
-static void
-draw_transform_feedback(struct gl_context *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(struct gl_context *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(struct gl_context *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/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h
deleted file mode 100644
index b0d5b70..0000000
--- a/src/mesa/main/transformfeedback.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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 "compiler.h"
-#include "glheader.h"
-#include "mfeatures.h"
-
-struct _glapi_table;
-struct dd_function_table;
-struct gl_context;
-
-extern void
-_mesa_init_transform_feedback(struct gl_context *ctx);
-
-extern void
-_mesa_free_transform_feedback(struct gl_context *ctx);
-
-#if FEATURE_EXT_transform_feedback
-
-extern GLboolean
-_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode);
-
-extern GLboolean
-_mesa_validate_transform_feedback_buffers(struct gl_context *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(struct gl_context *ctx, GLenum mode)
-{
- return GL_TRUE;
-}
-
-static INLINE GLboolean
-_mesa_validate_transform_feedback_buffers(struct gl_context *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/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
deleted file mode 100644
index d61856d..0000000
--- a/src/mesa/main/uniforms.c
+++ /dev/null
@@ -1,1662 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2004-2008 Brian Paul All Rights Reserved.
- * Copyright (C) 2009-2010 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 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"
-#include "program/prog_instruction.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 struct gl_builtin_uniform_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 gl_builtin_uniform_element gl_ClipPlane_elements[] = {
- {NULL, {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW}
-};
-
-static struct gl_builtin_uniform_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 gl_builtin_uniform_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 gl_builtin_uniform_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 gl_builtin_uniform_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},
- MAKE_SWIZZLE4(SWIZZLE_X,
- SWIZZLE_Y,
- SWIZZLE_Z,
- SWIZZLE_Z)},
- {"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 gl_builtin_uniform_element gl_LightModel_elements[] = {
- {"ambient", {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_element gl_FrontLightModelProduct_elements[] = {
- {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_element gl_BackLightModelProduct_elements[] = {
- {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_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 gl_builtin_uniform_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 gl_builtin_uniform_element gl_TextureEnvColor_elements[] = {
- {NULL, {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_element gl_EyePlaneS_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_S}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_element gl_EyePlaneT_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_T}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_element gl_EyePlaneR_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_R}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_element gl_EyePlaneQ_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_Q}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_element gl_ObjectPlaneS_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_S}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_element gl_ObjectPlaneT_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_T}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_element gl_ObjectPlaneR_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_R}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_element gl_ObjectPlaneQ_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW},
-};
-
-static struct gl_builtin_uniform_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 gl_builtin_uniform_element gl_NormalScale_elements[] = {
- {NULL, {STATE_NORMAL_SCALE}, SWIZZLE_XXXX},
-};
-
-#define MATRIX(name, statevar, modifier) \
- static struct gl_builtin_uniform_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 gl_builtin_uniform_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)}
-
-const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[] = {
- 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),
-
- {NULL, NULL, 0}
-};
-
-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(struct gl_context *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(struct gl_context *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(struct gl_context *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, &paramPos);
-
- 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(struct gl_context *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, &paramPos);
-
- 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 glGetUniformuiv().
- * New in GL_EXT_gpu_shader4, OpenGL 3.0
- * \sa _mesa_get_uniformfv, only difference is a cast.
- */
-static void
-_mesa_get_uniformuiv(struct gl_context *ctx, GLuint program, GLint location,
- GLuint *params)
-{
- struct gl_program *prog;
- GLint paramPos;
- GLint offset;
-
- split_location_offset(&location, &offset);
-
- lookup_uniform_parameter(ctx, program, location, &prog, &paramPos);
-
- 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++] = (GLuint) 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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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(struct gl_context *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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, location, 1, v, GL_FLOAT_VEC4);
-}
-
-void GLAPIENTRY
-_mesa_Uniform1iARB(GLint location, GLint v0)
-{
- GET_CURRENT_CONTEXT(ctx);
- _mesa_uniform(ctx, ctx->Shader.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram, 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.ActiveProgram,
- 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.ActiveProgram,
- 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.ActiveProgram,
- 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.ActiveProgram,
- 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.ActiveProgram,
- 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.ActiveProgram,
- 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.ActiveProgram,
- 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.ActiveProgram,
- 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.ActiveProgram,
- 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);
-}
-
-
-/* GL3 */
-void GLAPIENTRY
-_mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- _mesa_get_uniformuiv(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 */
- SET_Uniform1uiEXT(exec, _mesa_Uniform1ui);
- SET_Uniform2uiEXT(exec, _mesa_Uniform2ui);
- SET_Uniform3uiEXT(exec, _mesa_Uniform3ui);
- SET_Uniform4uiEXT(exec, _mesa_Uniform4ui);
- SET_Uniform1uivEXT(exec, _mesa_Uniform1uiv);
- SET_Uniform2uivEXT(exec, _mesa_Uniform2uiv);
- SET_Uniform3uivEXT(exec, _mesa_Uniform3uiv);
- SET_Uniform4uivEXT(exec, _mesa_Uniform4uiv);
- SET_GetUniformuivEXT(exec, _mesa_GetUniformuiv);
-
-
-#endif /* FEATURE_GL */
-}
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
deleted file mode 100644
index 54abb08..0000000
--- a/src/mesa/main/uniforms.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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"
-#include "program/prog_parameter.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 void GLAPIENTRY
-_mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params);
-
-extern GLint GLAPIENTRY
-_mesa_GetUniformLocationARB(GLhandleARB, const GLcharARB *);
-
-GLint
-_mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg,
- const GLchar *name);
-
-void
-_mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program,
- GLint location, GLsizei count,
- const GLvoid *values, GLenum type);
-
-void
-_mesa_uniform_matrix(struct gl_context *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);
-
-struct gl_builtin_uniform_element {
- const char *field;
- int tokens[STATE_LENGTH];
- int swizzle;
-};
-
-struct gl_builtin_uniform_desc {
- const char *name;
- struct gl_builtin_uniform_element *elements;
- unsigned int num_elements;
-};
-
-extern const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[];
-
-#endif /* UNIFORMS_H */
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
deleted file mode 100644
index 32bf95e..0000000
--- a/src/mesa/main/varray.c
+++ /dev/null
@@ -1,1172 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.6
- *
- * Copyright (C) 1999-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 "glheader.h"
-#include "imports.h"
-#include "bufferobj.h"
-#include "context.h"
-#include "enable.h"
-#include "enums.h"
-#include "hash.h"
-#include "image.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "varray.h"
-#include "arrayobj.h"
-#include "main/dispatch.h"
-
-
-/** Used to do error checking for GL_EXT_vertex_array_bgra */
-#define BGRA_OR_4 5
-
-
-/** Used to indicate which GL datatypes are accepted by each of the
- * glVertex/Color/Attrib/EtcPointer() functions.
- */
-#define BOOL_BIT 0x1
-#define BYTE_BIT 0x2
-#define UNSIGNED_BYTE_BIT 0x4
-#define SHORT_BIT 0x8
-#define UNSIGNED_SHORT_BIT 0x10
-#define INT_BIT 0x20
-#define UNSIGNED_INT_BIT 0x40
-#define HALF_BIT 0x80
-#define FLOAT_BIT 0x100
-#define DOUBLE_BIT 0x200
-#define FIXED_BIT 0x400
-
-
-
-/** Convert GL datatype enum into a <type>_BIT value seen above */
-static GLbitfield
-type_to_bit(const struct gl_context *ctx, GLenum type)
-{
- switch (type) {
- case GL_BOOL:
- return BOOL_BIT;
- case GL_BYTE:
- return BYTE_BIT;
- case GL_UNSIGNED_BYTE:
- return UNSIGNED_BYTE_BIT;
- case GL_SHORT:
- return SHORT_BIT;
- case GL_UNSIGNED_SHORT:
- return UNSIGNED_SHORT_BIT;
- case GL_INT:
- return INT_BIT;
- case GL_UNSIGNED_INT:
- return UNSIGNED_INT_BIT;
- case GL_HALF_FLOAT:
- if (ctx->Extensions.ARB_half_float_vertex)
- return HALF_BIT;
- else
- return 0x0;
- case GL_FLOAT:
- return FLOAT_BIT;
- case GL_DOUBLE:
- return DOUBLE_BIT;
- case GL_FIXED:
- return FIXED_BIT;
- default:
- return 0;
- }
-}
-
-
-/**
- * Do error checking and update state for glVertex/Color/TexCoord/...Pointer
- * functions.
- *
- * \param func name of calling function used for error reporting
- * \param array the array to update
- * \param dirtyBit which bit to set in ctx->Array.NewState for this array
- * \param legalTypes bitmask of *_BIT above indicating legal datatypes
- * \param sizeMin min allowable size value
- * \param sizeMax max allowable size value (may also be BGRA_OR_4)
- * \param size components per element (1, 2, 3 or 4)
- * \param type datatype of each component (GL_FLOAT, GL_INT, etc)
- * \param stride stride between elements, in elements
- * \param normalized are integer types converted to floats in [-1, 1]?
- * \param integer integer-valued values (will not be normalized to [-1,1])
- * \param ptr the address (or offset inside VBO) of the array data
- */
-static void
-update_array(struct gl_context *ctx,
- const char *func,
- struct gl_client_array *array,
- GLbitfield dirtyBit, GLbitfield legalTypesMask,
- GLint sizeMin, GLint sizeMax,
- GLint size, GLenum type, GLsizei stride,
- GLboolean normalized, GLboolean integer,
- const GLvoid *ptr)
-{
- GLbitfield typeBit;
- GLsizei elementSize;
- GLenum format = GL_RGBA;
-
- if (ctx->API != API_OPENGLES && ctx->API != API_OPENGLES2) {
- /* fixed point arrays / data is only allowed with OpenGL ES 1.x/2.0 */
- legalTypesMask &= ~FIXED_BIT;
- }
-
- typeBit = type_to_bit(ctx, type);
- if (typeBit == 0x0 || (typeBit & legalTypesMask) == 0x0) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(type = %s)",
- func, _mesa_lookup_enum_by_nr(type));
- return;
- }
-
- /* Do size parameter checking.
- * If sizeMax = BGRA_OR_4 it means that size = GL_BGRA is legal and
- * must be handled specially.
- */
- if (ctx->Extensions.EXT_vertex_array_bgra &&
- sizeMax == BGRA_OR_4 &&
- size == GL_BGRA) {
- if (type != GL_UNSIGNED_BYTE) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(GL_BGRA/GLubyte)", func);
- return;
- }
- format = GL_BGRA;
- size = 4;
- }
- else if (size < sizeMin || size > sizeMax || size > 4) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d)", func, size);
- return;
- }
-
- ASSERT(size <= 4);
-
- if (stride < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "%s(stride=%d)", func, stride );
- return;
- }
-
- if (ctx->Array.ArrayObj->VBOonly &&
- ctx->Array.ArrayBufferObj->Name == 0) {
- /* GL_ARB_vertex_array_object requires that all arrays reside in VBOs.
- * Generate GL_INVALID_OPERATION if that's not true.
- */
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-VBO array)", func);
- return;
- }
-
- elementSize = _mesa_sizeof_type(type) * size;
-
- array->Size = size;
- array->Type = type;
- array->Format = format;
- array->Stride = stride;
- array->StrideB = stride ? stride : elementSize;
- array->Normalized = normalized;
- array->Ptr = (const GLubyte *) ptr;
- array->_ElementSize = elementSize;
-
- _mesa_reference_buffer_object(ctx, &array->BufferObj,
- ctx->Array.ArrayBufferObj);
-
- ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= dirtyBit;
-}
-
-
-void GLAPIENTRY
-_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- GLbitfield legalTypes = (SHORT_BIT | INT_BIT | FLOAT_BIT |
- DOUBLE_BIT | HALF_BIT | FIXED_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (ctx->API == API_OPENGLES)
- legalTypes |= BYTE_BIT;
-
- update_array(ctx, "glVertexPointer",
- &ctx->Array.ArrayObj->Vertex, _NEW_ARRAY_VERTEX,
- legalTypes, 2, 4,
- size, type, stride, GL_FALSE, GL_FALSE, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
-{
- const GLbitfield legalTypes = (BYTE_BIT | SHORT_BIT | INT_BIT |
- HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glNormalPointer",
- &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL,
- legalTypes, 3, 3,
- 3, type, stride, GL_TRUE, GL_FALSE, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (BYTE_BIT | UNSIGNED_BYTE_BIT |
- SHORT_BIT | UNSIGNED_SHORT_BIT |
- INT_BIT | UNSIGNED_INT_BIT |
- HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glColorPointer",
- &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0,
- legalTypes, 3, BGRA_OR_4,
- size, type, stride, GL_TRUE, GL_FALSE, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (HALF_BIT | FLOAT_BIT | DOUBLE_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glFogCoordPointer",
- &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD,
- legalTypes, 1, 1,
- 1, type, stride, GL_FALSE, GL_FALSE, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (UNSIGNED_BYTE_BIT | SHORT_BIT | INT_BIT |
- FLOAT_BIT | DOUBLE_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glIndexPointer",
- &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX,
- legalTypes, 1, 1,
- 1, type, stride, GL_FALSE, GL_FALSE, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (BYTE_BIT | UNSIGNED_BYTE_BIT |
- SHORT_BIT | UNSIGNED_SHORT_BIT |
- INT_BIT | UNSIGNED_INT_BIT |
- HALF_BIT | FLOAT_BIT | DOUBLE_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glSecondaryColorPointer",
- &ctx->Array.ArrayObj->SecondaryColor, _NEW_ARRAY_COLOR1,
- legalTypes, 3, BGRA_OR_4,
- size, type, stride, GL_TRUE, GL_FALSE, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr)
-{
- GLbitfield legalTypes = (SHORT_BIT | INT_BIT |
- HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_BIT);
- GET_CURRENT_CONTEXT(ctx);
- const GLuint unit = ctx->Array.ActiveTexture;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (ctx->API == API_OPENGLES)
- legalTypes |= BYTE_BIT;
-
- ASSERT(unit < Elements(ctx->Array.ArrayObj->TexCoord));
-
- update_array(ctx, "glTexCoordPointer",
- &ctx->Array.ArrayObj->TexCoord[unit],
- _NEW_ARRAY_TEXCOORD(unit),
- legalTypes, 1, 4,
- size, type, stride, GL_FALSE, GL_FALSE,
- ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = UNSIGNED_BYTE_BIT;
- /* see table 2.4 edits in GL_EXT_gpu_shader4 spec: */
- const GLboolean integer = GL_TRUE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- update_array(ctx, "glEdgeFlagPointer",
- &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG,
- legalTypes, 1, 1,
- 1, GL_UNSIGNED_BYTE, stride, GL_FALSE, integer, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (FLOAT_BIT | FIXED_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (ctx->API != API_OPENGLES) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glPointSizePointer(ES 1.x only)");
- return;
- }
-
- update_array(ctx, "glPointSizePointer",
- &ctx->Array.ArrayObj->PointSize, _NEW_ARRAY_POINT_SIZE,
- legalTypes, 1, 1,
- 1, type, stride, GL_FALSE, GL_FALSE, ptr);
-}
-
-
-#if FEATURE_NV_vertex_program
-/**
- * Set a vertex attribute array.
- * Note that these arrays DO alias the conventional GL vertex arrays
- * (position, normal, color, fog, texcoord, etc).
- * The generic attribute slots at #16 and above are not touched.
- */
-void GLAPIENTRY
-_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (UNSIGNED_BYTE_BIT | SHORT_BIT |
- FLOAT_BIT | DOUBLE_BIT);
- GLboolean normalized = GL_FALSE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)");
- return;
- }
-
- if (type == GL_UNSIGNED_BYTE && size != 4) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size!=4)");
- return;
- }
-
- update_array(ctx, "glVertexAttribPointerNV",
- &ctx->Array.ArrayObj->VertexAttrib[index],
- _NEW_ARRAY_ATTRIB(index),
- legalTypes, 1, BGRA_OR_4,
- size, type, stride, normalized, GL_FALSE, ptr);
-}
-#endif
-
-
-#if FEATURE_ARB_vertex_program
-/**
- * Set a generic vertex attribute array.
- * Note that these arrays DO NOT alias the conventional GL vertex arrays
- * (position, normal, color, fog, texcoord, etc).
- */
-void GLAPIENTRY
-_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
- GLboolean normalized,
- GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (BYTE_BIT | UNSIGNED_BYTE_BIT |
- SHORT_BIT | UNSIGNED_SHORT_BIT |
- INT_BIT | UNSIGNED_INT_BIT |
- HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_BIT);
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(index)");
- return;
- }
-
- update_array(ctx, "glVertexAttribPointer",
- &ctx->Array.ArrayObj->VertexAttrib[index],
- _NEW_ARRAY_ATTRIB(index),
- legalTypes, 1, BGRA_OR_4,
- size, type, stride, normalized, GL_FALSE, ptr);
-}
-#endif
-
-
-/**
- * GL_EXT_gpu_shader4 / GL 3.0.
- * 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,
- GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (BYTE_BIT | UNSIGNED_BYTE_BIT |
- SHORT_BIT | UNSIGNED_SHORT_BIT |
- INT_BIT | UNSIGNED_INT_BIT);
- const GLboolean normalized = GL_FALSE;
- const GLboolean integer = GL_TRUE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribIPointer(index)");
- return;
- }
-
- update_array(ctx, "glVertexAttribIPointer",
- &ctx->Array.ArrayObj->VertexAttrib[index],
- _NEW_ARRAY_ATTRIB(index),
- legalTypes, 1, 4,
- size, type, stride, normalized, integer, 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(struct gl_context *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;
- case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- if (ctx->Extensions.EXT_gpu_shader4) {
- return array->Integer;
- }
- /* fall-through */
- 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)
-{
- (void) count;
- _mesa_VertexPointer(size, type, stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr)
-{
- (void) count;
- _mesa_NormalPointer(type, stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr)
-{
- (void) count;
- _mesa_ColorPointer(size, type, stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr)
-{
- (void) count;
- _mesa_IndexPointer(type, stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr)
-{
- (void) count;
- _mesa_TexCoordPointer(size, type, stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
-{
- (void) count;
- _mesa_EdgeFlagPointer(stride, ptr);
-}
-
-
-void GLAPIENTRY
-_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLboolean tflag, cflag, nflag; /* enable/disable flags */
- GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */
- GLenum ctype = 0; /* color type */
- GLint coffset = 0, noffset = 0, voffset;/* color, normal, vertex offsets */
- const GLint toffset = 0; /* always zero */
- GLint defstride; /* default stride */
- GLint c, f;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- f = sizeof(GLfloat);
- c = f * ((4 * sizeof(GLubyte) + (f - 1)) / f);
-
- if (stride < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glInterleavedArrays(stride)" );
- return;
- }
-
- switch (format) {
- case GL_V2F:
- tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE;
- tcomps = 0; ccomps = 0; vcomps = 2;
- voffset = 0;
- defstride = 2*f;
- break;
- case GL_V3F:
- tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE;
- tcomps = 0; ccomps = 0; vcomps = 3;
- voffset = 0;
- defstride = 3*f;
- break;
- case GL_C4UB_V2F:
- tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
- tcomps = 0; ccomps = 4; vcomps = 2;
- ctype = GL_UNSIGNED_BYTE;
- coffset = 0;
- voffset = c;
- defstride = c + 2*f;
- break;
- case GL_C4UB_V3F:
- tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
- tcomps = 0; ccomps = 4; vcomps = 3;
- ctype = GL_UNSIGNED_BYTE;
- coffset = 0;
- voffset = c;
- defstride = c + 3*f;
- break;
- case GL_C3F_V3F:
- tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE;
- tcomps = 0; ccomps = 3; vcomps = 3;
- ctype = GL_FLOAT;
- coffset = 0;
- voffset = 3*f;
- defstride = 6*f;
- break;
- case GL_N3F_V3F:
- tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_TRUE;
- tcomps = 0; ccomps = 0; vcomps = 3;
- noffset = 0;
- voffset = 3*f;
- defstride = 6*f;
- break;
- case GL_C4F_N3F_V3F:
- tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_TRUE;
- tcomps = 0; ccomps = 4; vcomps = 3;
- ctype = GL_FLOAT;
- coffset = 0;
- noffset = 4*f;
- voffset = 7*f;
- defstride = 10*f;
- break;
- case GL_T2F_V3F:
- tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE;
- tcomps = 2; ccomps = 0; vcomps = 3;
- voffset = 2*f;
- defstride = 5*f;
- break;
- case GL_T4F_V4F:
- tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE;
- tcomps = 4; ccomps = 0; vcomps = 4;
- voffset = 4*f;
- defstride = 8*f;
- break;
- case GL_T2F_C4UB_V3F:
- tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE;
- tcomps = 2; ccomps = 4; vcomps = 3;
- ctype = GL_UNSIGNED_BYTE;
- coffset = 2*f;
- voffset = c+2*f;
- defstride = c+5*f;
- break;
- case GL_T2F_C3F_V3F:
- tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE;
- tcomps = 2; ccomps = 3; vcomps = 3;
- ctype = GL_FLOAT;
- coffset = 2*f;
- voffset = 5*f;
- defstride = 8*f;
- break;
- case GL_T2F_N3F_V3F:
- tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_TRUE;
- tcomps = 2; ccomps = 0; vcomps = 3;
- noffset = 2*f;
- voffset = 5*f;
- defstride = 8*f;
- break;
- case GL_T2F_C4F_N3F_V3F:
- tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE;
- tcomps = 2; ccomps = 4; vcomps = 3;
- ctype = GL_FLOAT;
- coffset = 2*f;
- noffset = 6*f;
- voffset = 9*f;
- defstride = 12*f;
- break;
- case GL_T4F_C4F_N3F_V4F:
- tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE;
- tcomps = 4; ccomps = 4; vcomps = 4;
- ctype = GL_FLOAT;
- coffset = 4*f;
- noffset = 8*f;
- voffset = 11*f;
- defstride = 15*f;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glInterleavedArrays(format)" );
- return;
- }
-
- if (stride==0) {
- stride = defstride;
- }
-
- _mesa_DisableClientState( GL_EDGE_FLAG_ARRAY );
- _mesa_DisableClientState( GL_INDEX_ARRAY );
- /* XXX also disable secondary color and generic arrays? */
-
- /* Texcoords */
- if (tflag) {
- _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY );
- _mesa_TexCoordPointer( tcomps, GL_FLOAT, stride,
- (GLubyte *) pointer + toffset );
- }
- else {
- _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
- }
-
- /* Color */
- if (cflag) {
- _mesa_EnableClientState( GL_COLOR_ARRAY );
- _mesa_ColorPointer( ccomps, ctype, stride,
- (GLubyte *) pointer + coffset );
- }
- else {
- _mesa_DisableClientState( GL_COLOR_ARRAY );
- }
-
-
- /* Normals */
- if (nflag) {
- _mesa_EnableClientState( GL_NORMAL_ARRAY );
- _mesa_NormalPointer( GL_FLOAT, stride, (GLubyte *) pointer + noffset );
- }
- else {
- _mesa_DisableClientState( GL_NORMAL_ARRAY );
- }
-
- /* Vertices */
- _mesa_EnableClientState( GL_VERTEX_ARRAY );
- _mesa_VertexPointer( vcomps, GL_FLOAT, stride,
- (GLubyte *) pointer + voffset );
-}
-
-
-void GLAPIENTRY
-_mesa_LockArraysEXT(GLint first, GLsizei count)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glLockArrays %d %d\n", first, count);
-
- if (first < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glLockArraysEXT(first)" );
- return;
- }
- if (count <= 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glLockArraysEXT(count)" );
- return;
- }
- if (ctx->Array.LockCount != 0) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glLockArraysEXT(reentry)" );
- return;
- }
-
- ctx->Array.LockFirst = first;
- ctx->Array.LockCount = count;
-
- ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= _NEW_ARRAY_ALL;
-}
-
-
-void GLAPIENTRY
-_mesa_UnlockArraysEXT( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glUnlockArrays\n");
-
- if (ctx->Array.LockCount == 0) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glUnlockArraysEXT(reexit)" );
- return;
- }
-
- ctx->Array.LockFirst = 0;
- ctx->Array.LockCount = 0;
- ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= _NEW_ARRAY_ALL;
-}
-
-
-/* GL_EXT_multi_draw_arrays */
-void GLAPIENTRY
-_mesa_MultiDrawArraysEXT( GLenum mode, const GLint *first,
- const GLsizei *count, GLsizei primcount )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- for (i = 0; i < primcount; i++) {
- if (count[i] > 0) {
- CALL_DrawArrays(ctx->Exec, (mode, first[i], count[i]));
- }
- }
-}
-
-
-/* GL_IBM_multimode_draw_arrays */
-void GLAPIENTRY
-_mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
- const GLsizei * count,
- GLsizei primcount, GLint modestride )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- for ( i = 0 ; i < primcount ; i++ ) {
- if ( count[i] > 0 ) {
- GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
- CALL_DrawArrays(ctx->Exec, ( m, first[i], count[i] ));
- }
- }
-}
-
-
-/* GL_IBM_multimode_draw_arrays */
-void GLAPIENTRY
-_mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
- GLenum type, const GLvoid * const * indices,
- GLsizei primcount, GLint modestride )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- /* XXX not sure about ARB_vertex_buffer_object handling here */
-
- for ( i = 0 ; i < primcount ; i++ ) {
- if ( count[i] > 0 ) {
- GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
- CALL_DrawElements(ctx->Exec, ( m, count[i], type, indices[i] ));
- }
- }
-}
-
-
-/**
- * GL_NV_primitive_restart and GL 3.1
- */
-void GLAPIENTRY
-_mesa_PrimitiveRestartIndex(GLuint index)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- if (!ctx->Extensions.NV_primitive_restart &&
- ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndexNV()");
- 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
-_mesa_copy_client_array(struct gl_context *ctx,
- struct gl_client_array *dst,
- struct gl_client_array *src)
-{
- dst->Size = src->Size;
- dst->Type = src->Type;
- dst->Format = src->Format;
- dst->Stride = src->Stride;
- dst->StrideB = src->StrideB;
- dst->Ptr = src->Ptr;
- dst->Enabled = src->Enabled;
- dst->Normalized = src->Normalized;
- dst->Integer = src->Integer;
- dst->_ElementSize = src->_ElementSize;
- _mesa_reference_buffer_object(ctx, &dst->BufferObj, src->BufferObj);
- dst->_MaxElement = src->_MaxElement;
-}
-
-
-
-/**
- * Print vertex array's fields.
- */
-static void
-print_array(const char *name, GLint index, const struct gl_client_array *array)
-{
- if (index >= 0)
- printf(" %s[%d]: ", name, index);
- else
- printf(" %s: ", name);
- 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, (unsigned long) array->BufferObj->Size,
- array->_MaxElement);
-}
-
-
-/**
- * Print current vertex object/array info. For debug.
- */
-void
-_mesa_print_arrays(struct gl_context *ctx)
-{
- struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
- GLuint i;
-
- _mesa_update_array_object_max_element(ctx, arrayObj);
-
- printf("Array Object %u\n", arrayObj->Name);
- if (arrayObj->Vertex.Enabled)
- print_array("Vertex", -1, &arrayObj->Vertex);
- if (arrayObj->Normal.Enabled)
- print_array("Normal", -1, &arrayObj->Normal);
- if (arrayObj->Color.Enabled)
- print_array("Color", -1, &arrayObj->Color);
- for (i = 0; i < Elements(arrayObj->TexCoord); i++)
- if (arrayObj->TexCoord[i].Enabled)
- print_array("TexCoord", i, &arrayObj->TexCoord[i]);
- for (i = 0; i < Elements(arrayObj->VertexAttrib); i++)
- if (arrayObj->VertexAttrib[i].Enabled)
- print_array("Attrib", i, &arrayObj->VertexAttrib[i]);
- printf(" _MaxElement = %u\n", arrayObj->_MaxElement);
-}
-
-
-/**
- * Initialize vertex array state for given context.
- */
-void
-_mesa_init_varray(struct gl_context *ctx)
-{
- ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0);
- _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj,
- ctx->Array.DefaultArrayObj);
- ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */
-
- ctx->Array.Objects = _mesa_NewHashTable();
-}
-
-
-/**
- * Callback for deleting an array object. Called by _mesa_HashDeleteAll().
- */
-static void
-delete_arrayobj_cb(GLuint id, void *data, void *userData)
-{
- struct gl_array_object *arrayObj = (struct gl_array_object *) data;
- struct gl_context *ctx = (struct gl_context *) userData;
- _mesa_delete_array_object(ctx, arrayObj);
-}
-
-
-/**
- * Free vertex array state for given context.
- */
-void
-_mesa_free_varray_data(struct gl_context *ctx)
-{
- _mesa_HashDeleteAll(ctx->Array.Objects, delete_arrayobj_cb, ctx);
- _mesa_DeleteHashTable(ctx->Array.Objects);
-}
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
deleted file mode 100644
index af93241..0000000
--- a/src/mesa/main/varray.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.6
- *
- * Copyright (C) 1999-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.
- */
-
-
-#ifndef VARRAY_H
-#define VARRAY_H
-
-
-#include "glheader.h"
-#include "mfeatures.h"
-
-struct gl_client_array;
-struct gl_context;
-
-#if _HAVE_FULL_GL
-
-extern void GLAPIENTRY
-_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr);
-
-extern void GLAPIENTRY
-_mesa_UnlockArraysEXT( void );
-
-extern void GLAPIENTRY
-_mesa_LockArraysEXT(GLint first, GLsizei count);
-
-
-extern void GLAPIENTRY
-_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr);
-
-
-extern void GLAPIENTRY
-_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer);
-
-
-extern void GLAPIENTRY
-_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,
- 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, const GLint *first,
- const GLsizei *count, GLsizei primcount );
-
-extern void GLAPIENTRY
-_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
- const GLvoid **indices, GLsizei primcount );
-
-extern void GLAPIENTRY
-_mesa_MultiDrawElementsBaseVertex( GLenum mode,
- const GLsizei *count, GLenum type,
- const GLvoid **indices, GLsizei primcount,
- const GLint *basevertex);
-
-extern void GLAPIENTRY
-_mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
- const GLsizei * count,
- GLsizei primcount, GLint modestride );
-
-
-extern void GLAPIENTRY
-_mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
- GLenum type, const GLvoid * const * indices,
- GLsizei primcount, GLint modestride );
-
-extern void GLAPIENTRY
-_mesa_LockArraysEXT(GLint first, GLsizei count);
-
-extern void GLAPIENTRY
-_mesa_UnlockArraysEXT( void );
-
-
-extern void GLAPIENTRY
-_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
-
-extern void GLAPIENTRY
-_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
- const GLvoid *indices);
-
-extern void GLAPIENTRY
-_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
- GLenum type, const GLvoid *indices);
-
-extern void GLAPIENTRY
-_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
- const GLvoid *indices, GLint basevertex);
-
-extern void GLAPIENTRY
-_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
- GLsizei count, GLenum type,
- const GLvoid *indices,
- GLint basevertex);
-
-extern void GLAPIENTRY
-_mesa_PrimitiveRestartIndex(GLuint index);
-
-
-extern void
-_mesa_copy_client_array(struct gl_context *ctx,
- struct gl_client_array *dst,
- struct gl_client_array *src);
-
-
-extern void
-_mesa_print_arrays(struct gl_context *ctx);
-
-extern void
-_mesa_init_varray( struct gl_context * ctx );
-
-extern void
-_mesa_free_varray_data(struct gl_context *ctx);
-
-#else
-
-/** No-op */
-#define _mesa_init_varray( c ) ((void)0)
-#define _mesa_free_varray_data( c ) ((void)0)
-
-#endif
-
-#endif
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
deleted file mode 100644
index 4747022..0000000
--- a/src/mesa/main/viewport.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * 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 viewport.c
- * glViewport and glDepthRange functions.
- */
-
-
-#include "context.h"
-#include "macros.h"
-#include "viewport.h"
-
-
-/**
- * Set the viewport.
- * \sa Called via glViewport() or display list execution.
- *
- * Flushes the vertices and calls _mesa_set_viewport() with the given
- * parameters.
- */
-void GLAPIENTRY
-_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- _mesa_set_viewport(ctx, x, y, width, height);
-}
-
-
-/**
- * Set new viewport parameters and update derived state (the _WindowMap
- * matrix). Usually called from _mesa_Viewport().
- *
- * \param ctx GL context.
- * \param x, y coordinates of the lower left corner of the viewport rectangle.
- * \param width width of the viewport rectangle.
- * \param height height of the viewport rectangle.
- */
-void
-_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height)
-{
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height);
-
- if (width < 0 || height < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glViewport(%d, %d, %d, %d)", x, y, width, height);
- return;
- }
-
- /* clamp width and height to the implementation dependent range */
- width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth);
- height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight);
-
- ctx->Viewport.X = x;
- ctx->Viewport.Width = width;
- ctx->Viewport.Y = y;
- ctx->Viewport.Height = height;
- ctx->NewState |= _NEW_VIEWPORT;
-
-#if 1
- /* XXX remove this someday. Currently the DRI drivers rely on
- * the WindowMap matrix being up to date in the driver's Viewport
- * and DepthRange functions.
- */
- _math_matrix_viewport(&ctx->Viewport._WindowMap,
- ctx->Viewport.X, ctx->Viewport.Y,
- ctx->Viewport.Width, ctx->Viewport.Height,
- ctx->Viewport.Near, ctx->Viewport.Far,
- ctx->DrawBuffer->_DepthMaxF);
-#endif
-
- if (ctx->Driver.Viewport) {
- /* Many drivers will use this call to check for window size changes
- * and reallocate the z/stencil/accum/etc buffers if needed.
- */
- ctx->Driver.Viewport(ctx, x, y, width, height);
- }
-}
-
-
-/**
- * Called by glDepthRange
- *
- * \param nearval specifies the Z buffer value which should correspond to
- * the near clip plane
- * \param farval specifies the Z buffer value which should correspond to
- * the far clip plane
- */
-void GLAPIENTRY
-_mesa_DepthRange(GLclampd nearval, GLclampd farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE&VERBOSE_API)
- _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval);
-
- if (ctx->Viewport.Near == nearval &&
- ctx->Viewport.Far == farval)
- return;
-
- ctx->Viewport.Near = (GLfloat) CLAMP(nearval, 0.0, 1.0);
- ctx->Viewport.Far = (GLfloat) CLAMP(farval, 0.0, 1.0);
- ctx->NewState |= _NEW_VIEWPORT;
-
-#if 1
- /* XXX remove this someday. Currently the DRI drivers rely on
- * the WindowMap matrix being up to date in the driver's Viewport
- * and DepthRange functions.
- */
- _math_matrix_viewport(&ctx->Viewport._WindowMap,
- ctx->Viewport.X, ctx->Viewport.Y,
- ctx->Viewport.Width, ctx->Viewport.Height,
- ctx->Viewport.Near, ctx->Viewport.Far,
- ctx->DrawBuffer->_DepthMaxF);
-#endif
-
- if (ctx->Driver.DepthRange) {
- ctx->Driver.DepthRange(ctx, nearval, farval);
- }
-}
-
-
-
-/**
- * Initialize the context viewport attribute group.
- * \param ctx the GL context.
- */
-void _mesa_init_viewport(struct gl_context *ctx)
-{
- GLfloat depthMax = 65535.0F; /* sorf of arbitrary */
-
- /* Viewport group */
- ctx->Viewport.X = 0;
- ctx->Viewport.Y = 0;
- ctx->Viewport.Width = 0;
- ctx->Viewport.Height = 0;
- ctx->Viewport.Near = 0.0;
- ctx->Viewport.Far = 1.0;
- _math_matrix_ctr(&ctx->Viewport._WindowMap);
-
- _math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0,
- 0.0F, 1.0F, depthMax);
-}
-
-
-/**
- * Free the context viewport attribute group data.
- * \param ctx the GL context.
- */
-void _mesa_free_viewport_data(struct gl_context *ctx)
-{
- _math_matrix_dtr(&ctx->Viewport._WindowMap);
-}
-
diff --git a/src/mesa/main/viewport.h b/src/mesa/main/viewport.h
deleted file mode 100644
index 909ff92..0000000
--- a/src/mesa/main/viewport.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-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.
- */
-
-
-#ifndef VIEWPORT_H
-#define VIEWPORT_H
-
-#include "glheader.h"
-
-struct gl_context;
-
-extern void GLAPIENTRY
-_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height);
-
-
-extern void
-_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height);
-
-
-extern void GLAPIENTRY
-_mesa_DepthRange(GLclampd nearval, GLclampd farval);
-
-
-extern void
-_mesa_init_viewport(struct gl_context *ctx);
-
-
-extern void
-_mesa_free_viewport_data(struct gl_context *ctx);
-
-
-#endif
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
deleted file mode 100644
index 8a72641..0000000
--- a/src/mesa/main/vtxfmt.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 1999-2004 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.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Gareth Hughes
- */
-
-#include "glheader.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "vtxfmt.h"
-#include "eval.h"
-#include "dlist.h"
-#include "main/dispatch.h"
-
-
-#if FEATURE_beginend
-
-/**
- * Use the per-vertex functions found in <vfmt> to initialoze the given
- * API dispatch table.
- */
-static void
-install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
-{
- _mesa_install_arrayelt_vtxfmt(tab, vfmt);
-
- SET_Color3f(tab, vfmt->Color3f);
- SET_Color3fv(tab, vfmt->Color3fv);
- SET_Color4f(tab, vfmt->Color4f);
- SET_Color4fv(tab, vfmt->Color4fv);
- SET_EdgeFlag(tab, vfmt->EdgeFlag);
-
- _mesa_install_eval_vtxfmt(tab, vfmt);
-
- SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
- SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT);
- SET_Indexf(tab, vfmt->Indexf);
- SET_Indexfv(tab, vfmt->Indexfv);
- SET_Materialfv(tab, vfmt->Materialfv);
- SET_MultiTexCoord1fARB(tab, vfmt->MultiTexCoord1fARB);
- SET_MultiTexCoord1fvARB(tab, vfmt->MultiTexCoord1fvARB);
- SET_MultiTexCoord2fARB(tab, vfmt->MultiTexCoord2fARB);
- SET_MultiTexCoord2fvARB(tab, vfmt->MultiTexCoord2fvARB);
- SET_MultiTexCoord3fARB(tab, vfmt->MultiTexCoord3fARB);
- SET_MultiTexCoord3fvARB(tab, vfmt->MultiTexCoord3fvARB);
- SET_MultiTexCoord4fARB(tab, vfmt->MultiTexCoord4fARB);
- SET_MultiTexCoord4fvARB(tab, vfmt->MultiTexCoord4fvARB);
- SET_Normal3f(tab, vfmt->Normal3f);
- SET_Normal3fv(tab, vfmt->Normal3fv);
- SET_SecondaryColor3fEXT(tab, vfmt->SecondaryColor3fEXT);
- SET_SecondaryColor3fvEXT(tab, vfmt->SecondaryColor3fvEXT);
- SET_TexCoord1f(tab, vfmt->TexCoord1f);
- SET_TexCoord1fv(tab, vfmt->TexCoord1fv);
- SET_TexCoord2f(tab, vfmt->TexCoord2f);
- SET_TexCoord2fv(tab, vfmt->TexCoord2fv);
- SET_TexCoord3f(tab, vfmt->TexCoord3f);
- SET_TexCoord3fv(tab, vfmt->TexCoord3fv);
- SET_TexCoord4f(tab, vfmt->TexCoord4f);
- SET_TexCoord4fv(tab, vfmt->TexCoord4fv);
- SET_Vertex2f(tab, vfmt->Vertex2f);
- SET_Vertex2fv(tab, vfmt->Vertex2fv);
- SET_Vertex3f(tab, vfmt->Vertex3f);
- SET_Vertex3fv(tab, vfmt->Vertex3fv);
- SET_Vertex4f(tab, vfmt->Vertex4f);
- SET_Vertex4fv(tab, vfmt->Vertex4fv);
-
- _mesa_install_dlist_vtxfmt(tab, vfmt); /* glCallList / glCallLists */
-
- SET_Begin(tab, vfmt->Begin);
- SET_End(tab, vfmt->End);
- SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV);
-
- SET_Rectf(tab, vfmt->Rectf);
-
- SET_DrawArrays(tab, vfmt->DrawArrays);
- SET_DrawElements(tab, vfmt->DrawElements);
- SET_DrawRangeElements(tab, vfmt->DrawRangeElements);
- SET_MultiDrawElementsEXT(tab, vfmt->MultiDrawElementsEXT);
- SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex);
- SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex);
- SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex);
- SET_DrawArraysInstancedARB(tab, vfmt->DrawArraysInstanced);
- SET_DrawElementsInstancedARB(tab, vfmt->DrawElementsInstanced);
-
- /* GL_NV_vertex_program */
- SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
- SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV);
- SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV);
- SET_VertexAttrib2fvNV(tab, vfmt->VertexAttrib2fvNV);
- SET_VertexAttrib3fNV(tab, vfmt->VertexAttrib3fNV);
- SET_VertexAttrib3fvNV(tab, vfmt->VertexAttrib3fvNV);
- SET_VertexAttrib4fNV(tab, vfmt->VertexAttrib4fNV);
- SET_VertexAttrib4fvNV(tab, vfmt->VertexAttrib4fvNV);
-#if FEATURE_ARB_vertex_program
- SET_VertexAttrib1fARB(tab, vfmt->VertexAttrib1fARB);
- SET_VertexAttrib1fvARB(tab, vfmt->VertexAttrib1fvARB);
- SET_VertexAttrib2fARB(tab, vfmt->VertexAttrib2fARB);
- SET_VertexAttrib2fvARB(tab, vfmt->VertexAttrib2fvARB);
- SET_VertexAttrib3fARB(tab, vfmt->VertexAttrib3fARB);
- SET_VertexAttrib3fvARB(tab, vfmt->VertexAttrib3fvARB);
- SET_VertexAttrib4fARB(tab, vfmt->VertexAttrib4fARB);
- SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB);
-#endif
-
- /* GL_EXT_gpu_shader4 / OpenGL 3.0 */
- SET_VertexAttribI1iEXT(tab, vfmt->VertexAttribI1i);
- SET_VertexAttribI2iEXT(tab, vfmt->VertexAttribI2i);
- SET_VertexAttribI3iEXT(tab, vfmt->VertexAttribI3i);
- SET_VertexAttribI4iEXT(tab, vfmt->VertexAttribI4i);
- SET_VertexAttribI2ivEXT(tab, vfmt->VertexAttribI2iv);
- SET_VertexAttribI3ivEXT(tab, vfmt->VertexAttribI3iv);
- SET_VertexAttribI4ivEXT(tab, vfmt->VertexAttribI4iv);
-
- SET_VertexAttribI1uiEXT(tab, vfmt->VertexAttribI1ui);
- SET_VertexAttribI2uiEXT(tab, vfmt->VertexAttribI2ui);
- SET_VertexAttribI3uiEXT(tab, vfmt->VertexAttribI3ui);
- SET_VertexAttribI4uiEXT(tab, vfmt->VertexAttribI4ui);
- SET_VertexAttribI2uivEXT(tab, vfmt->VertexAttribI2uiv);
- SET_VertexAttribI3uivEXT(tab, vfmt->VertexAttribI3uiv);
- SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv);
-}
-
-
-/**
- * Install per-vertex functions into the API dispatch table for execution.
- */
-void
-_mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
-{
- if (ctx->API == API_OPENGL)
- install_vtxfmt( ctx->Exec, vfmt );
-}
-
-
-/**
- * Install per-vertex functions into the API dispatch table for display
- * list compilation.
- */
-void
-_mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
-{
- if (ctx->API == API_OPENGL)
- install_vtxfmt( ctx->Save, vfmt );
-}
-
-
-#endif /* FEATURE_beginend */
diff --git a/src/mesa/main/vtxfmt.h b/src/mesa/main/vtxfmt.h
deleted file mode 100644
index 147385c..0000000
--- a/src/mesa/main/vtxfmt.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * \file vtxfmt.h
- *
- * \author Keith Whitwell <keith@tungstengraphics.com>
- * \author Gareth Hughes
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 6.1
- *
- * Copyright (C) 1999-2004 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 _VTXFMT_H_
-#define _VTXFMT_H_
-
-#include "compiler.h"
-#include "mtypes.h"
-
-#if FEATURE_beginend
-
-extern void _mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt );
-extern void _mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt );
-
-#else /* FEATURE_beginend */
-
-static INLINE void
-_mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt )
-{
-}
-
-static INLINE void
-_mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt )
-{
-}
-
-#endif /* FEATURE_beginend */
-
-#endif /* _VTXFMT_H_ */
diff --git a/src/mesa/math/descrip.mms b/src/mesa/math/descrip.mms
deleted file mode 100644
index 3aaa6eb..0000000
--- a/src/mesa/math/descrip.mms
+++ /dev/null
@@ -1,47 +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 glapi [-.glapi]
- define main [-.main]
-
-.include [---]mms-config.
-
-##### MACROS #####
-
-VPATH = RCS
-
-INCDIR = [---.include],[-.main],[-.glapi]
-LIBDIR = [---.lib]
-CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm
-
-SOURCES = m_debug_clip.c m_debug_norm.c m_debug_xform.c m_eval.c m_matrix.c\
- m_translate.c m_vector.c m_xform.c
-
-OBJECTS = m_debug_clip.obj,m_debug_norm.obj,m_debug_xform.obj,m_eval.obj,\
- m_matrix.obj,m_translate.obj,m_vector.obj,m_xform.obj
-
-##### RULES #####
-
-VERSION=Mesa V3.4
-
-##### TARGETS #####
-# Make the library
-$(LIBDIR)$(GL_LIB) : $(OBJECTS)
- @ library $(LIBDIR)$(GL_LIB) $(OBJECTS)
-
-clean :
- purge
- delete *.obj;*
-
-m_debug_clip.obj : m_debug_clip.c
-m_debug_norm.obj : m_debug_norm.c
-m_debug_xform.obj : m_debug_xform.c
-m_eval.obj : m_eval.c
-m_matrix.obj : m_matrix.c
-m_translate.obj : m_translate.c
-m_vector.obj : m_vector.c
-m_xform.obj : m_xform.c
diff --git a/src/mesa/program/.gitignore b/src/mesa/program/.gitignore
deleted file mode 100644
index 086fd9a..0000000
--- a/src/mesa/program/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-program_parse.output
diff --git a/src/mesa/program/Makefile b/src/mesa/program/Makefile
deleted file mode 100644
index 400a543..0000000
--- a/src/mesa/program/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-all: program_parse.tab.c lex.yy.c
-
-program_parse.tab.c program_parse.tab.h: program_parse.y
- bison -v -d $<
-
-lex.yy.c: program_lexer.l
- flex --never-interactive $<
diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
deleted file mode 100644
index ca63e72..0000000
--- a/src/mesa/program/arbprogparse.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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.
- */
-
-#define DEBUG_PARSING 0
-
-/**
- * \file arbprogparse.c
- * ARB_*_program parser core
- * \author Karl Rasche
- */
-
-/**
-Notes on program parameters, etc.
-
-The instructions we emit will use six kinds of source registers:
-
- PROGRAM_INPUT - input registers
- PROGRAM_TEMPORARY - temp registers
- PROGRAM_ADDRESS - address/indirect register
- PROGRAM_SAMPLER - texture sampler
- PROGRAM_CONSTANT - indexes into program->Parameters, a known constant/literal
- PROGRAM_STATE_VAR - indexes into program->Parameters, and may actually be:
- + a state variable, like "state.fog.color", or
- + a pointer to a "program.local[k]" parameter, or
- + a pointer to a "program.env[k]" parameter
-
-Basically, all the program.local[] and program.env[] values will get mapped
-into the unified gl_program->Parameters array. This solves the problem of
-having three separate program parameter arrays.
-*/
-
-
-#include "main/glheader.h"
-#include "main/imports.h"
-#include "main/context.h"
-#include "main/mtypes.h"
-#include "arbprogparse.h"
-#include "programopt.h"
-#include "prog_parameter.h"
-#include "prog_statevars.h"
-#include "prog_instruction.h"
-#include "program_parser.h"
-
-
-void
-_mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
- const GLvoid *str, GLsizei len,
- struct gl_fragment_program *program)
-{
- struct gl_program prog;
- struct asm_parser_state state;
- GLuint i;
-
- ASSERT(target == GL_FRAGMENT_PROGRAM_ARB);
-
- memset(&prog, 0, sizeof(prog));
- memset(&state, 0, sizeof(state));
- state.prog = &prog;
-
- if (!_mesa_parse_arb_program(ctx, target, (const GLubyte*) str, len,
- &state)) {
- /* Error in the program. Just return. */
- return;
- }
-
- if (program->Base.String != NULL)
- free(program->Base.String);
-
- /* Copy the relevant contents of the arb_program struct into the
- * fragment_program struct.
- */
- program->Base.String = prog.String;
- program->Base.NumInstructions = prog.NumInstructions;
- program->Base.NumTemporaries = prog.NumTemporaries;
- program->Base.NumParameters = prog.NumParameters;
- program->Base.NumAttributes = prog.NumAttributes;
- program->Base.NumAddressRegs = prog.NumAddressRegs;
- program->Base.NumNativeInstructions = prog.NumNativeInstructions;
- program->Base.NumNativeTemporaries = prog.NumNativeTemporaries;
- program->Base.NumNativeParameters = prog.NumNativeParameters;
- program->Base.NumNativeAttributes = prog.NumNativeAttributes;
- program->Base.NumNativeAddressRegs = prog.NumNativeAddressRegs;
- program->Base.NumAluInstructions = prog.NumAluInstructions;
- program->Base.NumTexInstructions = prog.NumTexInstructions;
- program->Base.NumTexIndirections = prog.NumTexIndirections;
- program->Base.NumNativeAluInstructions = prog.NumAluInstructions;
- program->Base.NumNativeTexInstructions = prog.NumTexInstructions;
- 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])
- program->Base.SamplersUsed |= (1 << i);
- }
- program->Base.ShadowSamplers = prog.ShadowSamplers;
- switch (state.option.Fog) {
- case OPTION_FOG_EXP: program->FogOption = GL_EXP; break;
- case OPTION_FOG_EXP2: program->FogOption = GL_EXP2; break;
- case OPTION_FOG_LINEAR: program->FogOption = GL_LINEAR; break;
- default: program->FogOption = GL_NONE; break;
- }
- program->OriginUpperLeft = state.option.OriginUpperLeft;
- program->PixelCenterInteger = state.option.PixelCenterInteger;
-
- program->UsesKill = state.fragment.UsesKill;
-
- if (program->FogOption)
- program->Base.InputsRead |= FRAG_BIT_FOGC;
-
- if (program->Base.Instructions)
- free(program->Base.Instructions);
- program->Base.Instructions = prog.Instructions;
-
- if (program->Base.Parameters)
- _mesa_free_parameter_list(program->Base.Parameters);
- program->Base.Parameters = prog.Parameters;
-
- /* Append fog instructions now if the program has "OPTION ARB_fog_exp"
- * or similar. We used to leave this up to drivers, but it appears
- * there's no hardware that wants to do fog in a discrete stage separate
- * from the fragment shader.
- */
- if (program->FogOption != GL_NONE) {
- _mesa_append_fog_code(ctx, program);
- program->FogOption = GL_NONE;
- }
-
-#if DEBUG_FP
- printf("____________Fragment program %u ________\n", program->Base.Id);
- _mesa_print_program(&program->Base);
-#endif
-}
-
-
-
-/**
- * Parse the vertex program string. If success, update the given
- * vertex_program object with the new program. Else, leave the vertex_program
- * object unchanged.
- */
-void
-_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
- const GLvoid *str, GLsizei len,
- struct gl_vertex_program *program)
-{
- struct gl_program prog;
- struct asm_parser_state state;
-
- ASSERT(target == GL_VERTEX_PROGRAM_ARB);
-
- memset(&prog, 0, sizeof(prog));
- memset(&state, 0, sizeof(state));
- state.prog = &prog;
-
- if (!_mesa_parse_arb_program(ctx, target, (const GLubyte*) str, len,
- &state)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramString(bad program)");
- return;
- }
-
- if (program->Base.String != NULL)
- free(program->Base.String);
-
- /* Copy the relevant contents of the arb_program struct into the
- * vertex_program struct.
- */
- program->Base.String = prog.String;
- program->Base.NumInstructions = prog.NumInstructions;
- program->Base.NumTemporaries = prog.NumTemporaries;
- program->Base.NumParameters = prog.NumParameters;
- program->Base.NumAttributes = prog.NumAttributes;
- program->Base.NumAddressRegs = prog.NumAddressRegs;
- program->Base.NumNativeInstructions = prog.NumNativeInstructions;
- program->Base.NumNativeTemporaries = prog.NumNativeTemporaries;
- program->Base.NumNativeParameters = prog.NumNativeParameters;
- program->Base.NumNativeAttributes = prog.NumNativeAttributes;
- 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;
-
- if (program->Base.Instructions)
- free(program->Base.Instructions);
- program->Base.Instructions = prog.Instructions;
-
- if (program->Base.Parameters)
- _mesa_free_parameter_list(program->Base.Parameters);
- program->Base.Parameters = prog.Parameters;
-
-#if DEBUG_VP
- printf("____________Vertex program %u __________\n", program->Base.Id);
- _mesa_print_program(&program->Base);
-#endif
-}
diff --git a/src/mesa/program/arbprogparse.h b/src/mesa/program/arbprogparse.h
deleted file mode 100644
index 08e25a1..0000000
--- a/src/mesa/program/arbprogparse.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-
-
-#ifndef ARBPROGPARSE_H
-#define ARBPROGPARSE_H
-
-#include "main/mtypes.h"
-
-extern void
-_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
- const GLvoid *str, GLsizei len,
- struct gl_vertex_program *program);
-
-extern void
-_mesa_parse_arb_fragment_program(struct gl_context *ctx, GLenum target,
- const GLvoid *str, GLsizei len,
- struct gl_fragment_program *program);
-
-#endif
diff --git a/src/mesa/program/descrip.mms b/src/mesa/program/descrip.mms
deleted file mode 100644
index 5973002..0000000
--- a/src/mesa/program/descrip.mms
+++ /dev/null
@@ -1,93 +0,0 @@
-# Makefile for core library for VMS
-# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
-# Last revision : 29 September 2008
-.first
- define gl [---.include.gl]
- define math [-.math]
- define swrast [-.swrast]
- define array_cache [-.array_cache]
- define glapi [-.glapi]
- define main [-.main]
- define shader [-.shader]
-
-.include [---]mms-config.
-
-##### MACROS #####
-
-VPATH = RCS
-
-INCDIR = [---.include],[-.main],[-.glapi],[.slang]
-LIBDIR = [---.lib]
-CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1,"__extension__=")/name=(as_is,short)/float=ieee/ieee=denorm
-
-SOURCES = \
- atifragshader.c \
- arbprogparse.c \
- arbprogram.c \
- nvfragparse.c \
- nvprogram.c \
- nvvertparse.c \
- program.c \
- programopt.c \
- prog_debug.c \
- prog_execute.c \
- prog_instruction.c \
- prog_parameter.c \
- prog_print.c \
- prog_cache.c \
- prog_statevars.c \
- shader_api.c prog_uniform.c
-
-OBJECTS = \
- atifragshader.obj,\
- arbprogparse.obj,\
- arbprogram.obj,\
- nvfragparse.obj,\
- nvprogram.obj,\
- nvvertparse.obj,\
- program.obj,\
- programopt.obj,\
- prog_debug.obj,\
- prog_execute.obj,\
- prog_instruction.obj,\
- prog_parameter.obj,\
- prog_print.obj,\
- prog_statevars.obj,\
- shader_api.obj,prog_uniform.obj,prog_cache.obj
-
-##### RULES #####
-
-VERSION=Mesa V3.4
-
-##### TARGETS #####
-all :
- $(MMS)$(MMSQUALIFIERS) $(LIBDIR)$(GL_LIB)
- set def [.slang]
- $(MMS)$(MMSQUALIFIERS)
- set def [-]
-
-# Make the library
-$(LIBDIR)$(GL_LIB) : $(OBJECTS)
- @ library $(LIBDIR)$(GL_LIB) $(OBJECTS)
-
-clean :
- purge
- delete *.obj;*
-
-atifragshader.obj : atifragshader.c
-arbprogparse.obj : arbprogparse.c
-arbprogram.obj : arbprogram.c
-nvfragparse.obj : nvfragparse.c
-nvprogram.obj : nvprogram.c
-nvvertparse.obj : nvvertparse.c
-program.obj : program.c
-programopt. obj : programopt.c
-prog_debug.obj : prog_debug.c
-prog_execute.obj : prog_execute.c
-prog_instruction.obj : prog_instruction.c
-prog_parameter.obj : prog_parameter.c
-prog_print.obj : prog_print.c
-prog_statevars.obj : prog_statevars.c
-shader_api.obj : shader_api.c
-prog_uniform.obj : prog_uniform.c
-prog_cache.obj : prog_cache.c
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
deleted file mode 100644
index c601ef6..0000000
--- a/src/mesa/program/ir_to_mesa.cpp
+++ /dev/null
@@ -1,3074 +0,0 @@
-/*
- * 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
- *
- * Translate GLSL IR to Mesa's gl_program representation.
- */
-
-#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"
-#include "program/sampler.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 = (gl_register_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;
- }
-
- gl_register_file 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;
- bool saturate;
- 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, gl_register_file file, int index)
- : file(file), index(index), var(var)
- {
- /* empty */
- }
-
- gl_register_file 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;
-
- struct gl_context *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);
-
- /**
- * Emit the correct dot-product instruction for the type of arguments
- *
- * \sa ir_to_mesa_emit_op2
- */
- void ir_to_mesa_emit_dp(ir_instruction *ir,
- ir_to_mesa_dst_reg dst,
- ir_to_mesa_src_reg src0,
- ir_to_mesa_src_reg src1,
- unsigned elements);
-
- 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);
-
- void emit_scs(ir_instruction *ir, enum prog_opcode op,
- ir_to_mesa_dst_reg dst,
- const ir_to_mesa_src_reg &src);
-
- GLboolean try_emit_mad(ir_expression *ir,
- int mul_operand);
- GLboolean try_emit_sat(ir_expression *ir);
-
- void emit_swz(ir_expression *ir);
-
- bool process_move_condition(ir_rvalue *ir);
-
- 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),
- };
-
- assert((size >= 1) && (size <= 4));
- 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);
-}
-
-void
-ir_to_mesa_visitor::ir_to_mesa_emit_dp(ir_instruction *ir,
- ir_to_mesa_dst_reg dst,
- ir_to_mesa_src_reg src0,
- ir_to_mesa_src_reg src1,
- unsigned elements)
-{
- static const gl_inst_opcode dot_opcodes[] = {
- OPCODE_DP2, OPCODE_DP3, OPCODE_DP4
- };
-
- ir_to_mesa_emit_op3(ir, dot_opcodes[elements - 2],
- dst, src0, src1, 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 there is another enabled component in the destination that is
- * derived from the same inputs, generate its value on this pass as
- * well.
- */
- 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);
-}
-
-/**
- * Emit an OPCODE_SCS instruction
- *
- * The \c SCS opcode functions a bit differently than the other Mesa (or
- * ARB_fragment_program) opcodes. Instead of splatting its result across all
- * four components of the destination, it writes one value to the \c x
- * component and another value to the \c y component.
- *
- * \param ir IR instruction being processed
- * \param op Either \c OPCODE_SIN or \c OPCODE_COS depending on which
- * value is desired.
- * \param dst Destination register
- * \param src Source register
- */
-void
-ir_to_mesa_visitor::emit_scs(ir_instruction *ir, enum prog_opcode op,
- ir_to_mesa_dst_reg dst,
- const ir_to_mesa_src_reg &src)
-{
- /* Vertex programs cannot use the SCS opcode.
- */
- if (this->prog->Target == GL_VERTEX_PROGRAM_ARB) {
- ir_to_mesa_emit_scalar_op1(ir, op, dst, src);
- return;
- }
-
- const unsigned component = (op == OPCODE_SIN) ? 0 : 1;
- const unsigned scs_mask = (1U << component);
- int done_mask = ~dst.writemask;
- ir_to_mesa_src_reg tmp;
-
- assert(op == OPCODE_SIN || op == OPCODE_COS);
-
- /* If there are compnents in the destination that differ from the component
- * that will be written by the SCS instrution, we'll need a temporary.
- */
- if (scs_mask != unsigned(dst.writemask)) {
- tmp = get_temp(glsl_type::vec4_type);
- }
-
- for (unsigned i = 0; i < 4; i++) {
- unsigned this_mask = (1U << i);
- ir_to_mesa_src_reg src0 = src;
-
- if ((done_mask & this_mask) != 0)
- continue;
-
- /* The source swizzle specified which component of the source generates
- * sine / cosine for the current component in the destination. The SCS
- * instruction requires that this value be swizzle to the X component.
- * Replace the current swizzle with a swizzle that puts the source in
- * the X component.
- */
- unsigned src0_swiz = GET_SWZ(src.swizzle, i);
-
- src0.swizzle = MAKE_SWIZZLE4(src0_swiz, src0_swiz,
- src0_swiz, src0_swiz);
- for (unsigned j = i + 1; j < 4; j++) {
- /* If there is another enabled component in the destination that is
- * derived from the same inputs, generate its value on this pass as
- * well.
- */
- if (!(done_mask & (1 << j)) &&
- GET_SWZ(src0.swizzle, j) == src0_swiz) {
- this_mask |= (1 << j);
- }
- }
-
- if (this_mask != scs_mask) {
- ir_to_mesa_instruction *inst;
- ir_to_mesa_dst_reg tmp_dst = ir_to_mesa_dst_reg_from_src(tmp);
-
- /* Emit the SCS instruction.
- */
- inst = ir_to_mesa_emit_op1(ir, OPCODE_SCS, tmp_dst, src0);
- inst->dst_reg.writemask = scs_mask;
-
- /* Move the result of the SCS instruction to the desired location in
- * the destination.
- */
- tmp.swizzle = MAKE_SWIZZLE4(component, component,
- component, component);
- inst = ir_to_mesa_emit_op1(ir, OPCODE_SCS, dst, tmp);
- inst->dst_reg.writemask = this_mask;
- } else {
- /* Emit the SCS instruction to write directly to the destination.
- */
- ir_to_mesa_instruction *inst =
- ir_to_mesa_emit_op1(ir, OPCODE_SCS, dst, src0);
- inst->dst_reg.writemask = scs_mask;
- }
-
- done_mask |= this_mask;
- }
-}
-
-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;
-}
-
-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;
- const struct gl_builtin_uniform_desc *statevar;
-
- for (i = 0; _mesa_builtin_uniform_desc[i].name; i++) {
- if (strcmp(ir->name, _mesa_builtin_uniform_desc[i].name) == 0)
- break;
- }
-
- if (!_mesa_builtin_uniform_desc[i].name) {
- fail_link(this->shader_program,
- "Failed to find builtin uniform `%s'\n", ir->name);
- return;
- }
-
- statevar = &_mesa_builtin_uniform_desc[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 gl_builtin_uniform_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;
-}
-
-GLboolean
-ir_to_mesa_visitor::try_emit_sat(ir_expression *ir)
-{
- /* Saturates were only introduced to vertex programs in
- * NV_vertex_program3, so don't give them to drivers in the VP.
- */
- if (this->prog->Target == GL_VERTEX_PROGRAM_ARB)
- return false;
-
- ir_rvalue *sat_src = ir->as_rvalue_to_saturate();
- if (!sat_src)
- return false;
-
- sat_src->accept(this);
- ir_to_mesa_src_reg src = this->result;
-
- this->result = get_temp(ir->type);
- ir_to_mesa_instruction *inst;
- inst = ir_to_mesa_emit_op1(ir, OPCODE_MOV,
- ir_to_mesa_dst_reg_from_src(this->result),
- src);
- inst->saturate = true;
-
- 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::emit_swz(ir_expression *ir)
-{
- /* Assume that the vector operator is in a form compatible with OPCODE_SWZ.
- * This means that each of the operands is either an immediate value of -1,
- * 0, or 1, or is a component from one source register (possibly with
- * negation).
- */
- uint8_t components[4] = { 0 };
- bool negate[4] = { false };
- ir_variable *var = NULL;
-
- for (unsigned i = 0; i < ir->type->vector_elements; i++) {
- ir_rvalue *op = ir->operands[i];
-
- assert(op->type->is_scalar());
-
- while (op != NULL) {
- switch (op->ir_type) {
- case ir_type_constant: {
-
- assert(op->type->is_scalar());
-
- const ir_constant *const c = op->as_constant();
- if (c->is_one()) {
- components[i] = SWIZZLE_ONE;
- } else if (c->is_zero()) {
- components[i] = SWIZZLE_ZERO;
- } else if (c->is_negative_one()) {
- components[i] = SWIZZLE_ONE;
- negate[i] = true;
- } else {
- assert(!"SWZ constant must be 0.0 or 1.0.");
- }
-
- op = NULL;
- break;
- }
-
- case ir_type_dereference_variable: {
- ir_dereference_variable *const deref =
- (ir_dereference_variable *) op;
-
- assert((var == NULL) || (deref->var == var));
- components[i] = SWIZZLE_X;
- var = deref->var;
- op = NULL;
- break;
- }
-
- case ir_type_expression: {
- ir_expression *const expr = (ir_expression *) op;
-
- assert(expr->operation == ir_unop_neg);
- negate[i] = true;
-
- op = expr->operands[0];
- break;
- }
-
- case ir_type_swizzle: {
- ir_swizzle *const swiz = (ir_swizzle *) op;
-
- components[i] = swiz->mask.x;
- op = swiz->val;
- break;
- }
-
- default:
- assert(!"Should not get here.");
- return;
- }
- }
- }
-
- assert(var != NULL);
-
- ir_dereference_variable *const deref =
- new(mem_ctx) ir_dereference_variable(var);
-
- this->result.file = PROGRAM_UNDEFINED;
- deref->accept(this);
- if (this->result.file == PROGRAM_UNDEFINED) {
- ir_print_visitor v;
- printf("Failed to get tree for expression operand:\n");
- deref->accept(&v);
- exit(1);
- }
-
- ir_to_mesa_src_reg src;
-
- src = this->result;
- src.swizzle = MAKE_SWIZZLE4(components[0],
- components[1],
- components[2],
- components[3]);
- src.negate = ((unsigned(negate[0]) << 0)
- | (unsigned(negate[1]) << 1)
- | (unsigned(negate[2]) << 2)
- | (unsigned(negate[3]) << 3));
-
- /* Storage for our result. Ideally for an assignment we'd be using the
- * actual storage for the result here, instead.
- */
- const ir_to_mesa_src_reg result_src = get_temp(ir->type);
- ir_to_mesa_dst_reg 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;
-
- ir_to_mesa_emit_op1(ir, OPCODE_SWZ, result_dst, src);
- this->result = result_src;
-}
-
-void
-ir_to_mesa_visitor::visit(ir_expression *ir)
-{
- unsigned int operand;
- struct ir_to_mesa_src_reg op[Elements(ir->operands)];
- struct ir_to_mesa_src_reg result_src;
- struct ir_to_mesa_dst_reg result_dst;
-
- /* 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;
- }
- if (try_emit_sat(ir))
- return;
-
- if (ir->operation == ir_quadop_vector) {
- this->emit_swz(ir);
- 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_sin_reduced:
- emit_scs(ir, OPCODE_SIN, result_dst, op[0]);
- break;
- case ir_unop_cos_reduced:
- emit_scs(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]);
- ir_to_mesa_emit_dp(ir, result_dst, temp, temp, vector_elements);
- 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]);
- ir_to_mesa_emit_dp(ir, result_dst, temp, temp, vector_elements);
- 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:
- assert(ir->operands[0]->type->is_vector());
- ir_to_mesa_emit_dp(ir, result_dst, op[0], op[0],
- ir->operands[0]->type->vector_elements);
- 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:
- assert(ir->operands[0]->type->is_vector());
- assert(ir->operands[0]->type == ir->operands[1]->type);
- ir_to_mesa_emit_dp(ir, result_dst, op[0], op[1],
- ir->operands[0]->type->vector_elements);
- 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:
- case ir_unop_round_even:
- assert(!"GLSL 1.30 features unsupported");
- break;
-
- case ir_quadop_vector:
- /* This operation should have already been handled.
- */
- assert(!"Should not get here.");
- 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);
- }
-
- /* If the type is smaller than a vec4, replicate the last channel out. */
- if (ir->type->is_scalar() || ir->type->is_vector())
- this->result.swizzle = swizzle_for_size(ir->type->vector_elements);
- else
- this->result.swizzle = SWIZZLE_NOOP;
-
- 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);
-}
-
-/**
- * Process the condition of a conditional assignment
- *
- * Examines the condition of a conditional assignment to generate the optimal
- * first operand of a \c CMP instruction. If the condition is a relational
- * operator with 0 (e.g., \c ir_binop_less), the value being compared will be
- * used as the source for the \c CMP instruction. Otherwise the comparison
- * is processed to a boolean result, and the boolean result is used as the
- * operand to the CMP instruction.
- */
-bool
-ir_to_mesa_visitor::process_move_condition(ir_rvalue *ir)
-{
- ir_rvalue *src_ir = ir;
- bool negate = true;
- bool switch_order = false;
-
- ir_expression *const expr = ir->as_expression();
- if ((expr != NULL) && (expr->get_num_operands() == 2)) {
- bool zero_on_left = false;
-
- if (expr->operands[0]->is_zero()) {
- src_ir = expr->operands[1];
- zero_on_left = true;
- } else if (expr->operands[1]->is_zero()) {
- src_ir = expr->operands[0];
- zero_on_left = false;
- }
-
- /* a is - 0 + - 0 +
- * (a < 0) T F F ( a < 0) T F F
- * (0 < a) F F T (-a < 0) F F T
- * (a <= 0) T T F (-a < 0) F F T (swap order of other operands)
- * (0 <= a) F T T ( a < 0) T F F (swap order of other operands)
- * (a > 0) F F T (-a < 0) F F T
- * (0 > a) T F F ( a < 0) T F F
- * (a >= 0) F T T ( a < 0) T F F (swap order of other operands)
- * (0 >= a) T T F (-a < 0) F F T (swap order of other operands)
- *
- * Note that exchanging the order of 0 and 'a' in the comparison simply
- * means that the value of 'a' should be negated.
- */
- if (src_ir != ir) {
- switch (expr->operation) {
- case ir_binop_less:
- switch_order = false;
- negate = zero_on_left;
- break;
-
- case ir_binop_greater:
- switch_order = false;
- negate = !zero_on_left;
- break;
-
- case ir_binop_lequal:
- switch_order = true;
- negate = !zero_on_left;
- break;
-
- case ir_binop_gequal:
- switch_order = true;
- negate = zero_on_left;
- break;
-
- default:
- /* This isn't the right kind of comparison afterall, so make sure
- * the whole condition is visited.
- */
- src_ir = ir;
- break;
- }
- }
- }
-
- src_ir->accept(this);
-
- /* 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 instruction
- * computing the condition.
- */
- if (negate)
- this->result.negate = ~this->result.negate;
-
- return switch_order;
-}
-
-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) {
- const bool switch_order = this->process_move_condition(ir->condition);
- ir_to_mesa_src_reg condition = this->result;
-
- for (i = 0; i < type_size(ir->lhs->type); i++) {
- if (switch_order) {
- ir_to_mesa_emit_op3(ir, OPCODE_CMP, l,
- condition, ir_to_mesa_src_reg_from_dst(l), r);
- } else {
- 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;
-}
-
-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 = _mesa_get_sampler_uniform_value(ir->sampler,
- this->shader_program,
- this->prog);
-
- 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;
-
- if (ir->condition) {
- ir->condition->accept(this);
- this->result.negate = ~this->result.negate;
- ir_to_mesa_emit_op1(ir, OPCODE_KIL, ir_to_mesa_undef_dst, this->result);
- } else {
- 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));
- 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(struct gl_context *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(struct gl_context *ctx,
- struct gl_shader_program *shader_program)
-{
- void *mem_ctx = NULL;
-
- for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) {
- struct gl_shader *shader = shader_program->_LinkedShaders[i];
-
- if (shader == NULL)
- continue;
-
- 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);
-}
-
-
-/**
- * Convert a shader's GLSL IR into a Mesa gl_program.
- */
-static struct gl_program *
-get_mesa_program(struct gl_context *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;
- case GL_GEOMETRY_SHADER:
- target = GL_GEOMETRY_PROGRAM_NV;
- target_string = "geometry";
- 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);
-
- /* Convert ir_mesa_instructions into prog_instructions.
- */
- mesa_inst = mesa_instructions;
- i = 0;
- foreach_iter(exec_list_iterator, iter, v.instructions) {
- const ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get();
-
- mesa_inst->Opcode = inst->op;
- mesa_inst->CondUpdate = inst->cond_update;
- if (inst->saturate)
- mesa_inst->SaturateMode = SATURATE_ZERO_ONE;
- 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;
-
- /* Update program's bitmask of indirectly accessed register files */
- 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++;
-
- if (!shader_program->LinkStatus)
- break;
- }
-
- if (!shader_program->LinkStatus) {
- free(mesa_instructions);
- _mesa_reference_program(ctx, &shader->Program, NULL);
- return NULL;
- }
-
- 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" {
-
-/**
- * Called via ctx->Driver.CompilerShader().
- * This is a no-op.
- * XXX can we remove the ctx->Driver.CompileShader() hook?
- */
-GLboolean
-_mesa_ir_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
-{
- assert(shader->CompileStatus);
- (void) ctx;
-
- return GL_TRUE;
-}
-
-
-/**
- * Link a shader.
- * Called via ctx->Driver.LinkShader()
- * This actually involves converting GLSL IR into Mesa gl_programs with
- * code lowering and other optimizations.
- */
-GLboolean
-_mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
-{
- assert(prog->LinkStatus);
-
- for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
- if (prog->_LinkedShaders[i] == NULL)
- continue;
-
- bool progress;
- exec_list *ir = prog->_LinkedShaders[i]->ir;
- const 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);
- lower_instructions(ir, (MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2
- | LOG_TO_LOG2
- | ((options->EmitNoPow) ? POW_TO_EXP2 : 0)));
-
- progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
-
- progress = do_common_optimization(ir, true, options->MaxUnrollIterations) || progress;
-
- progress = lower_quadop_vector(ir, true) || progress;
-
- if (options->EmitNoIfs) {
- progress = lower_discard(ir) || progress;
- progress = lower_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 < MESA_SHADER_TYPES; i++) {
- struct gl_program *linked_prog;
-
- if (prog->_LinkedShaders[i] == NULL)
- continue;
-
- linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]);
-
- if (linked_prog) {
- bool ok = true;
-
- 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;
- case GL_GEOMETRY_SHADER:
- _mesa_reference_geomprog(ctx, &prog->GeometryProgram,
- (struct gl_geometry_program *)linked_prog);
- ok = ctx->Driver.ProgramStringNotify(ctx, GL_GEOMETRY_PROGRAM_NV,
- linked_prog);
- break;
- }
- if (!ok) {
- return GL_FALSE;
- }
- }
-
- _mesa_reference_program(ctx, &linked_prog, NULL);
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Compile a GLSL shader. Called via glCompileShader().
- */
-void
-_mesa_glsl_compile_shader(struct gl_context *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;
- }
-}
-
-
-/**
- * Link a GLSL shader program. Called via glLinkProgram().
- */
-void
-_mesa_glsl_link_shader(struct gl_context *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);
- _mesa_reference_geomprog(ctx, &prog->GeometryProgram, 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/src/mesa/program/lex.yy.c b/src/mesa/program/lex.yy.c
deleted file mode 100644
index 135eca6..0000000
--- a/src/mesa/program/lex.yy.c
+++ /dev/null
@@ -1,3681 +0,0 @@
-
-#line 3 "lex.yy.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 yyrestart(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 yyrestart()), 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 yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void yypop_buffer_state (yyscan_t yyscanner );
-
-static void yyensure_buffer_stack (yyscan_t yyscanner );
-static void yy_load_buffer_state (yyscan_t yyscanner );
-static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
-
-#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
-
-YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
-
-void *yyalloc (yy_size_t ,yyscan_t yyscanner );
-void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
-void yyfree (void * ,yyscan_t yyscanner );
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
- yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_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 ){\
- yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_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 yywrap(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 170
-#define YY_END_OF_BUFFER 171
-/* 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[850] =
- { 0,
- 0, 0, 171, 169, 167, 166, 169, 169, 139, 165,
- 141, 141, 141, 141, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 167, 0, 0, 168, 139,
- 0, 140, 142, 162, 162, 0, 0, 0, 0, 162,
- 0, 0, 0, 0, 0, 0, 0, 119, 163, 120,
- 121, 153, 153, 153, 153, 0, 141, 0, 127, 128,
- 129, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
-
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 161, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 160, 160, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 159, 159, 159, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 150, 150, 150, 151, 151, 152, 143,
- 142, 143, 0, 144, 11, 12, 139, 13, 139, 139,
- 14, 15, 139, 16, 17, 18, 19, 20, 21, 6,
-
- 22, 23, 24, 25, 26, 28, 27, 29, 30, 31,
- 32, 33, 34, 35, 139, 139, 139, 139, 139, 40,
- 41, 139, 42, 43, 44, 45, 46, 47, 48, 139,
- 49, 50, 51, 52, 53, 54, 55, 139, 56, 57,
- 58, 59, 139, 139, 64, 65, 139, 139, 139, 139,
- 139, 139, 0, 0, 0, 0, 142, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 80, 81, 83,
- 0, 158, 0, 0, 0, 0, 0, 0, 97, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 157,
- 156, 156, 109, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 147, 147, 148, 149, 0, 145, 11,
- 11, 139, 12, 12, 12, 139, 139, 139, 139, 139,
- 15, 15, 139, 130, 16, 16, 139, 17, 17, 139,
- 18, 18, 139, 19, 19, 139, 20, 20, 139, 21,
- 21, 139, 22, 22, 139, 24, 24, 139, 25, 25,
- 139, 28, 28, 139, 27, 27, 139, 30, 30, 139,
- 31, 31, 139, 32, 32, 139, 33, 33, 139, 34,
- 34, 139, 35, 35, 139, 139, 139, 139, 36, 139,
- 38, 139, 40, 40, 139, 41, 41, 139, 131, 42,
- 42, 139, 43, 43, 139, 139, 45, 45, 139, 46,
-
- 46, 139, 47, 47, 139, 48, 48, 139, 139, 49,
- 49, 139, 50, 50, 139, 51, 51, 139, 52, 52,
- 139, 53, 53, 139, 54, 54, 139, 139, 10, 56,
- 139, 57, 139, 58, 139, 59, 139, 60, 139, 62,
- 139, 64, 64, 139, 139, 139, 139, 139, 139, 139,
- 139, 0, 164, 0, 0, 0, 73, 74, 0, 0,
- 0, 0, 0, 0, 0, 85, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 155, 0, 0, 0, 113, 0,
- 115, 0, 0, 0, 0, 0, 0, 154, 146, 139,
-
- 139, 139, 4, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 9, 37, 39, 139,
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 60, 139, 61, 62, 139, 63, 139, 139, 139, 139,
- 139, 69, 139, 139, 0, 0, 0, 0, 0, 75,
- 76, 0, 0, 0, 0, 84, 0, 0, 88, 91,
- 0, 0, 0, 0, 0, 0, 0, 102, 103, 0,
- 0, 0, 0, 108, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 139, 139, 139, 139, 139, 139,
- 5, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 7, 8, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 61, 139, 139, 63, 139, 139,
- 139, 139, 139, 70, 139, 66, 0, 0, 0, 0,
- 124, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 94, 0, 98, 99, 0, 101, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 117, 118, 0, 0,
-
- 125, 11, 3, 12, 135, 136, 139, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 24, 25, 28, 27,
- 30, 31, 32, 33, 34, 35, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 139, 139, 139, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 139,
- 139, 139, 139, 64, 65, 139, 68, 126, 0, 0,
- 71, 0, 77, 0, 0, 0, 86, 0, 0, 0,
- 0, 0, 0, 100, 0, 0, 106, 93, 0, 0,
- 0, 0, 0, 0, 122, 0, 139, 132, 133, 139,
- 60, 139, 62, 139, 67, 0, 0, 0, 0, 79,
-
- 82, 87, 0, 0, 92, 0, 0, 0, 105, 0,
- 0, 0, 0, 114, 116, 0, 139, 139, 61, 63,
- 2, 1, 0, 78, 0, 90, 0, 96, 104, 0,
- 0, 111, 112, 123, 139, 134, 0, 89, 0, 107,
- 110, 139, 72, 95, 139, 139, 137, 138, 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, 7, 1, 1, 1, 1,
- 1, 1, 8, 1, 8, 9, 1, 10, 11, 12,
- 13, 14, 15, 15, 15, 15, 15, 1, 1, 1,
- 1, 1, 1, 1, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 7, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 1, 1, 1, 1, 41, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 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[68] =
- { 0,
- 1, 1, 1, 1, 1, 1, 2, 1, 3, 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
- } ;
-
-static yyconst flex_int16_t yy_base[853] =
- { 0,
- 0, 0, 1299, 1300, 66, 1300, 1293, 1294, 0, 69,
- 85, 128, 140, 152, 151, 58, 56, 63, 76, 1272,
- 158, 160, 39, 163, 173, 189, 52, 1265, 76, 1235,
- 1234, 1246, 1230, 1244, 1243, 105, 1272, 1284, 1300, 0,
- 225, 1300, 218, 160, 157, 20, 123, 66, 119, 192,
- 1244, 1230, 54, 162, 1228, 1240, 194, 1300, 200, 195,
- 98, 227, 196, 231, 235, 293, 305, 316, 1300, 1300,
- 1300, 1249, 1262, 1256, 223, 1245, 1248, 1244, 1259, 107,
- 298, 1241, 1255, 246, 1241, 1254, 1245, 1258, 1235, 1246,
- 1237, 182, 1238, 1229, 1238, 1229, 1228, 1229, 144, 1223,
-
- 1229, 1240, 1231, 1225, 1222, 1223, 1227, 289, 1236, 1223,
- 302, 1230, 1217, 1231, 1207, 65, 315, 276, 1227, 1226,
- 1202, 1187, 1182, 1199, 1175, 1180, 1206, 279, 1195, 293,
- 1190, 342, 299, 1192, 1173, 317, 1183, 1179, 1174, 207,
- 1180, 1166, 1182, 1179, 1170, 320, 324, 1172, 1161, 1175,
- 1178, 1160, 1175, 1162, 1159, 1166, 284, 1174, 227, 288,
- 327, 342, 345, 1151, 1168, 1169, 1162, 1144, 318, 1145,
- 1167, 1158, 330, 341, 345, 349, 353, 357, 361, 1300,
- 419, 430, 436, 442, 440, 441, 1191, 0, 1190, 1173,
- 1163, 443, 1183, 444, 451, 468, 470, 472, 471, 0,
-
- 496, 0, 497, 498, 0, 499, 500, 0, 524, 525,
- 526, 536, 537, 553, 1178, 1171, 1184, 354, 356, 561,
- 563, 1165, 564, 565, 1157, 580, 590, 591, 592, 1178,
- 593, 617, 618, 619, 629, 630, 1155, 1165, 330, 362,
- 419, 483, 445, 364, 646, 1153, 1145, 1144, 1129, 1129,
- 1128, 1127, 1170, 1142, 1130, 662, 669, 643, 1134, 487,
- 1131, 1125, 1125, 1119, 1132, 1132, 1117, 1300, 1300, 1132,
- 1120, 646, 1127, 135, 1124, 1130, 561, 1125, 1300, 1116,
- 1123, 1122, 1125, 1111, 1110, 1114, 1109, 448, 1114, 650,
- 653, 665, 1300, 1106, 1104, 1104, 1112, 1113, 1095, 670,
-
- 1100, 1106, 486, 579, 655, 661, 668, 726, 732, 1112,
- 682, 1119, 1110, 688, 730, 1117, 1116, 1109, 1123, 1113,
- 1104, 712, 1111, 0, 1102, 731, 1109, 1100, 733, 1107,
- 1098, 734, 1105, 1096, 736, 1103, 1094, 737, 1101, 1092,
- 738, 1099, 1090, 739, 1097, 1088, 740, 1095, 1086, 741,
- 1093, 1084, 742, 1091, 1082, 743, 1089, 1080, 744, 1087,
- 1078, 745, 1085, 1076, 746, 1083, 1074, 747, 1081, 1072,
- 748, 1079, 1070, 749, 1077, 1080, 1073, 1080, 0, 1073,
- 0, 1088, 1063, 750, 1070, 1061, 751, 1068, 0, 1059,
- 752, 1066, 1057, 755, 1064, 1063, 1054, 758, 1061, 1052,
-
- 776, 1059, 1050, 777, 1057, 1048, 779, 1055, 1058, 1045,
- 780, 1052, 1043, 782, 1050, 1041, 783, 1048, 1039, 784,
- 1046, 1037, 785, 1044, 1035, 786, 1042, 1041, 0, 1032,
- 1039, 1030, 1037, 1028, 1035, 1026, 1033, 787, 1032, 788,
- 1047, 1022, 789, 1029, 1028, 1006, 1000, 1005, 1011, 994,
- 1009, 424, 1300, 1008, 998, 1002, 1300, 1300, 992, 1001,
- 987, 1004, 987, 990, 984, 1300, 985, 984, 981, 988,
- 981, 989, 985, 995, 992, 974, 980, 987, 971, 970,
- 988, 970, 982, 981, 1300, 980, 970, 974, 1300, 961,
- 1300, 966, 966, 974, 957, 958, 968, 1300, 1300, 1000,
-
- 982, 998, 0, 798, 996, 996, 995, 994, 993, 992,
- 991, 990, 989, 988, 987, 986, 985, 984, 983, 982,
- 981, 980, 979, 978, 965, 958, 0, 0, 0, 975,
- 974, 973, 972, 971, 970, 969, 968, 967, 945, 965,
- 964, 963, 962, 961, 960, 959, 958, 957, 956, 955,
- 929, 936, 793, 927, 934, 794, 950, 949, 918, 921,
- 901, 0, 902, 895, 902, 901, 902, 894, 912, 1300,
- 1300, 894, 892, 902, 895, 1300, 890, 907, 516, 1300,
- 898, 882, 883, 892, 883, 882, 882, 1300, 881, 890,
- 880, 896, 893, 1300, 892, 890, 879, 880, 876, 868,
-
- 875, 870, 871, 866, 892, 892, 890, 904, 903, 898,
- 0, 886, 885, 884, 883, 882, 881, 880, 879, 878,
- 877, 876, 875, 874, 873, 872, 871, 870, 869, 868,
- 0, 0, 867, 866, 865, 864, 863, 862, 861, 860,
- 859, 804, 858, 857, 856, 855, 854, 853, 852, 851,
- 850, 849, 848, 865, 839, 846, 862, 836, 843, 841,
- 840, 818, 818, 0, 825, 0, 859, 858, 807, 825,
- 1300, 820, 815, 808, 804, 816, 806, 804, 800, 816,
- 807, 806, 1300, 1300, 809, 1300, 804, 797, 786, 797,
- 789, 793, 806, 801, 804, 786, 1300, 1300, 798, 787,
-
- 1300, 0, 0, 0, 0, 0, 826, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 814, 813, 802, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 785,
- 798, 779, 792, 0, 0, 656, 0, 0, 706, 702,
- 1300, 649, 1300, 648, 648, 654, 1300, 637, 645, 610,
- 612, 608, 608, 1300, 572, 583, 1300, 1300, 577, 573,
- 560, 557, 542, 555, 1300, 539, 573, 0, 0, 572,
- 0, 555, 0, 546, 0, 562, 551, 495, 479, 1300,
-
- 1300, 1300, 481, 481, 1300, 480, 443, 31, 1300, 141,
- 166, 171, 186, 1300, 1300, 211, 236, 276, 0, 0,
- 1300, 1300, 290, 1300, 325, 1300, 346, 1300, 1300, 343,
- 341, 1300, 1300, 1300, 365, 0, 380, 1300, 371, 1300,
- 1300, 486, 1300, 1300, 451, 458, 0, 0, 1300, 836,
- 503, 839
- } ;
-
-static yyconst flex_int16_t yy_def[853] =
- { 0,
- 849, 1, 849, 849, 849, 849, 849, 850, 851, 849,
- 849, 849, 849, 849, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 849, 849, 850, 849, 851,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 852, 849, 849, 849, 849,
- 849, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
-
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
-
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
-
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
-
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 851,
-
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
-
- 849, 849, 849, 849, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
-
- 849, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 851, 851, 851, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 851, 851, 851, 851,
- 851, 851, 851, 851, 851, 849, 849, 849, 849, 849,
-
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 851, 851, 851, 851,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 851, 851, 849, 849, 849, 849,
- 849, 851, 849, 849, 851, 851, 851, 851, 0, 849,
- 849, 849
- } ;
-
-static yyconst flex_int16_t yy_nxt[1368] =
- { 0,
- 4, 5, 6, 5, 7, 8, 9, 4, 10, 11,
- 12, 13, 14, 11, 11, 15, 9, 16, 17, 18,
- 19, 9, 9, 9, 20, 21, 22, 9, 23, 24,
- 9, 25, 26, 27, 28, 9, 9, 29, 9, 9,
- 9, 9, 9, 9, 9, 9, 30, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 31, 9, 32, 33,
- 34, 9, 35, 9, 9, 9, 9, 36, 96, 36,
- 41, 116, 137, 97, 80, 138, 829, 42, 43, 43,
- 43, 43, 43, 43, 77, 81, 78, 119, 82, 117,
- 83, 238, 79, 66, 67, 67, 67, 67, 67, 67,
-
- 84, 85, 239, 150, 68, 120, 36, 86, 36, 151,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 141,
- 142, 53, 54, 55, 56, 57, 58, 59, 60, 61,
- 68, 143, 62, 63, 64, 65, 66, 67, 67, 67,
- 67, 67, 67, 170, 194, 195, 69, 68, 66, 67,
- 67, 67, 67, 67, 67, 218, 171, 219, 70, 68,
- 66, 67, 67, 67, 67, 67, 67, 72, 139, 73,
- 71, 68, 140, 68, 144, 92, 74, 145, 98, 88,
- 467, 89, 75, 93, 76, 68, 90, 99, 94, 91,
- 101, 100, 102, 103, 95, 468, 830, 68, 136, 133,
-
- 210, 133, 133, 152, 133, 104, 105, 133, 106, 107,
- 108, 109, 110, 134, 111, 133, 112, 153, 133, 211,
- 135, 831, 113, 114, 154, 115, 41, 43, 43, 43,
- 43, 43, 43, 146, 147, 157, 832, 132, 165, 133,
- 166, 161, 162, 167, 168, 833, 158, 163, 188, 159,
- 133, 169, 160, 265, 189, 164, 834, 201, 133, 174,
- 173, 175, 176, 132, 835, 266, 128, 129, 46, 47,
- 48, 49, 172, 51, 52, 202, 285, 53, 54, 55,
- 56, 57, 58, 130, 60, 61, 286, 243, 131, 244,
- 173, 173, 173, 173, 177, 173, 173, 178, 179, 173,
-
- 173, 173, 181, 181, 181, 181, 181, 181, 228, 836,
- 196, 197, 182, 66, 67, 67, 67, 67, 67, 67,
- 198, 232, 229, 183, 68, 184, 184, 184, 184, 184,
- 184, 240, 134, 241, 255, 233, 282, 287, 182, 135,
- 258, 258, 283, 288, 242, 837, 258, 430, 164, 256,
- 68, 257, 257, 257, 257, 257, 257, 258, 258, 258,
- 261, 258, 258, 298, 258, 272, 258, 258, 258, 258,
- 431, 258, 381, 299, 258, 258, 379, 838, 258, 432,
- 440, 289, 258, 290, 258, 258, 291, 292, 380, 258,
- 382, 839, 258, 303, 303, 303, 303, 840, 441, 841,
-
- 258, 842, 433, 258, 303, 303, 303, 303, 304, 303,
- 303, 305, 306, 303, 303, 303, 303, 303, 303, 303,
- 307, 303, 303, 303, 303, 303, 303, 303, 43, 43,
- 43, 43, 43, 43, 843, 844, 434, 308, 132, 309,
- 309, 309, 309, 309, 309, 184, 184, 184, 184, 184,
- 184, 184, 184, 184, 184, 184, 184, 310, 313, 435,
- 321, 325, 311, 314, 132, 322, 326, 438, 328, 847,
- 565, 311, 315, 329, 322, 326, 848, 311, 314, 439,
- 312, 316, 329, 323, 327, 331, 566, 334, 340, 337,
- 332, 330, 335, 341, 338, 482, 845, 846, 483, 332,
-
- 436, 335, 341, 338, 40, 332, 828, 335, 333, 338,
- 336, 342, 339, 343, 346, 349, 352, 355, 344, 347,
- 350, 353, 356, 437, 827, 826, 825, 344, 347, 350,
- 353, 356, 455, 824, 347, 350, 345, 348, 351, 354,
- 357, 358, 361, 364, 823, 456, 359, 362, 365, 498,
- 498, 498, 498, 367, 370, 359, 362, 365, 368, 371,
- 822, 359, 362, 365, 360, 363, 366, 368, 371, 678,
- 373, 821, 679, 368, 371, 374, 369, 372, 383, 820,
- 386, 390, 393, 384, 374, 387, 391, 394, 819, 818,
- 374, 817, 384, 375, 387, 391, 394, 397, 816, 815,
-
- 814, 385, 398, 388, 392, 395, 471, 400, 403, 406,
- 410, 398, 401, 404, 407, 411, 813, 398, 812, 472,
- 399, 401, 404, 407, 411, 811, 810, 401, 404, 407,
- 402, 405, 408, 412, 413, 416, 419, 809, 808, 414,
- 417, 420, 498, 498, 498, 498, 422, 425, 414, 417,
- 420, 423, 426, 807, 414, 417, 420, 415, 418, 421,
- 423, 426, 806, 442, 805, 804, 423, 426, 443, 424,
- 427, 257, 257, 257, 257, 257, 257, 443, 257, 257,
- 257, 257, 257, 257, 453, 453, 444, 453, 453, 803,
- 453, 453, 453, 453, 453, 453, 802, 453, 801, 310,
-
- 453, 453, 800, 799, 453, 313, 485, 453, 453, 798,
- 797, 453, 453, 492, 796, 493, 795, 494, 499, 498,
- 498, 498, 312, 453, 498, 498, 498, 498, 316, 321,
- 495, 498, 498, 498, 498, 309, 309, 309, 309, 309,
- 309, 309, 309, 309, 309, 309, 309, 313, 325, 501,
- 328, 331, 323, 334, 337, 340, 343, 346, 349, 352,
- 355, 358, 361, 364, 367, 370, 373, 383, 386, 390,
- 316, 327, 393, 330, 333, 397, 336, 339, 342, 345,
- 348, 351, 354, 357, 360, 363, 366, 369, 372, 375,
- 385, 388, 392, 400, 403, 395, 406, 410, 399, 413,
-
- 416, 419, 422, 425, 551, 554, 442, 794, 608, 609,
- 655, 658, 793, 792, 736, 737, 402, 405, 791, 408,
- 412, 790, 415, 418, 421, 424, 427, 552, 555, 444,
- 610, 789, 788, 656, 659, 738, 38, 38, 38, 180,
- 180, 787, 786, 785, 784, 783, 782, 781, 780, 779,
- 778, 777, 776, 775, 774, 773, 772, 771, 770, 769,
- 768, 767, 766, 765, 764, 763, 762, 761, 760, 759,
- 758, 757, 756, 755, 754, 753, 659, 752, 751, 656,
- 750, 749, 748, 747, 746, 745, 744, 743, 742, 741,
- 740, 739, 735, 734, 733, 732, 731, 730, 729, 728,
-
- 727, 726, 725, 724, 723, 722, 721, 720, 719, 718,
- 717, 716, 715, 714, 713, 712, 711, 710, 709, 708,
- 707, 706, 705, 704, 703, 702, 701, 700, 699, 698,
- 697, 696, 695, 694, 693, 692, 691, 690, 689, 688,
- 687, 686, 685, 684, 683, 682, 681, 680, 677, 676,
- 675, 674, 673, 672, 671, 670, 669, 668, 667, 666,
- 665, 664, 663, 662, 661, 660, 657, 555, 654, 552,
- 653, 652, 651, 650, 649, 648, 647, 646, 645, 644,
- 643, 642, 641, 640, 639, 638, 637, 636, 635, 634,
- 633, 632, 631, 630, 629, 628, 627, 626, 625, 624,
-
- 623, 622, 621, 620, 619, 618, 617, 616, 615, 614,
- 613, 612, 611, 607, 606, 605, 604, 603, 602, 601,
- 600, 599, 598, 597, 596, 595, 594, 593, 592, 591,
- 590, 589, 588, 587, 586, 585, 584, 583, 582, 581,
- 580, 579, 578, 577, 576, 575, 574, 573, 572, 571,
- 570, 569, 568, 567, 564, 563, 562, 561, 560, 559,
- 558, 557, 444, 556, 553, 550, 437, 549, 435, 548,
- 433, 547, 431, 546, 545, 427, 544, 424, 543, 421,
- 542, 418, 541, 415, 540, 412, 539, 538, 408, 537,
- 405, 536, 402, 535, 399, 534, 533, 395, 532, 392,
-
- 531, 388, 530, 385, 529, 528, 527, 526, 525, 524,
- 375, 523, 372, 522, 369, 521, 366, 520, 363, 519,
- 360, 518, 357, 517, 354, 516, 351, 515, 348, 514,
- 345, 513, 342, 512, 339, 511, 336, 510, 333, 509,
- 330, 508, 327, 507, 323, 506, 505, 504, 503, 502,
- 316, 500, 312, 497, 496, 491, 490, 489, 488, 487,
- 486, 484, 481, 480, 479, 478, 477, 476, 475, 474,
- 473, 470, 469, 466, 465, 464, 463, 462, 461, 460,
- 459, 458, 457, 454, 289, 261, 452, 451, 450, 449,
- 448, 447, 446, 445, 429, 428, 409, 396, 389, 378,
-
- 377, 376, 324, 320, 319, 318, 317, 302, 301, 300,
- 297, 296, 295, 294, 293, 284, 281, 280, 279, 278,
- 277, 276, 275, 274, 273, 271, 270, 269, 268, 267,
- 264, 263, 262, 260, 259, 172, 254, 253, 252, 251,
- 250, 249, 248, 247, 246, 245, 237, 236, 235, 234,
- 231, 230, 227, 226, 225, 224, 223, 222, 221, 220,
- 217, 216, 215, 214, 213, 212, 209, 208, 207, 206,
- 205, 204, 203, 200, 199, 193, 192, 191, 190, 187,
- 186, 185, 156, 155, 149, 148, 39, 127, 126, 125,
- 124, 123, 122, 121, 118, 87, 39, 37, 849, 3,
-
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849
- } ;
-
-static yyconst flex_int16_t yy_chk[1368] =
- { 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, 1, 1, 1, 5, 23, 5,
- 10, 27, 46, 23, 17, 46, 808, 10, 10, 10,
- 10, 10, 10, 10, 16, 17, 16, 29, 17, 27,
- 18, 116, 16, 11, 11, 11, 11, 11, 11, 11,
-
- 18, 19, 116, 53, 11, 29, 36, 19, 36, 53,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 48,
- 48, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 11, 48, 10, 10, 10, 10, 12, 12, 12, 12,
- 12, 12, 12, 61, 80, 80, 12, 12, 13, 13,
- 13, 13, 13, 13, 13, 99, 61, 99, 13, 13,
- 14, 14, 14, 14, 14, 14, 14, 15, 47, 15,
- 14, 14, 47, 12, 49, 22, 15, 49, 24, 21,
- 274, 21, 15, 22, 15, 13, 21, 24, 22, 21,
- 25, 24, 25, 25, 22, 274, 810, 14, 45, 45,
-
- 92, 44, 44, 54, 45, 25, 26, 44, 26, 26,
- 26, 26, 26, 44, 26, 45, 26, 54, 44, 92,
- 44, 811, 26, 26, 54, 26, 41, 43, 43, 43,
- 43, 43, 43, 50, 50, 57, 812, 43, 60, 50,
- 60, 59, 59, 60, 60, 813, 57, 59, 75, 57,
- 50, 60, 57, 140, 75, 59, 816, 84, 59, 63,
- 63, 63, 63, 43, 817, 140, 41, 41, 41, 41,
- 41, 41, 62, 41, 41, 84, 159, 41, 41, 41,
- 41, 41, 41, 41, 41, 41, 159, 118, 41, 118,
- 62, 62, 62, 62, 64, 64, 64, 64, 65, 65,
-
- 65, 65, 66, 66, 66, 66, 66, 66, 108, 818,
- 81, 81, 66, 67, 67, 67, 67, 67, 67, 67,
- 81, 111, 108, 68, 67, 68, 68, 68, 68, 68,
- 68, 117, 128, 117, 130, 111, 157, 160, 66, 128,
- 133, 133, 157, 160, 117, 823, 133, 239, 130, 132,
- 67, 132, 132, 132, 132, 132, 132, 133, 136, 136,
- 136, 146, 146, 169, 136, 147, 147, 146, 161, 161,
- 239, 147, 219, 169, 161, 136, 218, 825, 146, 240,
- 244, 161, 147, 162, 162, 161, 163, 163, 218, 162,
- 219, 827, 163, 173, 173, 173, 173, 830, 244, 831,
-
- 162, 835, 240, 163, 174, 174, 174, 174, 175, 175,
- 175, 175, 176, 176, 176, 176, 177, 177, 177, 177,
- 178, 178, 178, 178, 179, 179, 179, 179, 181, 181,
- 181, 181, 181, 181, 837, 839, 241, 182, 181, 182,
- 182, 182, 182, 182, 182, 183, 183, 183, 183, 183,
- 183, 184, 184, 184, 184, 184, 184, 185, 186, 241,
- 192, 194, 185, 186, 181, 192, 194, 243, 195, 845,
- 452, 185, 186, 195, 192, 194, 846, 185, 186, 243,
- 185, 186, 195, 192, 194, 196, 452, 197, 199, 198,
- 196, 195, 197, 199, 198, 288, 842, 842, 288, 196,
-
- 242, 197, 199, 198, 851, 196, 807, 197, 196, 198,
- 197, 199, 198, 201, 203, 204, 206, 207, 201, 203,
- 204, 206, 207, 242, 806, 804, 803, 201, 203, 204,
- 206, 207, 260, 799, 203, 204, 201, 203, 204, 206,
- 207, 209, 210, 211, 798, 260, 209, 210, 211, 303,
- 303, 303, 303, 212, 213, 209, 210, 211, 212, 213,
- 797, 209, 210, 211, 209, 210, 211, 212, 213, 579,
- 214, 796, 579, 212, 213, 214, 212, 213, 220, 794,
- 221, 223, 224, 220, 214, 221, 223, 224, 792, 790,
- 214, 787, 220, 214, 221, 223, 224, 226, 786, 784,
-
- 783, 220, 226, 221, 223, 224, 277, 227, 228, 229,
- 231, 226, 227, 228, 229, 231, 782, 226, 781, 277,
- 226, 227, 228, 229, 231, 780, 779, 227, 228, 229,
- 227, 228, 229, 231, 232, 233, 234, 776, 775, 232,
- 233, 234, 304, 304, 304, 304, 235, 236, 232, 233,
- 234, 235, 236, 773, 232, 233, 234, 232, 233, 234,
- 235, 236, 772, 245, 771, 770, 235, 236, 245, 235,
- 236, 256, 256, 256, 256, 256, 256, 245, 257, 257,
- 257, 257, 257, 257, 258, 258, 245, 272, 272, 769,
- 258, 290, 290, 272, 291, 291, 768, 290, 766, 311,
-
- 291, 258, 765, 764, 272, 314, 292, 292, 290, 762,
- 760, 291, 292, 300, 759, 300, 756, 300, 305, 305,
- 305, 305, 311, 292, 306, 306, 306, 306, 314, 322,
- 300, 307, 307, 307, 307, 308, 308, 308, 308, 308,
- 308, 309, 309, 309, 309, 309, 309, 315, 326, 315,
- 329, 332, 322, 335, 338, 341, 344, 347, 350, 353,
- 356, 359, 362, 365, 368, 371, 374, 384, 387, 391,
- 315, 326, 394, 329, 332, 398, 335, 338, 341, 344,
- 347, 350, 353, 356, 359, 362, 365, 368, 371, 374,
- 384, 387, 391, 401, 404, 394, 407, 411, 398, 414,
-
- 417, 420, 423, 426, 438, 440, 443, 753, 504, 504,
- 553, 556, 752, 751, 642, 642, 401, 404, 750, 407,
- 411, 738, 414, 417, 420, 423, 426, 438, 440, 443,
- 504, 737, 736, 553, 556, 642, 850, 850, 850, 852,
- 852, 707, 700, 699, 696, 695, 694, 693, 692, 691,
- 690, 689, 688, 687, 685, 682, 681, 680, 679, 678,
- 677, 676, 675, 674, 673, 672, 670, 669, 668, 667,
- 665, 663, 662, 661, 660, 659, 658, 657, 656, 655,
- 654, 653, 652, 651, 650, 649, 648, 647, 646, 645,
- 644, 643, 641, 640, 639, 638, 637, 636, 635, 634,
-
- 633, 630, 629, 628, 627, 626, 625, 624, 623, 622,
- 621, 620, 619, 618, 617, 616, 615, 614, 613, 612,
- 610, 609, 608, 607, 606, 605, 604, 603, 602, 601,
- 600, 599, 598, 597, 596, 595, 593, 592, 591, 590,
- 589, 587, 586, 585, 584, 583, 582, 581, 578, 577,
- 575, 574, 573, 572, 569, 568, 567, 566, 565, 564,
- 563, 561, 560, 559, 558, 557, 555, 554, 552, 551,
- 550, 549, 548, 547, 546, 545, 544, 543, 542, 541,
- 540, 539, 538, 537, 536, 535, 534, 533, 532, 531,
- 530, 526, 525, 524, 523, 522, 521, 520, 519, 518,
-
- 517, 516, 515, 514, 513, 512, 511, 510, 509, 508,
- 507, 506, 505, 502, 501, 500, 497, 496, 495, 494,
- 493, 492, 490, 488, 487, 486, 484, 483, 482, 481,
- 480, 479, 478, 477, 476, 475, 474, 473, 472, 471,
- 470, 469, 468, 467, 465, 464, 463, 462, 461, 460,
- 459, 456, 455, 454, 451, 450, 449, 448, 447, 446,
- 445, 444, 442, 441, 439, 437, 436, 435, 434, 433,
- 432, 431, 430, 428, 427, 425, 424, 422, 421, 419,
- 418, 416, 415, 413, 412, 410, 409, 408, 406, 405,
- 403, 402, 400, 399, 397, 396, 395, 393, 392, 390,
-
- 388, 386, 385, 383, 382, 380, 378, 377, 376, 375,
- 373, 372, 370, 369, 367, 366, 364, 363, 361, 360,
- 358, 357, 355, 354, 352, 351, 349, 348, 346, 345,
- 343, 342, 340, 339, 337, 336, 334, 333, 331, 330,
- 328, 327, 325, 323, 321, 320, 319, 318, 317, 316,
- 313, 312, 310, 302, 301, 299, 298, 297, 296, 295,
- 294, 289, 287, 286, 285, 284, 283, 282, 281, 280,
- 278, 276, 275, 273, 271, 270, 267, 266, 265, 264,
- 263, 262, 261, 259, 255, 254, 253, 252, 251, 250,
- 249, 248, 247, 246, 238, 237, 230, 225, 222, 217,
-
- 216, 215, 193, 191, 190, 189, 187, 172, 171, 170,
- 168, 167, 166, 165, 164, 158, 156, 155, 154, 153,
- 152, 151, 150, 149, 148, 145, 144, 143, 142, 141,
- 139, 138, 137, 135, 134, 131, 129, 127, 126, 125,
- 124, 123, 122, 121, 120, 119, 115, 114, 113, 112,
- 110, 109, 107, 106, 105, 104, 103, 102, 101, 100,
- 98, 97, 96, 95, 94, 93, 91, 90, 89, 88,
- 87, 86, 85, 83, 82, 79, 78, 77, 76, 74,
- 73, 72, 56, 55, 52, 51, 38, 37, 35, 34,
- 33, 32, 31, 30, 28, 20, 8, 7, 3, 849,
-
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849, 849, 849, 849,
- 849, 849, 849, 849, 849, 849, 849
- } ;
-
-/* 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 "program_lexer.l"
-#line 2 "program_lexer.l"
-/*
- * 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 "main/glheader.h"
-#include "main/imports.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)
-#define require_NV_fp (yyextra->option.NV_fragment)
-#define require_shadow (yyextra->option.Shadow)
-#define require_rect (yyextra->option.TexRect)
-#define require_texarray (yyextra->option.TexArray)
-
-#ifndef HAVE_UNISTD_H
-#define YY_NO_UNISTD_H
-#endif
-
-#define return_token_or_IDENTIFIER(condition, token) \
- do { \
- if (condition) { \
- return token; \
- } else { \
- return handle_ident(yyextra, yytext, yylval); \
- } \
- } while (0)
-
-#define return_token_or_DOT(condition, token) \
- do { \
- if (condition) { \
- return token; \
- } else { \
- yyless(1); \
- return DOT; \
- } \
- } while (0)
-
-
-#define return_opcode(condition, token, opcode, len) \
- do { \
- if (condition && \
- _mesa_parse_instruction_suffix(yyextra, \
- yytext + len, \
- & yylval->temp_inst)) { \
- yylval->temp_inst.Opcode = OPCODE_ ## opcode; \
- return token; \
- } else { \
- return handle_ident(yyextra, yytext, yylval); \
- } \
- } while (0)
-
-#define SWIZZLE_INVAL MAKE_SWIZZLE4(SWIZZLE_NIL, SWIZZLE_NIL, \
- SWIZZLE_NIL, SWIZZLE_NIL)
-
-static unsigned
-mask_from_char(char c)
-{
- switch (c) {
- case 'x':
- case 'r':
- return WRITEMASK_X;
- case 'y':
- case 'g':
- return WRITEMASK_Y;
- case 'z':
- case 'b':
- return WRITEMASK_Z;
- case 'w':
- case 'a':
- return WRITEMASK_W;
- }
-
- return 0;
-}
-
-static unsigned
-swiz_from_char(char c)
-{
- switch (c) {
- case 'x':
- case 'r':
- return SWIZZLE_X;
- case 'y':
- case 'g':
- return SWIZZLE_Y;
- case 'z':
- case 'b':
- return SWIZZLE_Z;
- case 'w':
- case 'a':
- return SWIZZLE_W;
- }
-
- return 0;
-}
-
-static int
-handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval)
-{
- lval->string = strdup(text);
-
- return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL)
- ? IDENTIFIER : USED_IDENTIFIER;
-}
-
-#define YY_USER_ACTION \
- do { \
- yylloc->first_column = yylloc->last_column; \
- yylloc->last_column += yyleng; \
- if ((yylloc->first_line == 1) \
- && (yylloc->first_column == 1)) { \
- yylloc->position = 1; \
- } else { \
- yylloc->position += yylloc->last_column - yylloc->first_column; \
- } \
- } 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);
-
-#line 1177 "lex.yy.c"
-
-#define INITIAL 0
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-/* 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 yylex_init (yyscan_t* scanner);
-
-int yylex_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 yylex_destroy (yyscan_t yyscanner );
-
-int yyget_debug (yyscan_t yyscanner );
-
-void yyset_debug (int debug_flag ,yyscan_t yyscanner );
-
-YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner );
-
-void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
-
-FILE *yyget_in (yyscan_t yyscanner );
-
-void yyset_in (FILE * in_str ,yyscan_t yyscanner );
-
-FILE *yyget_out (yyscan_t yyscanner );
-
-void yyset_out (FILE * out_str ,yyscan_t yyscanner );
-
-int yyget_leng (yyscan_t yyscanner );
-
-char *yyget_text (yyscan_t yyscanner );
-
-int yyget_lineno (yyscan_t yyscanner );
-
-void yyset_lineno (int line_number ,yyscan_t yyscanner );
-
-YYSTYPE * yyget_lval (yyscan_t yyscanner );
-
-void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
-
- YYLTYPE *yyget_lloc (yyscan_t yyscanner );
-
- void yyset_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 yywrap (yyscan_t yyscanner );
-#else
-extern int yywrap (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
-
-/* 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 yylex \
- (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
-
-#define YY_DECL int yylex \
- (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 \
- 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 169 "program_lexer.l"
-
-
-#line 1426 "lex.yy.c"
-
- 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 ) {
- yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
-
- yy_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_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 >= 850 )
- 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_base[yy_current_state] != 1300 );
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
- if ( yy_act == 0 )
- { /* have to back up */
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- 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 171 "program_lexer.l"
-{ return ARBvp_10; }
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 172 "program_lexer.l"
-{ return ARBfp_10; }
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 173 "program_lexer.l"
-{
- yylval->integer = at_address;
- return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS);
-}
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 177 "program_lexer.l"
-{ return ALIAS; }
- YY_BREAK
-case 5:
-YY_RULE_SETUP
-#line 178 "program_lexer.l"
-{ return ATTRIB; }
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 179 "program_lexer.l"
-{ return END; }
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 180 "program_lexer.l"
-{ return OPTION; }
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 181 "program_lexer.l"
-{ return OUTPUT; }
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 182 "program_lexer.l"
-{ return PARAM; }
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 183 "program_lexer.l"
-{ yylval->integer = at_temp; return TEMP; }
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 185 "program_lexer.l"
-{ return_opcode( 1, VECTOR_OP, ABS, 3); }
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 186 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, ADD, 3); }
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 187 "program_lexer.l"
-{ return_opcode(require_ARB_vp, ARL, ARL, 3); }
- YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 189 "program_lexer.l"
-{ return_opcode(require_ARB_fp, TRI_OP, CMP, 3); }
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 190 "program_lexer.l"
-{ return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); }
- YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 192 "program_lexer.l"
-{ return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); }
- YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 193 "program_lexer.l"
-{ return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); }
- YY_BREAK
-case 18:
-YY_RULE_SETUP
-#line 194 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, DP3, 3); }
- YY_BREAK
-case 19:
-YY_RULE_SETUP
-#line 195 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, DP4, 3); }
- YY_BREAK
-case 20:
-YY_RULE_SETUP
-#line 196 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, DPH, 3); }
- YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 197 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, DST, 3); }
- YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 199 "program_lexer.l"
-{ return_opcode( 1, SCALAR_OP, EX2, 3); }
- YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 200 "program_lexer.l"
-{ return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); }
- YY_BREAK
-case 24:
-YY_RULE_SETUP
-#line 202 "program_lexer.l"
-{ return_opcode( 1, VECTOR_OP, FLR, 3); }
- YY_BREAK
-case 25:
-YY_RULE_SETUP
-#line 203 "program_lexer.l"
-{ return_opcode( 1, VECTOR_OP, FRC, 3); }
- YY_BREAK
-case 26:
-YY_RULE_SETUP
-#line 205 "program_lexer.l"
-{ return_opcode(require_ARB_fp, KIL, KIL, 3); }
- YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 207 "program_lexer.l"
-{ return_opcode( 1, VECTOR_OP, LIT, 3); }
- YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 208 "program_lexer.l"
-{ return_opcode( 1, SCALAR_OP, LG2, 3); }
- YY_BREAK
-case 29:
-YY_RULE_SETUP
-#line 209 "program_lexer.l"
-{ return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); }
- YY_BREAK
-case 30:
-YY_RULE_SETUP
-#line 210 "program_lexer.l"
-{ return_opcode(require_ARB_fp, TRI_OP, LRP, 3); }
- YY_BREAK
-case 31:
-YY_RULE_SETUP
-#line 212 "program_lexer.l"
-{ return_opcode( 1, TRI_OP, MAD, 3); }
- YY_BREAK
-case 32:
-YY_RULE_SETUP
-#line 213 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, MAX, 3); }
- YY_BREAK
-case 33:
-YY_RULE_SETUP
-#line 214 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, MIN, 3); }
- YY_BREAK
-case 34:
-YY_RULE_SETUP
-#line 215 "program_lexer.l"
-{ return_opcode( 1, VECTOR_OP, MOV, 3); }
- YY_BREAK
-case 35:
-YY_RULE_SETUP
-#line 216 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, MUL, 3); }
- YY_BREAK
-case 36:
-YY_RULE_SETUP
-#line 218 "program_lexer.l"
-{ return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); }
- YY_BREAK
-case 37:
-YY_RULE_SETUP
-#line 219 "program_lexer.l"
-{ return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); }
- YY_BREAK
-case 38:
-YY_RULE_SETUP
-#line 220 "program_lexer.l"
-{ return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); }
- YY_BREAK
-case 39:
-YY_RULE_SETUP
-#line 221 "program_lexer.l"
-{ return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); }
- YY_BREAK
-case 40:
-YY_RULE_SETUP
-#line 222 "program_lexer.l"
-{ return_opcode( 1, BINSC_OP, POW, 3); }
- YY_BREAK
-case 41:
-YY_RULE_SETUP
-#line 224 "program_lexer.l"
-{ return_opcode( 1, SCALAR_OP, RCP, 3); }
- YY_BREAK
-case 42:
-YY_RULE_SETUP
-#line 225 "program_lexer.l"
-{ return_opcode(require_NV_fp, BIN_OP, RFL, 3); }
- YY_BREAK
-case 43:
-YY_RULE_SETUP
-#line 226 "program_lexer.l"
-{ return_opcode( 1, SCALAR_OP, RSQ, 3); }
- YY_BREAK
-case 44:
-YY_RULE_SETUP
-#line 228 "program_lexer.l"
-{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); }
- YY_BREAK
-case 45:
-YY_RULE_SETUP
-#line 229 "program_lexer.l"
-{ return_opcode(require_NV_fp, BIN_OP, SEQ, 3); }
- YY_BREAK
-case 46:
-YY_RULE_SETUP
-#line 230 "program_lexer.l"
-{ return_opcode(require_NV_fp, BIN_OP, SFL, 3); }
- YY_BREAK
-case 47:
-YY_RULE_SETUP
-#line 231 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, SGE, 3); }
- YY_BREAK
-case 48:
-YY_RULE_SETUP
-#line 232 "program_lexer.l"
-{ return_opcode(require_NV_fp, BIN_OP, SGT, 3); }
- YY_BREAK
-case 49:
-YY_RULE_SETUP
-#line 233 "program_lexer.l"
-{ return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); }
- YY_BREAK
-case 50:
-YY_RULE_SETUP
-#line 234 "program_lexer.l"
-{ return_opcode(require_NV_fp, BIN_OP, SLE, 3); }
- YY_BREAK
-case 51:
-YY_RULE_SETUP
-#line 235 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, SLT, 3); }
- YY_BREAK
-case 52:
-YY_RULE_SETUP
-#line 236 "program_lexer.l"
-{ return_opcode(require_NV_fp, BIN_OP, SNE, 3); }
- YY_BREAK
-case 53:
-YY_RULE_SETUP
-#line 237 "program_lexer.l"
-{ return_opcode(require_NV_fp, BIN_OP, STR, 3); }
- YY_BREAK
-case 54:
-YY_RULE_SETUP
-#line 238 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, SUB, 3); }
- YY_BREAK
-case 55:
-YY_RULE_SETUP
-#line 239 "program_lexer.l"
-{ return_opcode( 1, SWZ, SWZ, 3); }
- YY_BREAK
-case 56:
-YY_RULE_SETUP
-#line 241 "program_lexer.l"
-{ return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); }
- YY_BREAK
-case 57:
-YY_RULE_SETUP
-#line 242 "program_lexer.l"
-{ return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); }
- YY_BREAK
-case 58:
-YY_RULE_SETUP
-#line 243 "program_lexer.l"
-{ return_opcode(require_NV_fp, TXD_OP, TXD, 3); }
- YY_BREAK
-case 59:
-YY_RULE_SETUP
-#line 244 "program_lexer.l"
-{ return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); }
- YY_BREAK
-case 60:
-YY_RULE_SETUP
-#line 246 "program_lexer.l"
-{ return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); }
- YY_BREAK
-case 61:
-YY_RULE_SETUP
-#line 247 "program_lexer.l"
-{ return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); }
- YY_BREAK
-case 62:
-YY_RULE_SETUP
-#line 248 "program_lexer.l"
-{ return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); }
- YY_BREAK
-case 63:
-YY_RULE_SETUP
-#line 249 "program_lexer.l"
-{ return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); }
- YY_BREAK
-case 64:
-YY_RULE_SETUP
-#line 251 "program_lexer.l"
-{ return_opcode(require_NV_fp, TRI_OP, X2D, 3); }
- YY_BREAK
-case 65:
-YY_RULE_SETUP
-#line 252 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, XPD, 3); }
- YY_BREAK
-case 66:
-YY_RULE_SETUP
-#line 254 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); }
- YY_BREAK
-case 67:
-YY_RULE_SETUP
-#line 255 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); }
- YY_BREAK
-case 68:
-YY_RULE_SETUP
-#line 256 "program_lexer.l"
-{ return PROGRAM; }
- YY_BREAK
-case 69:
-YY_RULE_SETUP
-#line 257 "program_lexer.l"
-{ return STATE; }
- YY_BREAK
-case 70:
-YY_RULE_SETUP
-#line 258 "program_lexer.l"
-{ return RESULT; }
- YY_BREAK
-case 71:
-YY_RULE_SETUP
-#line 260 "program_lexer.l"
-{ return AMBIENT; }
- YY_BREAK
-case 72:
-YY_RULE_SETUP
-#line 261 "program_lexer.l"
-{ return ATTENUATION; }
- YY_BREAK
-case 73:
-YY_RULE_SETUP
-#line 262 "program_lexer.l"
-{ return BACK; }
- YY_BREAK
-case 74:
-YY_RULE_SETUP
-#line 263 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, CLIP); }
- YY_BREAK
-case 75:
-YY_RULE_SETUP
-#line 264 "program_lexer.l"
-{ return COLOR; }
- YY_BREAK
-case 76:
-YY_RULE_SETUP
-#line 265 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_fp, DEPTH); }
- YY_BREAK
-case 77:
-YY_RULE_SETUP
-#line 266 "program_lexer.l"
-{ return DIFFUSE; }
- YY_BREAK
-case 78:
-YY_RULE_SETUP
-#line 267 "program_lexer.l"
-{ return DIRECTION; }
- YY_BREAK
-case 79:
-YY_RULE_SETUP
-#line 268 "program_lexer.l"
-{ return EMISSION; }
- YY_BREAK
-case 80:
-YY_RULE_SETUP
-#line 269 "program_lexer.l"
-{ return ENV; }
- YY_BREAK
-case 81:
-YY_RULE_SETUP
-#line 270 "program_lexer.l"
-{ return EYE; }
- YY_BREAK
-case 82:
-YY_RULE_SETUP
-#line 271 "program_lexer.l"
-{ return FOGCOORD; }
- YY_BREAK
-case 83:
-YY_RULE_SETUP
-#line 272 "program_lexer.l"
-{ return FOG; }
- YY_BREAK
-case 84:
-YY_RULE_SETUP
-#line 273 "program_lexer.l"
-{ return FRONT; }
- YY_BREAK
-case 85:
-YY_RULE_SETUP
-#line 274 "program_lexer.l"
-{ return HALF; }
- YY_BREAK
-case 86:
-YY_RULE_SETUP
-#line 275 "program_lexer.l"
-{ return INVERSE; }
- YY_BREAK
-case 87:
-YY_RULE_SETUP
-#line 276 "program_lexer.l"
-{ return INVTRANS; }
- YY_BREAK
-case 88:
-YY_RULE_SETUP
-#line 277 "program_lexer.l"
-{ return LIGHT; }
- YY_BREAK
-case 89:
-YY_RULE_SETUP
-#line 278 "program_lexer.l"
-{ return LIGHTMODEL; }
- YY_BREAK
-case 90:
-YY_RULE_SETUP
-#line 279 "program_lexer.l"
-{ return LIGHTPROD; }
- YY_BREAK
-case 91:
-YY_RULE_SETUP
-#line 280 "program_lexer.l"
-{ return LOCAL; }
- YY_BREAK
-case 92:
-YY_RULE_SETUP
-#line 281 "program_lexer.l"
-{ return MATERIAL; }
- YY_BREAK
-case 93:
-YY_RULE_SETUP
-#line 282 "program_lexer.l"
-{ return MAT_PROGRAM; }
- YY_BREAK
-case 94:
-YY_RULE_SETUP
-#line 283 "program_lexer.l"
-{ return MATRIX; }
- YY_BREAK
-case 95:
-YY_RULE_SETUP
-#line 284 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, MATRIXINDEX); }
- YY_BREAK
-case 96:
-YY_RULE_SETUP
-#line 285 "program_lexer.l"
-{ return MODELVIEW; }
- YY_BREAK
-case 97:
-YY_RULE_SETUP
-#line 286 "program_lexer.l"
-{ return MVP; }
- YY_BREAK
-case 98:
-YY_RULE_SETUP
-#line 287 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, NORMAL); }
- YY_BREAK
-case 99:
-YY_RULE_SETUP
-#line 288 "program_lexer.l"
-{ return OBJECT; }
- YY_BREAK
-case 100:
-YY_RULE_SETUP
-#line 289 "program_lexer.l"
-{ return PALETTE; }
- YY_BREAK
-case 101:
-YY_RULE_SETUP
-#line 290 "program_lexer.l"
-{ return PARAMS; }
- YY_BREAK
-case 102:
-YY_RULE_SETUP
-#line 291 "program_lexer.l"
-{ return PLANE; }
- YY_BREAK
-case 103:
-YY_RULE_SETUP
-#line 292 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, POINT_TOK); }
- YY_BREAK
-case 104:
-YY_RULE_SETUP
-#line 293 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, POINTSIZE); }
- YY_BREAK
-case 105:
-YY_RULE_SETUP
-#line 294 "program_lexer.l"
-{ return POSITION; }
- YY_BREAK
-case 106:
-YY_RULE_SETUP
-#line 295 "program_lexer.l"
-{ return PRIMARY; }
- YY_BREAK
-case 107:
-YY_RULE_SETUP
-#line 296 "program_lexer.l"
-{ return PROJECTION; }
- YY_BREAK
-case 108:
-YY_RULE_SETUP
-#line 297 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_fp, RANGE); }
- YY_BREAK
-case 109:
-YY_RULE_SETUP
-#line 298 "program_lexer.l"
-{ return ROW; }
- YY_BREAK
-case 110:
-YY_RULE_SETUP
-#line 299 "program_lexer.l"
-{ return SCENECOLOR; }
- YY_BREAK
-case 111:
-YY_RULE_SETUP
-#line 300 "program_lexer.l"
-{ return SECONDARY; }
- YY_BREAK
-case 112:
-YY_RULE_SETUP
-#line 301 "program_lexer.l"
-{ return SHININESS; }
- YY_BREAK
-case 113:
-YY_RULE_SETUP
-#line 302 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, SIZE_TOK); }
- YY_BREAK
-case 114:
-YY_RULE_SETUP
-#line 303 "program_lexer.l"
-{ return SPECULAR; }
- YY_BREAK
-case 115:
-YY_RULE_SETUP
-#line 304 "program_lexer.l"
-{ return SPOT; }
- YY_BREAK
-case 116:
-YY_RULE_SETUP
-#line 305 "program_lexer.l"
-{ return TEXCOORD; }
- YY_BREAK
-case 117:
-YY_RULE_SETUP
-#line 306 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_fp, TEXENV); }
- YY_BREAK
-case 118:
-YY_RULE_SETUP
-#line 307 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, TEXGEN); }
- YY_BREAK
-case 119:
-YY_RULE_SETUP
-#line 308 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, TEXGEN_Q); }
- YY_BREAK
-case 120:
-YY_RULE_SETUP
-#line 309 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, TEXGEN_S); }
- YY_BREAK
-case 121:
-YY_RULE_SETUP
-#line 310 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, TEXGEN_T); }
- YY_BREAK
-case 122:
-YY_RULE_SETUP
-#line 311 "program_lexer.l"
-{ return TEXTURE; }
- YY_BREAK
-case 123:
-YY_RULE_SETUP
-#line 312 "program_lexer.l"
-{ return TRANSPOSE; }
- YY_BREAK
-case 124:
-YY_RULE_SETUP
-#line 313 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, VTXATTRIB); }
- YY_BREAK
-case 125:
-YY_RULE_SETUP
-#line 314 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, WEIGHT); }
- YY_BREAK
-case 126:
-YY_RULE_SETUP
-#line 316 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); }
- YY_BREAK
-case 127:
-YY_RULE_SETUP
-#line 317 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); }
- YY_BREAK
-case 128:
-YY_RULE_SETUP
-#line 318 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); }
- YY_BREAK
-case 129:
-YY_RULE_SETUP
-#line 319 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); }
- YY_BREAK
-case 130:
-YY_RULE_SETUP
-#line 320 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); }
- YY_BREAK
-case 131:
-YY_RULE_SETUP
-#line 321 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); }
- YY_BREAK
-case 132:
-YY_RULE_SETUP
-#line 322 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); }
- YY_BREAK
-case 133:
-YY_RULE_SETUP
-#line 323 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); }
- YY_BREAK
-case 134:
-YY_RULE_SETUP
-#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 325 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); }
- YY_BREAK
-case 136:
-YY_RULE_SETUP
-#line 326 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); }
- YY_BREAK
-case 137:
-YY_RULE_SETUP
-#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 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 330 "program_lexer.l"
-{ return handle_ident(yyextra, yytext, yylval); }
- YY_BREAK
-case 140:
-YY_RULE_SETUP
-#line 332 "program_lexer.l"
-{ return DOT_DOT; }
- YY_BREAK
-case 141:
-YY_RULE_SETUP
-#line 334 "program_lexer.l"
-{
- yylval->integer = strtol(yytext, NULL, 10);
- return INTEGER;
-}
- YY_BREAK
-case 142:
-YY_RULE_SETUP
-#line 338 "program_lexer.l"
-{
- yylval->real = _mesa_strtof(yytext, NULL);
- return REAL;
-}
- YY_BREAK
-case 143:
-/* rule 143 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 342 "program_lexer.l"
-{
- yylval->real = _mesa_strtof(yytext, NULL);
- return REAL;
-}
- YY_BREAK
-case 144:
-YY_RULE_SETUP
-#line 346 "program_lexer.l"
-{
- yylval->real = _mesa_strtof(yytext, NULL);
- return REAL;
-}
- YY_BREAK
-case 145:
-YY_RULE_SETUP
-#line 350 "program_lexer.l"
-{
- yylval->real = _mesa_strtof(yytext, NULL);
- return REAL;
-}
- YY_BREAK
-case 146:
-YY_RULE_SETUP
-#line 355 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_NOOP;
- yylval->swiz_mask.mask = WRITEMASK_XYZW;
- return MASK4;
-}
- YY_BREAK
-case 147:
-YY_RULE_SETUP
-#line 361 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_XY
- | mask_from_char(yytext[3]);
- return MASK3;
-}
- YY_BREAK
-case 148:
-YY_RULE_SETUP
-#line 367 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_XZW;
- return MASK3;
-}
- YY_BREAK
-case 149:
-YY_RULE_SETUP
-#line 372 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_YZW;
- return MASK3;
-}
- YY_BREAK
-case 150:
-YY_RULE_SETUP
-#line 378 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_X
- | mask_from_char(yytext[2]);
- return MASK2;
-}
- YY_BREAK
-case 151:
-YY_RULE_SETUP
-#line 384 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_Y
- | mask_from_char(yytext[2]);
- return MASK2;
-}
- YY_BREAK
-case 152:
-YY_RULE_SETUP
-#line 390 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_ZW;
- return MASK2;
-}
- YY_BREAK
-case 153:
-YY_RULE_SETUP
-#line 396 "program_lexer.l"
-{
- const unsigned s = swiz_from_char(yytext[1]);
- yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s);
- yylval->swiz_mask.mask = mask_from_char(yytext[1]);
- return MASK1;
-}
- YY_BREAK
-case 154:
-YY_RULE_SETUP
-#line 403 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]),
- swiz_from_char(yytext[2]),
- swiz_from_char(yytext[3]),
- swiz_from_char(yytext[4]));
- yylval->swiz_mask.mask = 0;
- return SWIZZLE;
-}
- YY_BREAK
-case 155:
-YY_RULE_SETUP
-#line 412 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_NOOP;
- yylval->swiz_mask.mask = WRITEMASK_XYZW;
- return_token_or_DOT(require_ARB_fp, MASK4);
-}
- YY_BREAK
-case 156:
-YY_RULE_SETUP
-#line 418 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_XY
- | mask_from_char(yytext[3]);
- return_token_or_DOT(require_ARB_fp, MASK3);
-}
- YY_BREAK
-case 157:
-YY_RULE_SETUP
-#line 424 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_XZW;
- return_token_or_DOT(require_ARB_fp, MASK3);
-}
- YY_BREAK
-case 158:
-YY_RULE_SETUP
-#line 429 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_YZW;
- return_token_or_DOT(require_ARB_fp, MASK3);
-}
- YY_BREAK
-case 159:
-YY_RULE_SETUP
-#line 435 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_X
- | mask_from_char(yytext[2]);
- return_token_or_DOT(require_ARB_fp, MASK2);
-}
- YY_BREAK
-case 160:
-YY_RULE_SETUP
-#line 441 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_Y
- | mask_from_char(yytext[2]);
- return_token_or_DOT(require_ARB_fp, MASK2);
-}
- YY_BREAK
-case 161:
-YY_RULE_SETUP
-#line 447 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_ZW;
- return_token_or_DOT(require_ARB_fp, MASK2);
-}
- YY_BREAK
-case 162:
-YY_RULE_SETUP
-#line 453 "program_lexer.l"
-{
- const unsigned s = swiz_from_char(yytext[1]);
- yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s);
- yylval->swiz_mask.mask = mask_from_char(yytext[1]);
- return_token_or_DOT(require_ARB_fp, MASK1);
-}
- YY_BREAK
-case 163:
-YY_RULE_SETUP
-#line 461 "program_lexer.l"
-{
- if (require_ARB_vp) {
- return TEXGEN_R;
- } else {
- yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X,
- SWIZZLE_X, SWIZZLE_X);
- yylval->swiz_mask.mask = WRITEMASK_X;
- return MASK1;
- }
-}
- YY_BREAK
-case 164:
-YY_RULE_SETUP
-#line 472 "program_lexer.l"
-{
- yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]),
- swiz_from_char(yytext[2]),
- swiz_from_char(yytext[3]),
- swiz_from_char(yytext[4]));
- yylval->swiz_mask.mask = 0;
- return_token_or_DOT(require_ARB_fp, SWIZZLE);
-}
- YY_BREAK
-case 165:
-YY_RULE_SETUP
-#line 481 "program_lexer.l"
-{ return DOT; }
- YY_BREAK
-case 166:
-/* rule 166 can match eol */
-YY_RULE_SETUP
-#line 483 "program_lexer.l"
-{
- yylloc->first_line++;
- yylloc->first_column = 1;
- yylloc->last_line++;
- yylloc->last_column = 1;
- yylloc->position++;
-}
- YY_BREAK
-case 167:
-YY_RULE_SETUP
-#line 490 "program_lexer.l"
-/* eat whitespace */ ;
- YY_BREAK
-case 168:
-*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 491 "program_lexer.l"
-/* eat comments */ ;
- YY_BREAK
-case 169:
-YY_RULE_SETUP
-#line 492 "program_lexer.l"
-{ return yytext[0]; }
- YY_BREAK
-case 170:
-YY_RULE_SETUP
-#line 493 "program_lexer.l"
-ECHO;
- YY_BREAK
-#line 2490 "lex.yy.c"
-case YY_STATE_EOF(INITIAL):
- 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
- * yylex(). 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 ( yywrap(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 yylex */
-
-/* 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. */
- yyrealloc((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;
- yyrestart(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 *) yyrealloc((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;
-
- 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 >= 850 )
- 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 >= 850 )
- 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 == 849);
-
- 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. */
- yyrestart(yyin ,yyscanner);
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap(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;
-
- 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 yyrestart (FILE * input_file , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! YY_CURRENT_BUFFER ){
- yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
-
- yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
- yy_load_buffer_state(yyscanner );
-}
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * @param yyscanner The scanner object.
- */
- void yy_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
- * yypop_buffer_state();
- * yypush_buffer_state(new_buffer);
- */
- yyensure_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;
- yy_load_buffer_state(yyscanner );
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-static void yy_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 yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_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 *) yyalloc(b->yy_buf_size + 2 ,yyscanner );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer(b,file ,yyscanner);
-
- return b;
-}
-
-/** Destroy the buffer.
- * @param b a buffer created with yy_create_buffer()
- * @param yyscanner The scanner object.
- */
- void yy_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 )
- yyfree((void *) b->yy_ch_buf ,yyscanner );
-
- yyfree((void *) b ,yyscanner );
-}
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a yyrestart() or at EOF.
- */
- static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
-
-{
- int oerrno = errno;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yy_flush_buffer(b ,yyscanner);
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
- /* If b is the current buffer, then yy_init_buffer was _probably_
- * called from yyrestart() 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 yy_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 )
- yy_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 yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (new_buffer == NULL)
- return;
-
- yyensure_buffer_stack(yyscanner);
-
- /* This block is copied from yy_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 yy_switch_to_buffer. */
- yy_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 yypop_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (!YY_CURRENT_BUFFER)
- return;
-
- yy_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) {
- yy_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 yyensure_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**)yyalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_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**)yyrealloc
- (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 yyensure_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 yy_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) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_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;
-
- yy_switch_to_buffer(b ,yyscanner );
-
- return b;
-}
-
-/** Setup the input buffer state to scan a string. The next call to yylex() 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
- * yy_scan_bytes() instead.
- */
-YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
-{
-
- return yy_scan_bytes(yystr,strlen(yystr) ,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 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 yy_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 *) yyalloc(n ,yyscanner );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_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 = yy_scan_buffer(buf,n ,yyscanner);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_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 yyget_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 yyget_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 yyget_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 *yyget_in (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyin;
-}
-
-/** Get the output stream.
- * @param yyscanner The scanner object.
- */
-FILE *yyget_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 yyget_leng (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyleng;
-}
-
-/** Get the current token.
- * @param yyscanner The scanner object.
- */
-
-char *yyget_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 yyset_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 yyset_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( "yyset_lineno called with no buffer" , yyscanner);
-
- yylineno = line_number;
-}
-
-/** Set the current column.
- * @param line_number
- * @param yyscanner The scanner object.
- */
-void yyset_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( "yyset_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 yy_switch_to_buffer
- */
-void yyset_in (FILE * in_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = in_str ;
-}
-
-void yyset_out (FILE * out_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = out_str ;
-}
-
-int yyget_debug (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yy_flex_debug;
-}
-
-void yyset_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 * yyget_lval (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylval;
-}
-
-void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylval = yylval_param;
-}
-
-YYLTYPE *yyget_lloc (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylloc;
-}
-
-void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylloc = yylloc_param;
-}
-
-/* User-visible API */
-
-/* yylex_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 yylex_init(yyscan_t* ptr_yy_globals)
-
-{
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) yyalloc ( 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 );
-}
-
-/* yylex_init_extra has the same functionality as yylex_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 yyalloc in
- * the yyextra field.
- */
-
-int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
-
-{
- struct yyguts_t dummy_yyguts;
-
- yyset_extra (yy_user_defined, &dummy_yyguts);
-
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) yyalloc ( 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));
-
- yyset_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 yylex_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
- * yylex_init()
- */
- return 0;
-}
-
-/* yylex_destroy is for both reentrant and non-reentrant scanners. */
-int yylex_destroy (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- yypop_buffer_state(yyscanner);
- }
-
- /* Destroy the stack itself. */
- yyfree(yyg->yy_buffer_stack ,yyscanner);
- yyg->yy_buffer_stack = NULL;
-
- /* Destroy the start condition stack. */
- yyfree(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
- * yylex() is called, initialization will occur. */
- yy_init_globals( yyscanner);
-
- /* Destroy the main struct (reentrant only). */
- yyfree ( 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 *yyalloc (yy_size_t size , yyscan_t yyscanner)
-{
- return (void *) malloc( size );
-}
-
-void *yyrealloc (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 yyfree (void * ptr , yyscan_t yyscanner)
-{
- free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
-
-#line 493 "program_lexer.l"
-
-
-
-void
-_mesa_program_lexer_ctor(void **scanner, struct asm_parser_state *state,
- const char *string, size_t len)
-{
- yylex_init_extra(state,scanner);
- yy_scan_bytes(string,len,*scanner);
-}
-
-void
-_mesa_program_lexer_dtor(void *scanner)
-{
- yylex_destroy(scanner);
-}
-
diff --git a/src/mesa/program/nvfragparse.c b/src/mesa/program/nvfragparse.c
deleted file mode 100644
index 8516b5f..0000000
--- a/src/mesa/program/nvfragparse.c
+++ /dev/null
@@ -1,1588 +0,0 @@
-/*
- * 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 nvfragparse.c
- * NVIDIA fragment program parser.
- * \author Brian Paul
- */
-
-/*
- * Regarding GL_NV_fragment_program:
- *
- * Portions of this software may use or implement intellectual
- * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims
- * any and all warranties with respect to such intellectual property,
- * including any use thereof or modifications thereto.
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/imports.h"
-#include "main/macros.h"
-#include "program.h"
-#include "prog_parameter.h"
-#include "prog_print.h"
-#include "prog_instruction.h"
-#include "nvfragparse.h"
-
-
-#define INPUT_1V 1
-#define INPUT_2V 2
-#define INPUT_3V 3
-#define INPUT_1S 4
-#define INPUT_2S 5
-#define INPUT_CC 6
-#define INPUT_1V_T 7 /* one source vector, plus textureId */
-#define INPUT_3V_T 8 /* one source vector, plus textureId */
-#define INPUT_NONE 9
-#define INPUT_1V_S 10 /* a string and a vector register */
-#define OUTPUT_V 20
-#define OUTPUT_S 21
-#define OUTPUT_NONE 22
-
-/* IRIX defines some of these */
-#undef _R
-#undef _H
-#undef _X
-#undef _C
-#undef _S
-
-/* Optional suffixes */
-#define _R FLOAT32 /* float */
-#define _H FLOAT16 /* half-float */
-#define _X FIXED12 /* fixed */
-#define _C 0x08 /* set cond codes */
-#define _S 0x10 /* saturate, clamp result to [0,1] */
-
-struct instruction_pattern {
- const char *name;
- enum prog_opcode opcode;
- GLuint inputs;
- GLuint outputs;
- GLuint suffixes;
-};
-
-static const struct instruction_pattern Instructions[] = {
- { "ADD", OPCODE_ADD, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "COS", OPCODE_COS, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "DDX", OPCODE_DDX, INPUT_1V, OUTPUT_V, _R | _H | _C | _S },
- { "DDY", OPCODE_DDY, INPUT_1V, OUTPUT_V, _R | _H | _C | _S },
- { "DP3", OPCODE_DP3, INPUT_2V, OUTPUT_S, _R | _H | _X | _C | _S },
- { "DP4", OPCODE_DP4, INPUT_2V, OUTPUT_S, _R | _H | _X | _C | _S },
- { "DST", OPCODE_DP4, INPUT_2V, OUTPUT_V, _R | _H | _C | _S },
- { "EX2", OPCODE_DP4, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "FLR", OPCODE_FLR, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "FRC", OPCODE_FRC, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "KIL", OPCODE_KIL_NV, INPUT_CC, OUTPUT_NONE, 0 },
- { "LG2", OPCODE_LG2, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "LIT", OPCODE_LIT, INPUT_1V, OUTPUT_V, _R | _H | _C | _S },
- { "LRP", OPCODE_LRP, INPUT_3V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "MAD", OPCODE_MAD, INPUT_3V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "MAX", OPCODE_MAX, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "MIN", OPCODE_MIN, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "MOV", OPCODE_MOV, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "MUL", OPCODE_MUL, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "PK2H", OPCODE_PK2H, INPUT_1V, OUTPUT_S, 0 },
- { "PK2US", OPCODE_PK2US, INPUT_1V, OUTPUT_S, 0 },
- { "PK4B", OPCODE_PK4B, INPUT_1V, OUTPUT_S, 0 },
- { "PK4UB", OPCODE_PK4UB, INPUT_1V, OUTPUT_S, 0 },
- { "POW", OPCODE_POW, INPUT_2S, OUTPUT_S, _R | _H | _C | _S },
- { "RCP", OPCODE_RCP, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "RFL", OPCODE_RFL, INPUT_2V, OUTPUT_V, _R | _H | _C | _S },
- { "RSQ", OPCODE_RSQ, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "SEQ", OPCODE_SEQ, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SFL", OPCODE_SFL, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SGE", OPCODE_SGE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SGT", OPCODE_SGT, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SIN", OPCODE_SIN, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "SLE", OPCODE_SLE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SLT", OPCODE_SLT, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SNE", OPCODE_SNE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "STR", OPCODE_STR, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SUB", OPCODE_SUB, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "TEX", OPCODE_TEX, INPUT_1V_T, OUTPUT_V, _C | _S },
- { "TXD", OPCODE_TXD, INPUT_3V_T, OUTPUT_V, _C | _S },
- { "TXP", OPCODE_TXP_NV, INPUT_1V_T, OUTPUT_V, _C | _S },
- { "UP2H", OPCODE_UP2H, INPUT_1S, OUTPUT_V, _C | _S },
- { "UP2US", OPCODE_UP2US, INPUT_1S, OUTPUT_V, _C | _S },
- { "UP4B", OPCODE_UP4B, INPUT_1S, OUTPUT_V, _C | _S },
- { "UP4UB", OPCODE_UP4UB, INPUT_1S, OUTPUT_V, _C | _S },
- { "X2D", OPCODE_X2D, INPUT_3V, OUTPUT_V, _R | _H | _C | _S },
- { "PRINT", OPCODE_PRINT, INPUT_1V_S, OUTPUT_NONE, 0 },
- { NULL, (enum prog_opcode) -1, 0, 0, 0 }
-};
-
-
-/*
- * Information needed or computed during parsing.
- * Remember, we can't modify the target program object until we've
- * _successfully_ parsed the program text.
- */
-struct parse_state {
- struct gl_context *ctx;
- const GLubyte *start; /* start of program string */
- const GLubyte *pos; /* current position */
- const GLubyte *curLine;
- struct gl_fragment_program *program; /* current program */
-
- struct gl_program_parameter_list *parameters;
-
- GLuint numInst; /* number of instructions parsed */
- GLuint inputsRead; /* bitmask of input registers used */
- GLuint outputsWritten; /* bitmask of 1 << FRAG_OUTPUT_* bits */
- GLuint texturesUsed[MAX_TEXTURE_IMAGE_UNITS];
-};
-
-
-
-/*
- * Called whenever we find an error during parsing.
- */
-static void
-record_error(struct parse_state *parseState, const char *msg, int lineNo)
-{
-#ifdef DEBUG
- GLint line, column;
- const GLubyte *lineStr;
- lineStr = _mesa_find_line_column(parseState->start,
- parseState->pos, &line, &column);
- _mesa_debug(parseState->ctx,
- "nvfragparse.c(%d): line %d, column %d:%s (%s)\n",
- lineNo, line, column, (char *) lineStr, msg);
- free((void *) lineStr);
-#else
- (void) lineNo;
-#endif
-
- /* Check that no error was already recorded. Only record the first one. */
- if (parseState->ctx->Program.ErrorString[0] == 0) {
- _mesa_set_program_error(parseState->ctx,
- parseState->pos - parseState->start,
- msg);
- }
-}
-
-
-#define RETURN_ERROR \
-do { \
- record_error(parseState, "Unexpected end of input.", __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-#define RETURN_ERROR1(msg) \
-do { \
- record_error(parseState, msg, __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-#define RETURN_ERROR2(msg1, msg2) \
-do { \
- char err[1000]; \
- sprintf(err, "%s %s", msg1, msg2); \
- record_error(parseState, err, __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-
-
-
-/*
- * Search a list of instruction structures for a match.
- */
-static struct instruction_pattern
-MatchInstruction(const GLubyte *token)
-{
- const struct instruction_pattern *inst;
- struct instruction_pattern result;
-
- result.name = NULL;
- result.opcode = MAX_OPCODE; /* i.e. invalid instruction */
- result.inputs = 0;
- result.outputs = 0;
- result.suffixes = 0;
-
- for (inst = Instructions; inst->name; inst++) {
- if (strncmp((const char *) token, inst->name, 3) == 0) {
- /* matched! */
- int i = 3;
- result = *inst;
- result.suffixes = 0;
- /* look at suffix */
- if (token[i] == 'R') {
- result.suffixes |= _R;
- i++;
- }
- else if (token[i] == 'H') {
- result.suffixes |= _H;
- i++;
- }
- else if (token[i] == 'X') {
- result.suffixes |= _X;
- i++;
- }
- if (token[i] == 'C') {
- result.suffixes |= _C;
- i++;
- }
- if (token[i] == '_' && token[i+1] == 'S' &&
- token[i+2] == 'A' && token[i+3] == 'T') {
- result.suffixes |= _S;
- }
- return result;
- }
- }
-
- return result;
-}
-
-
-
-
-/**********************************************************************/
-
-
-static GLboolean IsLetter(GLubyte b)
-{
- return (b >= 'a' && b <= 'z') ||
- (b >= 'A' && b <= 'Z') ||
- (b == '_') ||
- (b == '$');
-}
-
-
-static GLboolean IsDigit(GLubyte b)
-{
- return b >= '0' && b <= '9';
-}
-
-
-static GLboolean IsWhitespace(GLubyte b)
-{
- return b == ' ' || b == '\t' || b == '\n' || b == '\r';
-}
-
-
-/**
- * Starting at 'str' find the next token. A token can be an integer,
- * an identifier or punctuation symbol.
- * \return <= 0 we found an error, else, return number of characters parsed.
- */
-static GLint
-GetToken(struct parse_state *parseState, GLubyte *token)
-{
- const GLubyte *str = parseState->pos;
- GLint i = 0, j = 0;
-
- token[0] = 0;
-
- /* skip whitespace and comments */
- while (str[i] && (IsWhitespace(str[i]) || str[i] == '#')) {
- if (str[i] == '#') {
- /* skip comment */
- while (str[i] && (str[i] != '\n' && str[i] != '\r')) {
- i++;
- }
- if (str[i] == '\n' || str[i] == '\r')
- parseState->curLine = str + i + 1;
- }
- else {
- /* skip whitespace */
- if (str[i] == '\n' || str[i] == '\r')
- parseState->curLine = str + i + 1;
- i++;
- }
- }
-
- if (str[i] == 0)
- return -i;
-
- /* try matching an integer */
- while (str[i] && IsDigit(str[i])) {
- token[j++] = str[i++];
- }
- if (j > 0 || !str[i]) {
- token[j] = 0;
- return i;
- }
-
- /* try matching an identifier */
- if (IsLetter(str[i])) {
- while (str[i] && (IsLetter(str[i]) || IsDigit(str[i]))) {
- token[j++] = str[i++];
- }
- token[j] = 0;
- return i;
- }
-
- /* punctuation character */
- if (str[i]) {
- token[0] = str[i++];
- token[1] = 0;
- return i;
- }
-
- /* end of input */
- token[0] = 0;
- return i;
-}
-
-
-/**
- * Get next token from input stream and increment stream pointer past token.
- */
-static GLboolean
-Parse_Token(struct parse_state *parseState, GLubyte *token)
-{
- GLint i;
- i = GetToken(parseState, token);
- if (i <= 0) {
- parseState->pos += (-i);
- return GL_FALSE;
- }
- parseState->pos += i;
- return GL_TRUE;
-}
-
-
-/**
- * Get next token from input stream but don't increment stream pointer.
- */
-static GLboolean
-Peek_Token(struct parse_state *parseState, GLubyte *token)
-{
- GLint i, len;
- i = GetToken(parseState, token);
- if (i <= 0) {
- parseState->pos += (-i);
- return GL_FALSE;
- }
- len = (GLint) strlen((const char *) token);
- parseState->pos += (i - len);
- return GL_TRUE;
-}
-
-
-/**********************************************************************/
-
-static const char *InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS + 1] = {
- "WPOS", "COL0", "COL1", "FOGC",
- "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL
-};
-
-
-
-/**********************************************************************/
-
-/**
- * Try to match 'pattern' as the next token after any whitespace/comments.
- */
-static GLboolean
-Parse_String(struct parse_state *parseState, const char *pattern)
-{
- const GLubyte *m;
- GLint i;
-
- /* skip whitespace and comments */
- while (IsWhitespace(*parseState->pos) || *parseState->pos == '#') {
- if (*parseState->pos == '#') {
- while (*parseState->pos && (*parseState->pos != '\n' && *parseState->pos != '\r')) {
- parseState->pos += 1;
- }
- if (*parseState->pos == '\n' || *parseState->pos == '\r')
- parseState->curLine = parseState->pos + 1;
- }
- else {
- /* skip whitespace */
- if (*parseState->pos == '\n' || *parseState->pos == '\r')
- parseState->curLine = parseState->pos + 1;
- parseState->pos += 1;
- }
- }
-
- /* Try to match the pattern */
- m = parseState->pos;
- for (i = 0; pattern[i]; i++) {
- if (*m != (GLubyte) pattern[i])
- return GL_FALSE;
- m += 1;
- }
- parseState->pos = m;
-
- return GL_TRUE; /* success */
-}
-
-
-static GLboolean
-Parse_Identifier(struct parse_state *parseState, GLubyte *ident)
-{
- if (!Parse_Token(parseState, ident))
- RETURN_ERROR;
- if (IsLetter(ident[0]))
- return GL_TRUE;
- else
- RETURN_ERROR1("Expected an identfier");
-}
-
-
-/**
- * Parse a floating point constant, or a defined symbol name.
- * [+/-]N[.N[eN]]
- * Output: number[0 .. 3] will get the value.
- */
-static GLboolean
-Parse_ScalarConstant(struct parse_state *parseState, GLfloat *number)
-{
- char *end = NULL;
-
- *number = (GLfloat) _mesa_strtof((const char *) parseState->pos, &end);
-
- if (end && end > (char *) parseState->pos) {
- /* got a number */
- parseState->pos = (GLubyte *) end;
- number[1] = *number;
- number[2] = *number;
- number[3] = *number;
- return GL_TRUE;
- }
- else {
- /* should be an identifier */
- GLubyte ident[100];
- const GLfloat *constant;
- if (!Parse_Identifier(parseState, ident))
- RETURN_ERROR1("Expected an identifier");
- constant = _mesa_lookup_parameter_value(parseState->parameters,
- -1, (const char *) ident);
- /* XXX Check that it's a constant and not a parameter */
- if (!constant) {
- RETURN_ERROR1("Undefined symbol");
- }
- else {
- COPY_4V(number, constant);
- return GL_TRUE;
- }
- }
-}
-
-
-
-/**
- * Parse a vector constant, one of:
- * { float }
- * { float, float }
- * { float, float, float }
- * { float, float, float, float }
- */
-static GLboolean
-Parse_VectorConstant(struct parse_state *parseState, GLfloat *vec)
-{
- /* "{" was already consumed */
-
- ASSIGN_4V(vec, 0.0, 0.0, 0.0, 1.0);
-
- if (!Parse_ScalarConstant(parseState, vec+0)) /* X */
- return GL_FALSE;
-
- if (Parse_String(parseState, "}")) {
- return GL_TRUE;
- }
-
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected comma in vector constant");
-
- if (!Parse_ScalarConstant(parseState, vec+1)) /* Y */
- return GL_FALSE;
-
- if (Parse_String(parseState, "}")) {
- return GL_TRUE;
- }
-
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected comma in vector constant");
-
- if (!Parse_ScalarConstant(parseState, vec+2)) /* Z */
- return GL_FALSE;
-
- if (Parse_String(parseState, "}")) {
- return GL_TRUE;
- }
-
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected comma in vector constant");
-
- if (!Parse_ScalarConstant(parseState, vec+3)) /* W */
- return GL_FALSE;
-
- if (!Parse_String(parseState, "}"))
- RETURN_ERROR1("Expected closing brace in vector constant");
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse <number>, <varname> or {a, b, c, d}.
- * Return number of values in the vector or scalar, or zero if parse error.
- */
-static GLuint
-Parse_VectorOrScalarConstant(struct parse_state *parseState, GLfloat *vec)
-{
- if (Parse_String(parseState, "{")) {
- return Parse_VectorConstant(parseState, vec);
- }
- else {
- GLboolean b = Parse_ScalarConstant(parseState, vec);
- if (b) {
- vec[1] = vec[2] = vec[3] = vec[0];
- }
- return b;
- }
-}
-
-
-/**
- * Parse a texture image source:
- * [TEX0 | TEX1 | .. | TEX15] , [1D | 2D | 3D | CUBE | RECT]
- */
-static GLboolean
-Parse_TextureImageId(struct parse_state *parseState,
- GLubyte *texUnit, GLubyte *texTargetBit)
-{
- GLubyte imageSrc[100];
- GLint unit;
-
- if (!Parse_Token(parseState, imageSrc))
- RETURN_ERROR;
-
- if (imageSrc[0] != 'T' ||
- imageSrc[1] != 'E' ||
- imageSrc[2] != 'X') {
- RETURN_ERROR1("Expected TEX# source");
- }
- unit = atoi((const char *) imageSrc + 3);
- if ((unit < 0 || unit > MAX_TEXTURE_IMAGE_UNITS) ||
- (unit == 0 && (imageSrc[3] != '0' || imageSrc[4] != 0))) {
- RETURN_ERROR1("Invalied TEX# source index");
- }
- *texUnit = unit;
-
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
-
- if (Parse_String(parseState, "1D")) {
- *texTargetBit = TEXTURE_1D_BIT;
- }
- else if (Parse_String(parseState, "2D")) {
- *texTargetBit = TEXTURE_2D_BIT;
- }
- else if (Parse_String(parseState, "3D")) {
- *texTargetBit = TEXTURE_3D_BIT;
- }
- else if (Parse_String(parseState, "CUBE")) {
- *texTargetBit = TEXTURE_CUBE_BIT;
- }
- else if (Parse_String(parseState, "RECT")) {
- *texTargetBit = TEXTURE_RECT_BIT;
- }
- else {
- RETURN_ERROR1("Invalid texture target token");
- }
-
- /* update record of referenced texture units */
- parseState->texturesUsed[*texUnit] |= *texTargetBit;
- if (_mesa_bitcount(parseState->texturesUsed[*texUnit]) > 1) {
- RETURN_ERROR1("Only one texture target can be used per texture unit.");
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse a scalar suffix like .x, .y, .z or .w or parse a swizzle suffix
- * like .wxyz, .xxyy, etc and return the swizzle indexes.
- */
-static GLboolean
-Parse_SwizzleSuffix(const GLubyte *token, GLuint swizzle[4])
-{
- if (token[1] == 0) {
- /* single letter swizzle (scalar) */
- if (token[0] == 'x')
- ASSIGN_4V(swizzle, 0, 0, 0, 0);
- else if (token[0] == 'y')
- ASSIGN_4V(swizzle, 1, 1, 1, 1);
- else if (token[0] == 'z')
- ASSIGN_4V(swizzle, 2, 2, 2, 2);
- else if (token[0] == 'w')
- ASSIGN_4V(swizzle, 3, 3, 3, 3);
- else
- return GL_FALSE;
- }
- else {
- /* 4-component swizzle (vector) */
- GLint k;
- for (k = 0; k < 4 && token[k]; k++) {
- if (token[k] == 'x')
- swizzle[k] = 0;
- else if (token[k] == 'y')
- swizzle[k] = 1;
- else if (token[k] == 'z')
- swizzle[k] = 2;
- else if (token[k] == 'w')
- swizzle[k] = 3;
- else
- return GL_FALSE;
- }
- if (k != 4)
- return GL_FALSE;
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_CondCodeMask(struct parse_state *parseState,
- struct prog_dst_register *dstReg)
-{
- if (Parse_String(parseState, "EQ"))
- dstReg->CondMask = COND_EQ;
- else if (Parse_String(parseState, "GE"))
- dstReg->CondMask = COND_GE;
- else if (Parse_String(parseState, "GT"))
- dstReg->CondMask = COND_GT;
- else if (Parse_String(parseState, "LE"))
- dstReg->CondMask = COND_LE;
- else if (Parse_String(parseState, "LT"))
- dstReg->CondMask = COND_LT;
- else if (Parse_String(parseState, "NE"))
- dstReg->CondMask = COND_NE;
- else if (Parse_String(parseState, "TR"))
- dstReg->CondMask = COND_TR;
- else if (Parse_String(parseState, "FL"))
- dstReg->CondMask = COND_FL;
- else
- RETURN_ERROR1("Invalid condition code mask");
-
- /* look for optional .xyzw swizzle */
- if (Parse_String(parseState, ".")) {
- GLubyte token[100];
- GLuint swz[4];
-
- if (!Parse_Token(parseState, token)) /* get xyzw suffix */
- RETURN_ERROR;
-
- if (!Parse_SwizzleSuffix(token, swz))
- RETURN_ERROR1("Invalid swizzle suffix");
-
- dstReg->CondSwizzle = MAKE_SWIZZLE4(swz[0], swz[1], swz[2], swz[3]);
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse a temporary register: Rnn or Hnn
- */
-static GLboolean
-Parse_TempReg(struct parse_state *parseState, GLint *tempRegNum)
-{
- GLubyte token[100];
-
- /* Should be 'R##' or 'H##' */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
- if (token[0] != 'R' && token[0] != 'H')
- RETURN_ERROR1("Expected R## or H##");
-
- if (IsDigit(token[1])) {
- GLint reg = atoi((const char *) (token + 1));
- if (token[0] == 'H')
- reg += 32;
- if (reg >= MAX_NV_FRAGMENT_PROGRAM_TEMPS)
- RETURN_ERROR1("Invalid temporary register name");
- *tempRegNum = reg;
- }
- else {
- RETURN_ERROR1("Invalid temporary register name");
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse a write-only dummy register: RC or HC.
- */
-static GLboolean
-Parse_DummyReg(struct parse_state *parseState, GLint *regNum)
-{
- if (Parse_String(parseState, "RC")) {
- *regNum = 0;
- }
- else if (Parse_String(parseState, "HC")) {
- *regNum = 1;
- }
- else {
- RETURN_ERROR1("Invalid write-only register name");
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse a program local parameter register "p[##]"
- */
-static GLboolean
-Parse_ProgramParamReg(struct parse_state *parseState, GLint *regNum)
-{
- GLubyte token[100];
-
- if (!Parse_String(parseState, "p["))
- RETURN_ERROR1("Expected p[");
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (IsDigit(token[0])) {
- /* a numbered program parameter register */
- GLint reg = atoi((const char *) token);
- if (reg >= MAX_NV_FRAGMENT_PROGRAM_PARAMS)
- RETURN_ERROR1("Invalid constant program number");
- *regNum = reg;
- }
- else {
- RETURN_ERROR;
- }
-
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR1("Expected ]");
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse f[name] - fragment input register
- */
-static GLboolean
-Parse_FragReg(struct parse_state *parseState, GLint *tempRegNum)
-{
- GLubyte token[100];
- GLint j;
-
- /* Match 'f[' */
- if (!Parse_String(parseState, "f["))
- RETURN_ERROR1("Expected f[");
-
- /* get <name> and look for match */
- if (!Parse_Token(parseState, token)) {
- RETURN_ERROR;
- }
- for (j = 0; InputRegisters[j]; j++) {
- if (strcmp((const char *) token, InputRegisters[j]) == 0) {
- *tempRegNum = j;
- parseState->inputsRead |= (1 << j);
- break;
- }
- }
- if (!InputRegisters[j]) {
- /* unknown input register label */
- RETURN_ERROR2("Invalid register name", token);
- }
-
- /* Match '[' */
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR1("Expected ]");
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
-{
- GLubyte token[100];
-
- /* Match "o[" */
- if (!Parse_String(parseState, "o["))
- RETURN_ERROR1("Expected o[");
-
- /* Get output reg name */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- /* try to match an output register name */
- if (strcmp((char *) token, "COLR") == 0 ||
- strcmp((char *) token, "COLH") == 0) {
- /* note that we don't distinguish between COLR and COLH */
- *outputRegNum = FRAG_RESULT_COLOR;
- parseState->outputsWritten |= (1 << FRAG_RESULT_COLOR);
- }
- else if (strcmp((char *) token, "DEPR") == 0) {
- *outputRegNum = FRAG_RESULT_DEPTH;
- parseState->outputsWritten |= (1 << FRAG_RESULT_DEPTH);
- }
- else {
- RETURN_ERROR1("Invalid output register name");
- }
-
- /* Match ']' */
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR1("Expected ]");
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_MaskedDstReg(struct parse_state *parseState,
- struct prog_dst_register *dstReg)
-{
- GLubyte token[100];
- GLint idx;
-
- /* Dst reg can be R<n>, H<n>, o[n], RC or HC */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- if (strcmp((const char *) token, "RC") == 0 ||
- strcmp((const char *) token, "HC") == 0) {
- /* a write-only register */
- dstReg->File = PROGRAM_WRITE_ONLY;
- if (!Parse_DummyReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else if (token[0] == 'R' || token[0] == 'H') {
- /* a temporary register */
- dstReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else if (token[0] == 'o') {
- /* an output register */
- dstReg->File = PROGRAM_OUTPUT;
- if (!Parse_OutputReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else {
- RETURN_ERROR1("Invalid destination register name");
- }
-
- /* Parse optional write mask */
- if (Parse_String(parseState, ".")) {
- /* got a mask */
- GLint k = 0;
-
- if (!Parse_Token(parseState, token)) /* get xyzw writemask */
- RETURN_ERROR;
-
- dstReg->WriteMask = 0;
-
- if (token[k] == 'x') {
- dstReg->WriteMask |= WRITEMASK_X;
- k++;
- }
- if (token[k] == 'y') {
- dstReg->WriteMask |= WRITEMASK_Y;
- k++;
- }
- if (token[k] == 'z') {
- dstReg->WriteMask |= WRITEMASK_Z;
- k++;
- }
- if (token[k] == 'w') {
- dstReg->WriteMask |= WRITEMASK_W;
- k++;
- }
- if (k == 0) {
- RETURN_ERROR1("Invalid writemask character");
- }
-
- }
- else {
- dstReg->WriteMask = WRITEMASK_XYZW;
- }
-
- /* optional condition code mask */
- if (Parse_String(parseState, "(")) {
- /* ("EQ" | "GE" | "GT" | "LE" | "LT" | "NE" | "TR" | "FL".x|y|z|w) */
- /* ("EQ" | "GE" | "GT" | "LE" | "LT" | "NE" | "TR" | "FL".[xyzw]) */
- if (!Parse_CondCodeMask(parseState, dstReg))
- RETURN_ERROR;
-
- if (!Parse_String(parseState, ")")) /* consume ")" */
- RETURN_ERROR1("Expected )");
-
- return GL_TRUE;
- }
- else {
- /* no cond code mask */
- dstReg->CondMask = COND_TR;
- dstReg->CondSwizzle = SWIZZLE_NOOP;
- return GL_TRUE;
- }
-}
-
-
-/**
- * Parse a vector source (register, constant, etc):
- * <vectorSrc> ::= <absVectorSrc>
- * | <baseVectorSrc>
- * <absVectorSrc> ::= <negate> "|" <baseVectorSrc> "|"
- */
-static GLboolean
-Parse_VectorSrc(struct parse_state *parseState,
- struct prog_src_register *srcReg)
-{
- GLfloat sign = 1.0F;
- GLubyte token[100];
- GLint idx;
- GLuint negateBase, negateAbs;
-
- /*
- * First, take care of +/- and absolute value stuff.
- */
- if (Parse_String(parseState, "-"))
- sign = -1.0F;
- else if (Parse_String(parseState, "+"))
- sign = +1.0F;
-
- if (Parse_String(parseState, "|")) {
- srcReg->Abs = GL_TRUE;
- negateAbs = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
-
- if (Parse_String(parseState, "-"))
- negateBase = NEGATE_XYZW;
- else if (Parse_String(parseState, "+"))
- negateBase = NEGATE_NONE;
- else
- negateBase = NEGATE_NONE;
- }
- else {
- srcReg->Abs = GL_FALSE;
- negateAbs = NEGATE_NONE;
- negateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
- }
-
- srcReg->Negate = srcReg->Abs ? negateAbs : negateBase;
-
- /* This should be the real src vector/register name */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- /* Src reg can be Rn, Hn, f[n], p[n], a named parameter, a scalar
- * literal or vector literal.
- */
- if (token[0] == 'R' || token[0] == 'H') {
- srcReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'f') {
- /* XXX this might be an identifier! */
- srcReg->File = PROGRAM_INPUT;
- if (!Parse_FragReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'p') {
- /* XXX this might be an identifier! */
- srcReg->File = PROGRAM_LOCAL_PARAM;
- if (!Parse_ProgramParamReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (IsLetter(token[0])){
- GLubyte ident[100];
- GLint paramIndex;
- if (!Parse_Identifier(parseState, ident))
- RETURN_ERROR;
- paramIndex = _mesa_lookup_parameter_index(parseState->parameters,
- -1, (const char *) ident);
- if (paramIndex < 0) {
- RETURN_ERROR2("Undefined constant or parameter: ", ident);
- }
- srcReg->File = PROGRAM_NAMED_PARAM;
- srcReg->Index = paramIndex;
- }
- else if (IsDigit(token[0]) || token[0] == '-' || token[0] == '+' || token[0] == '.'){
- /* literal scalar constant */
- GLfloat values[4];
- GLuint paramIndex;
- if (!Parse_ScalarConstant(parseState, values))
- RETURN_ERROR;
- paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
- values, 4, NULL);
- srcReg->File = PROGRAM_NAMED_PARAM;
- srcReg->Index = paramIndex;
- }
- else if (token[0] == '{'){
- /* literal vector constant */
- GLfloat values[4];
- GLuint paramIndex;
- (void) Parse_String(parseState, "{");
- if (!Parse_VectorConstant(parseState, values))
- RETURN_ERROR;
- paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
- values, 4, NULL);
- srcReg->File = PROGRAM_NAMED_PARAM;
- srcReg->Index = paramIndex;
- }
- else {
- RETURN_ERROR2("Invalid source register name", token);
- }
-
- /* init swizzle fields */
- srcReg->Swizzle = SWIZZLE_NOOP;
-
- /* Look for optional swizzle suffix */
- if (Parse_String(parseState, ".")) {
- GLuint swz[4];
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (!Parse_SwizzleSuffix(token, swz))
- RETURN_ERROR1("Invalid swizzle suffix");
-
- srcReg->Swizzle = MAKE_SWIZZLE4(swz[0], swz[1], swz[2], swz[3]);
- }
-
- /* Finish absolute value */
- if (srcReg->Abs && !Parse_String(parseState, "|")) {
- RETURN_ERROR1("Expected |");
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_ScalarSrcReg(struct parse_state *parseState,
- struct prog_src_register *srcReg)
-{
- GLubyte token[100];
- GLfloat sign = 1.0F;
- GLboolean needSuffix = GL_TRUE;
- GLint idx;
- GLuint negateBase, negateAbs;
-
- /*
- * First, take care of +/- and absolute value stuff.
- */
- if (Parse_String(parseState, "-"))
- sign = -1.0F;
- else if (Parse_String(parseState, "+"))
- sign = +1.0F;
-
- if (Parse_String(parseState, "|")) {
- srcReg->Abs = GL_TRUE;
- negateAbs = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
-
- if (Parse_String(parseState, "-"))
- negateBase = NEGATE_XYZW;
- else if (Parse_String(parseState, "+"))
- negateBase = NEGATE_NONE;
- else
- negateBase = NEGATE_NONE;
- }
- else {
- srcReg->Abs = GL_FALSE;
- negateAbs = NEGATE_NONE;
- negateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
- }
-
- srcReg->Negate = srcReg->Abs ? negateAbs : negateBase;
-
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- /* Src reg can be R<n>, H<n> or a named fragment attrib */
- if (token[0] == 'R' || token[0] == 'H') {
- srcReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'f') {
- srcReg->File = PROGRAM_INPUT;
- if (!Parse_FragReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == '{') {
- /* vector literal */
- GLfloat values[4];
- GLuint paramIndex;
- (void) Parse_String(parseState, "{");
- if (!Parse_VectorConstant(parseState, values))
- RETURN_ERROR;
- paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
- values, 4, NULL);
- srcReg->File = PROGRAM_NAMED_PARAM;
- srcReg->Index = paramIndex;
- }
- else if (IsLetter(token[0])){
- /* named param/constant */
- GLubyte ident[100];
- GLint paramIndex;
- if (!Parse_Identifier(parseState, ident))
- RETURN_ERROR;
- paramIndex = _mesa_lookup_parameter_index(parseState->parameters,
- -1, (const char *) ident);
- if (paramIndex < 0) {
- RETURN_ERROR2("Undefined constant or parameter: ", ident);
- }
- srcReg->File = PROGRAM_NAMED_PARAM;
- srcReg->Index = paramIndex;
- }
- else if (IsDigit(token[0])) {
- /* scalar literal */
- GLfloat values[4];
- GLuint paramIndex;
- if (!Parse_ScalarConstant(parseState, values))
- RETURN_ERROR;
- paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
- values, 4, NULL);
- srcReg->Index = paramIndex;
- srcReg->File = PROGRAM_NAMED_PARAM;
- needSuffix = GL_FALSE;
- }
- else {
- RETURN_ERROR2("Invalid scalar source argument", token);
- }
-
- srcReg->Swizzle = 0;
- if (needSuffix) {
- /* parse .[xyzw] suffix */
- if (!Parse_String(parseState, "."))
- RETURN_ERROR1("Expected .");
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[0] == 'x' && token[1] == 0) {
- srcReg->Swizzle = 0;
- }
- else if (token[0] == 'y' && token[1] == 0) {
- srcReg->Swizzle = 1;
- }
- else if (token[0] == 'z' && token[1] == 0) {
- srcReg->Swizzle = 2;
- }
- else if (token[0] == 'w' && token[1] == 0) {
- srcReg->Swizzle = 3;
- }
- else {
- RETURN_ERROR1("Invalid scalar source suffix");
- }
- }
-
- /* Finish absolute value */
- if (srcReg->Abs && !Parse_String(parseState, "|")) {
- RETURN_ERROR1("Expected |");
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_PrintInstruction(struct parse_state *parseState,
- struct prog_instruction *inst)
-{
- const GLubyte *str;
- GLubyte *msg;
- GLuint len;
- GLint idx;
-
- /* The first argument is a literal string 'just like this' */
- if (!Parse_String(parseState, "'"))
- RETURN_ERROR1("Expected '");
-
- str = parseState->pos;
- for (len = 0; str[len] != '\''; len++) /* find closing quote */
- ;
- parseState->pos += len + 1;
- msg = (GLubyte*) malloc(len + 1);
-
- memcpy(msg, str, len);
- msg[len] = 0;
- inst->Data = msg;
-
- if (Parse_String(parseState, ",")) {
- /* got an optional register to print */
- GLubyte token[100];
- GetToken(parseState, token);
- if (token[0] == 'o') {
- /* dst reg */
- if (!Parse_OutputReg(parseState, &idx))
- RETURN_ERROR;
- inst->SrcReg[0].Index = idx;
- inst->SrcReg[0].File = PROGRAM_OUTPUT;
- }
- else {
- /* src reg */
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- }
- }
- else {
- inst->SrcReg[0].File = PROGRAM_UNDEFINED;
- }
-
- inst->SrcReg[0].Swizzle = SWIZZLE_NOOP;
- inst->SrcReg[0].Abs = GL_FALSE;
- inst->SrcReg[0].Negate = NEGATE_NONE;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_InstructionSequence(struct parse_state *parseState,
- struct prog_instruction program[])
-{
- while (1) {
- struct prog_instruction *inst = program + parseState->numInst;
- struct instruction_pattern instMatch;
- GLubyte token[100];
-
- /* Initialize the instruction */
- _mesa_init_instructions(inst, 1);
-
- /* special instructions */
- if (Parse_String(parseState, "DEFINE")) {
- GLubyte id[100];
- GLfloat value[7]; /* yes, 7 to be safe */
- if (!Parse_Identifier(parseState, id))
- RETURN_ERROR;
- /* XXX make sure id is not a reserved identifer, like R9 */
- if (!Parse_String(parseState, "="))
- RETURN_ERROR1("Expected =");
- if (!Parse_VectorOrScalarConstant(parseState, value))
- RETURN_ERROR;
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR1("Expected ;");
- if (_mesa_lookup_parameter_index(parseState->parameters,
- -1, (const char *) id) >= 0) {
- RETURN_ERROR2(id, "already defined");
- }
- _mesa_add_named_parameter(parseState->parameters,
- (const char *) id, value);
- }
- else if (Parse_String(parseState, "DECLARE")) {
- GLubyte id[100];
- GLfloat value[7] = {0, 0, 0, 0, 0, 0, 0}; /* yes, to be safe */
- if (!Parse_Identifier(parseState, id))
- RETURN_ERROR;
- /* XXX make sure id is not a reserved identifer, like R9 */
- if (Parse_String(parseState, "=")) {
- if (!Parse_VectorOrScalarConstant(parseState, value))
- RETURN_ERROR;
- }
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR1("Expected ;");
- if (_mesa_lookup_parameter_index(parseState->parameters,
- -1, (const char *) id) >= 0) {
- RETURN_ERROR2(id, "already declared");
- }
- _mesa_add_named_parameter(parseState->parameters,
- (const char *) id, value);
- }
- else if (Parse_String(parseState, "END")) {
- inst->Opcode = OPCODE_END;
- parseState->numInst++;
- if (Parse_Token(parseState, token)) {
- RETURN_ERROR1("Code after END opcode.");
- }
- break;
- }
- else {
- /* general/arithmetic instruction */
-
- /* get token */
- if (!Parse_Token(parseState, token)) {
- RETURN_ERROR1("Missing END instruction.");
- }
-
- /* try to find matching instuction */
- instMatch = MatchInstruction(token);
- if (instMatch.opcode >= MAX_OPCODE) {
- /* bad instruction name */
- RETURN_ERROR2("Unexpected token: ", token);
- }
-
- inst->Opcode = instMatch.opcode;
- inst->Precision = instMatch.suffixes & (_R | _H | _X);
- inst->SaturateMode = (instMatch.suffixes & (_S))
- ? SATURATE_ZERO_ONE : SATURATE_OFF;
- inst->CondUpdate = (instMatch.suffixes & (_C)) ? GL_TRUE : GL_FALSE;
-
- /*
- * parse the input and output operands
- */
- if (instMatch.outputs == OUTPUT_S || instMatch.outputs == OUTPUT_V) {
- if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- }
- else if (instMatch.outputs == OUTPUT_NONE) {
- if (instMatch.opcode == OPCODE_KIL_NV) {
- /* This is a little weird, the cond code info is in
- * the dest register.
- */
- if (!Parse_CondCodeMask(parseState, &inst->DstReg))
- RETURN_ERROR;
- }
- else {
- ASSERT(instMatch.opcode == OPCODE_PRINT);
- }
- }
-
- if (instMatch.inputs == INPUT_1V) {
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- }
- else if (instMatch.inputs == INPUT_2V) {
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
- }
- else if (instMatch.inputs == INPUT_3V) {
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[2]))
- RETURN_ERROR;
- }
- else if (instMatch.inputs == INPUT_1S) {
- if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- }
- else if (instMatch.inputs == INPUT_2S) {
- if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
- }
- else if (instMatch.inputs == INPUT_CC) {
- /* XXX to-do */
- }
- else if (instMatch.inputs == INPUT_1V_T) {
- GLubyte unit, idx;
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_TextureImageId(parseState, &unit, &idx))
- RETURN_ERROR;
- inst->TexSrcUnit = unit;
- inst->TexSrcTarget = idx;
- }
- else if (instMatch.inputs == INPUT_3V_T) {
- GLubyte unit, idx;
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[2]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_TextureImageId(parseState, &unit, &idx))
- RETURN_ERROR;
- inst->TexSrcUnit = unit;
- inst->TexSrcTarget = idx;
- }
- else if (instMatch.inputs == INPUT_1V_S) {
- if (!Parse_PrintInstruction(parseState, inst))
- RETURN_ERROR;
- }
-
- /* end of statement semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR1("Expected ;");
-
- parseState->numInst++;
-
- if (parseState->numInst >= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS)
- RETURN_ERROR1("Program too long");
- }
- }
- return GL_TRUE;
-}
-
-
-
-/**
- * Parse/compile the 'str' returning the compiled 'program'.
- * ctx->Program.ErrorPos will be -1 if successful. Otherwise, ErrorPos
- * indicates the position of the error in 'str'.
- */
-void
-_mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum dstTarget,
- const GLubyte *str, GLsizei len,
- struct gl_fragment_program *program)
-{
- struct parse_state parseState;
- struct prog_instruction instBuffer[MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS];
- struct prog_instruction *newInst;
- GLenum target;
- GLubyte *programString;
-
- /* Make a null-terminated copy of the program string */
- programString = (GLubyte *) MALLOC(len + 1);
- if (!programString) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- memcpy(programString, str, len);
- programString[len] = 0;
-
- /* Get ready to parse */
- memset(&parseState, 0, sizeof(struct parse_state));
- parseState.ctx = ctx;
- parseState.start = programString;
- parseState.program = program;
- parseState.numInst = 0;
- parseState.curLine = programString;
- parseState.parameters = _mesa_new_parameter_list();
-
- /* Reset error state */
- _mesa_set_program_error(ctx, -1, NULL);
-
- /* check the program header */
- if (strncmp((const char *) programString, "!!FP1.0", 7) == 0) {
- target = GL_FRAGMENT_PROGRAM_NV;
- parseState.pos = programString + 7;
- }
- else if (strncmp((const char *) programString, "!!FCP1.0", 8) == 0) {
- /* fragment / register combiner program - not supported */
- _mesa_set_program_error(ctx, 0, "Invalid fragment program header");
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(bad header)");
- return;
- }
- else {
- /* invalid header */
- _mesa_set_program_error(ctx, 0, "Invalid fragment program header");
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(bad header)");
- return;
- }
-
- /* make sure target and header match */
- if (target != dstTarget) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glLoadProgramNV(target mismatch 0x%x != 0x%x)",
- target, dstTarget);
- return;
- }
-
- if (Parse_InstructionSequence(&parseState, instBuffer)) {
- GLuint u;
- /* successful parse! */
-
- if (parseState.outputsWritten == 0) {
- /* must write at least one output! */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "Invalid fragment program - no outputs written.");
- return;
- }
-
- /* copy the compiled instructions */
- assert(parseState.numInst <= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS);
- newInst = _mesa_alloc_instructions(parseState.numInst);
- if (!newInst) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return; /* out of memory */
- }
- _mesa_copy_instructions(newInst, instBuffer, parseState.numInst);
-
- /* install the program */
- program->Base.Target = target;
- if (program->Base.String) {
- FREE(program->Base.String);
- }
- program->Base.String = programString;
- program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
- if (program->Base.Instructions) {
- free(program->Base.Instructions);
- }
- program->Base.Instructions = newInst;
- program->Base.NumInstructions = parseState.numInst;
- program->Base.InputsRead = parseState.inputsRead;
- program->Base.OutputsWritten = parseState.outputsWritten;
- for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++)
- program->Base.TexturesUsed[u] = parseState.texturesUsed[u];
-
- /* save program parameters */
- program->Base.Parameters = parseState.parameters;
-
- /* allocate registers for declared program parameters */
-#if 00
- _mesa_assign_program_registers(&(program->SymbolTable));
-#endif
-
-#ifdef DEBUG_foo
- printf("--- glLoadProgramNV(%d) result ---\n", program->Base.Id);
- _mesa_fprint_program_opt(stdout, &program->Base, PROG_PRINT_NV, 0);
- printf("----------------------------------\n");
-#endif
- }
- else {
- /* Error! */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV");
- /* NOTE: _mesa_set_program_error would have been called already */
- }
-}
-
-
-const char *
-_mesa_nv_fragment_input_register_name(GLuint i)
-{
- ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_INPUTS);
- return InputRegisters[i];
-}
-
diff --git a/src/mesa/program/nvfragparse.h b/src/mesa/program/nvfragparse.h
deleted file mode 100644
index 3e85dd2..0000000
--- a/src/mesa/program/nvfragparse.h
+++ /dev/null
@@ -1,44 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2002 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.
- *
- * Authors:
- * Brian Paul
- */
-
-
-#ifndef NVFRAGPARSE_H
-#define NVFRAGPARSE_H
-
-#include "main/mtypes.h"
-
-extern void
-_mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum target,
- const GLubyte *str, GLsizei len,
- struct gl_fragment_program *program);
-
-
-extern const char *
-_mesa_nv_fragment_input_register_name(GLuint i);
-
-#endif
diff --git a/src/mesa/program/nvvertparse.c b/src/mesa/program/nvvertparse.c
deleted file mode 100644
index bdd44a4..0000000
--- a/src/mesa/program/nvvertparse.c
+++ /dev/null
@@ -1,1459 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \file nvvertparse.c
- * NVIDIA vertex program parser.
- * \author Brian Paul
- */
-
-/*
- * Regarding GL_NV_vertex_program, GL_NV_vertex_program1_1:
- *
- * Portions of this software may use or implement intellectual
- * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims
- * any and all warranties with respect to such intellectual property,
- * including any use thereof or modifications thereto.
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/imports.h"
-#include "main/nvprogram.h"
-#include "nvvertparse.h"
-#include "prog_instruction.h"
-#include "prog_parameter.h"
-#include "prog_print.h"
-#include "program.h"
-
-
-/**
- * Current parsing state. This structure is passed among the parsing
- * functions and keeps track of the current parser position and various
- * program attributes.
- */
-struct parse_state {
- struct gl_context *ctx;
- const GLubyte *start;
- const GLubyte *pos;
- const GLubyte *curLine;
- GLboolean isStateProgram;
- GLboolean isPositionInvariant;
- GLboolean isVersion1_1;
- GLbitfield inputsRead;
- GLbitfield outputsWritten;
- GLboolean anyProgRegsWritten;
- GLboolean indirectRegisterFiles;
- GLuint numInst; /* number of instructions parsed */
-};
-
-
-/*
- * Called whenever we find an error during parsing.
- */
-static void
-record_error(struct parse_state *parseState, const char *msg, int lineNo)
-{
-#ifdef DEBUG
- GLint line, column;
- const GLubyte *lineStr;
- lineStr = _mesa_find_line_column(parseState->start,
- parseState->pos, &line, &column);
- _mesa_debug(parseState->ctx,
- "nvfragparse.c(%d): line %d, column %d:%s (%s)\n",
- lineNo, line, column, (char *) lineStr, msg);
- free((void *) lineStr);
-#else
- (void) lineNo;
-#endif
-
- /* Check that no error was already recorded. Only record the first one. */
- if (parseState->ctx->Program.ErrorString[0] == 0) {
- _mesa_set_program_error(parseState->ctx,
- parseState->pos - parseState->start,
- msg);
- }
-}
-
-
-#define RETURN_ERROR \
-do { \
- record_error(parseState, "Unexpected end of input.", __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-#define RETURN_ERROR1(msg) \
-do { \
- record_error(parseState, msg, __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-#define RETURN_ERROR2(msg1, msg2) \
-do { \
- char err[1000]; \
- sprintf(err, "%s %s", msg1, msg2); \
- record_error(parseState, err, __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-
-
-
-
-static GLboolean IsLetter(GLubyte b)
-{
- return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z');
-}
-
-
-static GLboolean IsDigit(GLubyte b)
-{
- return b >= '0' && b <= '9';
-}
-
-
-static GLboolean IsWhitespace(GLubyte b)
-{
- return b == ' ' || b == '\t' || b == '\n' || b == '\r';
-}
-
-
-/**
- * Starting at 'str' find the next token. A token can be an integer,
- * an identifier or punctuation symbol.
- * \return <= 0 we found an error, else, return number of characters parsed.
- */
-static GLint
-GetToken(struct parse_state *parseState, GLubyte *token)
-{
- const GLubyte *str = parseState->pos;
- GLint i = 0, j = 0;
-
- token[0] = 0;
-
- /* skip whitespace and comments */
- while (str[i] && (IsWhitespace(str[i]) || str[i] == '#')) {
- if (str[i] == '#') {
- /* skip comment */
- while (str[i] && (str[i] != '\n' && str[i] != '\r')) {
- i++;
- }
- if (str[i] == '\n' || str[i] == '\r')
- parseState->curLine = str + i + 1;
- }
- else {
- /* skip whitespace */
- if (str[i] == '\n' || str[i] == '\r')
- parseState->curLine = str + i + 1;
- i++;
- }
- }
-
- if (str[i] == 0)
- return -i;
-
- /* try matching an integer */
- while (str[i] && IsDigit(str[i])) {
- token[j++] = str[i++];
- }
- if (j > 0 || !str[i]) {
- token[j] = 0;
- return i;
- }
-
- /* try matching an identifier */
- if (IsLetter(str[i])) {
- while (str[i] && (IsLetter(str[i]) || IsDigit(str[i]))) {
- token[j++] = str[i++];
- }
- token[j] = 0;
- return i;
- }
-
- /* punctuation character */
- if (str[i]) {
- token[0] = str[i++];
- token[1] = 0;
- return i;
- }
-
- /* end of input */
- token[0] = 0;
- return i;
-}
-
-
-/**
- * Get next token from input stream and increment stream pointer past token.
- */
-static GLboolean
-Parse_Token(struct parse_state *parseState, GLubyte *token)
-{
- GLint i;
- i = GetToken(parseState, token);
- if (i <= 0) {
- parseState->pos += (-i);
- return GL_FALSE;
- }
- parseState->pos += i;
- return GL_TRUE;
-}
-
-
-/**
- * Get next token from input stream but don't increment stream pointer.
- */
-static GLboolean
-Peek_Token(struct parse_state *parseState, GLubyte *token)
-{
- GLint i, len;
- i = GetToken(parseState, token);
- if (i <= 0) {
- parseState->pos += (-i);
- return GL_FALSE;
- }
- len = (GLint) strlen((const char *) token);
- parseState->pos += (i - len);
- return GL_TRUE;
-}
-
-
-/**
- * Try to match 'pattern' as the next token after any whitespace/comments.
- * Advance the current parsing position only if we match the pattern.
- * \return GL_TRUE if pattern is matched, GL_FALSE otherwise.
- */
-static GLboolean
-Parse_String(struct parse_state *parseState, const char *pattern)
-{
- const GLubyte *m;
- GLint i;
-
- /* skip whitespace and comments */
- while (IsWhitespace(*parseState->pos) || *parseState->pos == '#') {
- if (*parseState->pos == '#') {
- while (*parseState->pos && (*parseState->pos != '\n' && *parseState->pos != '\r')) {
- parseState->pos += 1;
- }
- if (*parseState->pos == '\n' || *parseState->pos == '\r')
- parseState->curLine = parseState->pos + 1;
- }
- else {
- /* skip whitespace */
- if (*parseState->pos == '\n' || *parseState->pos == '\r')
- parseState->curLine = parseState->pos + 1;
- parseState->pos += 1;
- }
- }
-
- /* Try to match the pattern */
- m = parseState->pos;
- for (i = 0; pattern[i]; i++) {
- if (*m != (GLubyte) pattern[i])
- return GL_FALSE;
- m += 1;
- }
- parseState->pos = m;
-
- return GL_TRUE; /* success */
-}
-
-
-/**********************************************************************/
-
-static const char *InputRegisters[MAX_NV_VERTEX_PROGRAM_INPUTS + 1] = {
- "OPOS", "WGHT", "NRML", "COL0", "COL1", "FOGC", "6", "7",
- "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL
-};
-
-static const char *OutputRegisters[MAX_NV_VERTEX_PROGRAM_OUTPUTS + 1] = {
- "HPOS", "COL0", "COL1", "FOGC",
- "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7",
- "PSIZ", "BFC0", "BFC1", NULL
-};
-
-
-
-/**
- * Parse a temporary register: Rnn
- */
-static GLboolean
-Parse_TempReg(struct parse_state *parseState, GLint *tempRegNum)
-{
- GLubyte token[100];
-
- /* Should be 'R##' */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
- if (token[0] != 'R')
- RETURN_ERROR1("Expected R##");
-
- if (IsDigit(token[1])) {
- GLint reg = atoi((char *) (token + 1));
- if (reg >= MAX_NV_VERTEX_PROGRAM_TEMPS)
- RETURN_ERROR1("Bad temporary register name");
- *tempRegNum = reg;
- }
- else {
- RETURN_ERROR1("Bad temporary register name");
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse address register "A0.x"
- */
-static GLboolean
-Parse_AddrReg(struct parse_state *parseState)
-{
- /* match 'A0' */
- if (!Parse_String(parseState, "A0"))
- RETURN_ERROR;
-
- /* match '.' */
- if (!Parse_String(parseState, "."))
- RETURN_ERROR;
-
- /* match 'x' */
- if (!Parse_String(parseState, "x"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse absolute program parameter register "c[##]"
- */
-static GLboolean
-Parse_AbsParamReg(struct parse_state *parseState, GLint *regNum)
-{
- GLubyte token[100];
-
- if (!Parse_String(parseState, "c"))
- RETURN_ERROR;
-
- if (!Parse_String(parseState, "["))
- RETURN_ERROR;
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (IsDigit(token[0])) {
- /* a numbered program parameter register */
- GLint reg = atoi((char *) token);
- if (reg >= MAX_NV_VERTEX_PROGRAM_PARAMS)
- RETURN_ERROR1("Bad program parameter number");
- *regNum = reg;
- }
- else {
- RETURN_ERROR;
- }
-
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_ParamReg(struct parse_state *parseState, struct prog_src_register *srcReg)
-{
- GLubyte token[100];
-
- if (!Parse_String(parseState, "c"))
- RETURN_ERROR;
-
- if (!Parse_String(parseState, "["))
- RETURN_ERROR;
-
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- if (IsDigit(token[0])) {
- /* a numbered program parameter register */
- GLint reg;
- (void) Parse_Token(parseState, token);
- reg = atoi((char *) token);
- if (reg >= MAX_NV_VERTEX_PROGRAM_PARAMS)
- RETURN_ERROR1("Bad program parameter number");
- srcReg->File = PROGRAM_ENV_PARAM;
- srcReg->Index = reg;
- }
- else if (strcmp((const char *) token, "A0") == 0) {
- /* address register "A0.x" */
- if (!Parse_AddrReg(parseState))
- RETURN_ERROR;
-
- 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;
-
- if (token[0] == '-' || token[0] == '+') {
- const GLubyte sign = token[0];
- (void) Parse_Token(parseState, token); /* consume +/- */
-
- /* an integer should be next */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (IsDigit(token[0])) {
- const GLint k = atoi((char *) token);
- if (sign == '-') {
- if (k > 64)
- RETURN_ERROR1("Bad address offset");
- srcReg->Index = -k;
- }
- else {
- if (k > 63)
- RETURN_ERROR1("Bad address offset");
- srcReg->Index = k;
- }
- }
- else {
- RETURN_ERROR;
- }
- }
- else {
- /* probably got a ']', catch it below */
- }
- }
- else {
- RETURN_ERROR;
- }
-
- /* Match closing ']' */
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse v[#] or v[<name>]
- */
-static GLboolean
-Parse_AttribReg(struct parse_state *parseState, GLint *tempRegNum)
-{
- GLubyte token[100];
- GLint j;
-
- /* Match 'v' */
- if (!Parse_String(parseState, "v"))
- RETURN_ERROR;
-
- /* Match '[' */
- if (!Parse_String(parseState, "["))
- RETURN_ERROR;
-
- /* match number or named register */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (parseState->isStateProgram && token[0] != '0')
- RETURN_ERROR1("Only v[0] accessible in vertex state programs");
-
- if (IsDigit(token[0])) {
- GLint reg = atoi((char *) token);
- if (reg >= MAX_NV_VERTEX_PROGRAM_INPUTS)
- RETURN_ERROR1("Bad vertex attribute register name");
- *tempRegNum = reg;
- }
- else {
- for (j = 0; InputRegisters[j]; j++) {
- if (strcmp((const char *) token, InputRegisters[j]) == 0) {
- *tempRegNum = j;
- break;
- }
- }
- if (!InputRegisters[j]) {
- /* unknown input register label */
- RETURN_ERROR2("Bad register name", token);
- }
- }
-
- /* Match '[' */
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
-{
- GLubyte token[100];
- GLint start, j;
-
- /* Match 'o' */
- if (!Parse_String(parseState, "o"))
- RETURN_ERROR;
-
- /* Match '[' */
- if (!Parse_String(parseState, "["))
- RETURN_ERROR;
-
- /* Get output reg name */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (parseState->isPositionInvariant)
- start = 1; /* skip HPOS register name */
- else
- start = 0;
-
- /* try to match an output register name */
- for (j = start; OutputRegisters[j]; j++) {
- if (strcmp((const char *) token, OutputRegisters[j]) == 0) {
- *outputRegNum = j;
- break;
- }
- }
- if (!OutputRegisters[j])
- RETURN_ERROR1("Unrecognized output register name");
-
- /* Match ']' */
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR1("Expected ]");
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_MaskedDstReg(struct parse_state *parseState, struct prog_dst_register *dstReg)
-{
- GLubyte token[100];
- GLint idx;
-
- /* Dst reg can be R<n> or o[n] */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[0] == 'R') {
- /* a temporary register */
- dstReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else if (!parseState->isStateProgram && token[0] == 'o') {
- /* an output register */
- dstReg->File = PROGRAM_OUTPUT;
- if (!Parse_OutputReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else if (parseState->isStateProgram && token[0] == 'c' &&
- parseState->isStateProgram) {
- /* absolute program parameter register */
- /* Only valid for vertex state programs */
- dstReg->File = PROGRAM_ENV_PARAM;
- if (!Parse_AbsParamReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else {
- RETURN_ERROR1("Bad destination register name");
- }
-
- /* Parse optional write mask */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[0] == '.') {
- /* got a mask */
- GLint k = 0;
-
- if (!Parse_String(parseState, "."))
- RETURN_ERROR;
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- dstReg->WriteMask = 0;
-
- if (token[k] == 'x') {
- dstReg->WriteMask |= WRITEMASK_X;
- k++;
- }
- if (token[k] == 'y') {
- dstReg->WriteMask |= WRITEMASK_Y;
- k++;
- }
- if (token[k] == 'z') {
- dstReg->WriteMask |= WRITEMASK_Z;
- k++;
- }
- if (token[k] == 'w') {
- dstReg->WriteMask |= WRITEMASK_W;
- k++;
- }
- if (k == 0) {
- RETURN_ERROR1("Bad writemask character");
- }
- return GL_TRUE;
- }
- else {
- dstReg->WriteMask = WRITEMASK_XYZW;
- return GL_TRUE;
- }
-}
-
-
-static GLboolean
-Parse_SwizzleSrcReg(struct parse_state *parseState, struct prog_src_register *srcReg)
-{
- GLubyte token[100];
- GLint idx;
-
- srcReg->RelAddr = GL_FALSE;
-
- /* check for '-' */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
- if (token[0] == '-') {
- (void) Parse_String(parseState, "-");
- srcReg->Negate = NEGATE_XYZW;
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
- }
- else {
- srcReg->Negate = NEGATE_NONE;
- }
-
- /* Src reg can be R<n>, c[n], c[n +/- offset], or a named vertex attrib */
- if (token[0] == 'R') {
- srcReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'c') {
- if (!Parse_ParamReg(parseState, srcReg))
- RETURN_ERROR;
- }
- else if (token[0] == 'v') {
- srcReg->File = PROGRAM_INPUT;
- if (!Parse_AttribReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else {
- RETURN_ERROR2("Bad source register name", token);
- }
-
- /* init swizzle fields */
- srcReg->Swizzle = SWIZZLE_NOOP;
-
- /* Look for optional swizzle suffix */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
- if (token[0] == '.') {
- (void) Parse_String(parseState, "."); /* consume . */
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[1] == 0) {
- /* single letter swizzle */
- if (token[0] == 'x')
- srcReg->Swizzle = SWIZZLE_XXXX;
- else if (token[0] == 'y')
- srcReg->Swizzle = SWIZZLE_YYYY;
- else if (token[0] == 'z')
- srcReg->Swizzle = SWIZZLE_ZZZZ;
- else if (token[0] == 'w')
- srcReg->Swizzle = SWIZZLE_WWWW;
- else
- RETURN_ERROR1("Expected x, y, z, or w");
- }
- else {
- /* 2, 3 or 4-component swizzle */
- GLint k;
-
- srcReg->Swizzle = 0;
-
- for (k = 0; token[k] && k < 5; k++) {
- if (token[k] == 'x')
- srcReg->Swizzle |= 0 << (k*3);
- else if (token[k] == 'y')
- srcReg->Swizzle |= 1 << (k*3);
- else if (token[k] == 'z')
- srcReg->Swizzle |= 2 << (k*3);
- else if (token[k] == 'w')
- srcReg->Swizzle |= 3 << (k*3);
- else
- RETURN_ERROR;
- }
- if (k >= 5)
- RETURN_ERROR;
- }
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_ScalarSrcReg(struct parse_state *parseState, struct prog_src_register *srcReg)
-{
- GLubyte token[100];
- GLint idx;
-
- srcReg->RelAddr = GL_FALSE;
-
- /* check for '-' */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
- if (token[0] == '-') {
- srcReg->Negate = NEGATE_XYZW;
- (void) Parse_String(parseState, "-"); /* consume '-' */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
- }
- else {
- srcReg->Negate = NEGATE_NONE;
- }
-
- /* Src reg can be R<n>, c[n], c[n +/- offset], or a named vertex attrib */
- if (token[0] == 'R') {
- srcReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'c') {
- if (!Parse_ParamReg(parseState, srcReg))
- RETURN_ERROR;
- }
- else if (token[0] == 'v') {
- srcReg->File = PROGRAM_INPUT;
- if (!Parse_AttribReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else {
- RETURN_ERROR2("Bad source register name", token);
- }
-
- /* Look for .[xyzw] suffix */
- if (!Parse_String(parseState, "."))
- RETURN_ERROR;
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[0] == 'x' && token[1] == 0) {
- srcReg->Swizzle = 0;
- }
- else if (token[0] == 'y' && token[1] == 0) {
- srcReg->Swizzle = 1;
- }
- else if (token[0] == 'z' && token[1] == 0) {
- srcReg->Swizzle = 2;
- }
- else if (token[0] == 'w' && token[1] == 0) {
- srcReg->Swizzle = 3;
- }
- else {
- RETURN_ERROR1("Bad scalar source suffix");
- }
-
- return GL_TRUE;
-}
-
-
-static GLint
-Parse_UnaryOpInstruction(struct parse_state *parseState,
- struct prog_instruction *inst,
- enum prog_opcode opcode)
-{
- if (opcode == OPCODE_ABS && !parseState->isVersion1_1)
- RETURN_ERROR1("ABS illegal for vertex program 1.0");
-
- inst->Opcode = opcode;
-
- /* dest reg */
- if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_BiOpInstruction(struct parse_state *parseState,
- struct prog_instruction *inst,
- enum prog_opcode opcode)
-{
- if (opcode == OPCODE_DPH && !parseState->isVersion1_1)
- RETURN_ERROR1("DPH illegal for vertex program 1.0");
- if (opcode == OPCODE_SUB && !parseState->isVersion1_1)
- RETURN_ERROR1("SUB illegal for vertex program 1.0");
-
- inst->Opcode = opcode;
-
- /* dest reg */
- if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* first src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* second src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- /* make sure we don't reference more than one program parameter register */
- if (inst->SrcReg[0].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[1].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[0].Index != inst->SrcReg[1].Index)
- RETURN_ERROR1("Can't reference two program parameter registers");
-
- /* make sure we don't reference more than one vertex attribute register */
- if (inst->SrcReg[0].File == PROGRAM_INPUT &&
- inst->SrcReg[1].File == PROGRAM_INPUT &&
- inst->SrcReg[0].Index != inst->SrcReg[1].Index)
- RETURN_ERROR1("Can't reference two vertex attribute registers");
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_TriOpInstruction(struct parse_state *parseState,
- struct prog_instruction *inst,
- enum prog_opcode opcode)
-{
- inst->Opcode = opcode;
-
- /* dest reg */
- if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* first src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* second src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* third src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[2]))
- RETURN_ERROR;
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- /* make sure we don't reference more than one program parameter register */
- if ((inst->SrcReg[0].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[1].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[0].Index != inst->SrcReg[1].Index) ||
- (inst->SrcReg[0].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[2].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[0].Index != inst->SrcReg[2].Index) ||
- (inst->SrcReg[1].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[2].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[1].Index != inst->SrcReg[2].Index))
- RETURN_ERROR1("Can only reference one program register");
-
- /* make sure we don't reference more than one vertex attribute register */
- if ((inst->SrcReg[0].File == PROGRAM_INPUT &&
- inst->SrcReg[1].File == PROGRAM_INPUT &&
- inst->SrcReg[0].Index != inst->SrcReg[1].Index) ||
- (inst->SrcReg[0].File == PROGRAM_INPUT &&
- inst->SrcReg[2].File == PROGRAM_INPUT &&
- inst->SrcReg[0].Index != inst->SrcReg[2].Index) ||
- (inst->SrcReg[1].File == PROGRAM_INPUT &&
- inst->SrcReg[2].File == PROGRAM_INPUT &&
- inst->SrcReg[1].Index != inst->SrcReg[2].Index))
- RETURN_ERROR1("Can only reference one input register");
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_ScalarInstruction(struct parse_state *parseState,
- struct prog_instruction *inst,
- enum prog_opcode opcode)
-{
- if (opcode == OPCODE_RCC && !parseState->isVersion1_1)
- RETURN_ERROR1("RCC illegal for vertex program 1.0");
-
- inst->Opcode = opcode;
-
- /* dest reg */
- if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* first src arg */
- if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_AddressInstruction(struct parse_state *parseState, struct prog_instruction *inst)
-{
- inst->Opcode = OPCODE_ARL;
-
- /* Make ARB_vp backends happy */
- inst->DstReg.File = PROGRAM_ADDRESS;
- inst->DstReg.WriteMask = WRITEMASK_X;
- inst->DstReg.Index = 0;
-
- /* dest A0 reg */
- if (!Parse_AddrReg(parseState))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* parse src reg */
- if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_EndInstruction(struct parse_state *parseState, struct prog_instruction *inst)
-{
- GLubyte token[100];
-
- inst->Opcode = OPCODE_END;
-
- /* this should fail! */
- if (Parse_Token(parseState, token))
- RETURN_ERROR2("Unexpected token after END:", token);
- else
- return GL_TRUE;
-}
-
-
-/**
- * The PRINT instruction is Mesa-specific and is meant as a debugging aid for
- * the vertex program developer.
- * The NV_vertex_program extension grammar is modified as follows:
- *
- * <instruction> ::= <ARL-instruction>
- * | ...
- * | <PRINT-instruction>
- *
- * <PRINT-instruction> ::= "PRINT" <string literal>
- * | "PRINT" <string literal> "," <srcReg>
- * | "PRINT" <string literal> "," <dstReg>
- */
-static GLboolean
-Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction *inst)
-{
- const GLubyte *str;
- GLubyte *msg;
- GLuint len;
- GLubyte token[100];
- struct prog_src_register *srcReg = &inst->SrcReg[0];
- GLint idx;
-
- inst->Opcode = OPCODE_PRINT;
-
- /* The first argument is a literal string 'just like this' */
- if (!Parse_String(parseState, "'"))
- RETURN_ERROR;
-
- str = parseState->pos;
- for (len = 0; str[len] != '\''; len++) /* find closing quote */
- ;
- parseState->pos += len + 1;
- msg = (GLubyte*) malloc(len + 1);
-
- memcpy(msg, str, len);
- msg[len] = 0;
- inst->Data = msg;
-
- /* comma */
- if (Parse_String(parseState, ",")) {
-
- /* The second argument is a register name */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- srcReg->RelAddr = GL_FALSE;
- srcReg->Negate = NEGATE_NONE;
- srcReg->Swizzle = SWIZZLE_NOOP;
-
- /* Register can be R<n>, c[n], c[n +/- offset], a named vertex attrib,
- * or an o[n] output register.
- */
- if (token[0] == 'R') {
- srcReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'c') {
- srcReg->File = PROGRAM_ENV_PARAM;
- if (!Parse_ParamReg(parseState, srcReg))
- RETURN_ERROR;
- }
- else if (token[0] == 'v') {
- srcReg->File = PROGRAM_INPUT;
- if (!Parse_AttribReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'o') {
- srcReg->File = PROGRAM_OUTPUT;
- if (!Parse_OutputReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else {
- RETURN_ERROR2("Bad source register name", token);
- }
- }
- else {
- srcReg->File = PROGRAM_UNDEFINED;
- }
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_OptionSequence(struct parse_state *parseState,
- struct prog_instruction program[])
-{
- (void) program;
- while (1) {
- if (!Parse_String(parseState, "OPTION"))
- return GL_TRUE; /* ok, not an OPTION statement */
- if (Parse_String(parseState, "NV_position_invariant")) {
- parseState->isPositionInvariant = GL_TRUE;
- }
- else {
- RETURN_ERROR1("unexpected OPTION statement");
- }
- if (!Parse_String(parseState, ";"))
- return GL_FALSE;
- }
-}
-
-
-static GLboolean
-Parse_InstructionSequence(struct parse_state *parseState,
- struct prog_instruction program[])
-{
- while (1) {
- struct prog_instruction *inst = program + parseState->numInst;
-
- /* Initialize the instruction */
- _mesa_init_instructions(inst, 1);
-
- if (Parse_String(parseState, "MOV")) {
- if (!Parse_UnaryOpInstruction(parseState, inst, OPCODE_MOV))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "LIT")) {
- if (!Parse_UnaryOpInstruction(parseState, inst, OPCODE_LIT))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "ABS")) {
- if (!Parse_UnaryOpInstruction(parseState, inst, OPCODE_ABS))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "MUL")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_MUL))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "ADD")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_ADD))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "DP3")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DP3))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "DP4")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DP4))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "DST")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DST))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "MIN")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_MIN))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "MAX")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_MAX))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "SLT")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_SLT))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "SGE")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_SGE))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "DPH")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DPH))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "SUB")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_SUB))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "MAD")) {
- if (!Parse_TriOpInstruction(parseState, inst, OPCODE_MAD))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "RCP")) {
- if (!Parse_ScalarInstruction(parseState, inst, OPCODE_RCP))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "RSQ")) {
- if (!Parse_ScalarInstruction(parseState, inst, OPCODE_RSQ))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "EXP")) {
- if (!Parse_ScalarInstruction(parseState, inst, OPCODE_EXP))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "LOG")) {
- if (!Parse_ScalarInstruction(parseState, inst, OPCODE_LOG))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "RCC")) {
- if (!Parse_ScalarInstruction(parseState, inst, OPCODE_RCC))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "ARL")) {
- if (!Parse_AddressInstruction(parseState, inst))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "PRINT")) {
- if (!Parse_PrintInstruction(parseState, inst))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "END")) {
- if (!Parse_EndInstruction(parseState, inst))
- RETURN_ERROR;
- else {
- parseState->numInst++;
- return GL_TRUE; /* all done */
- }
- }
- else {
- /* bad instruction name */
- RETURN_ERROR1("Unexpected token");
- }
-
- /* examine input/output registers */
- if (inst->DstReg.File == PROGRAM_OUTPUT)
- parseState->outputsWritten |= (1 << inst->DstReg.Index);
- else if (inst->DstReg.File == PROGRAM_ENV_PARAM)
- parseState->anyProgRegsWritten = GL_TRUE;
-
- if (inst->SrcReg[0].File == PROGRAM_INPUT)
- parseState->inputsRead |= (1 << inst->SrcReg[0].Index);
- if (inst->SrcReg[1].File == PROGRAM_INPUT)
- parseState->inputsRead |= (1 << inst->SrcReg[1].Index);
- if (inst->SrcReg[2].File == PROGRAM_INPUT)
- parseState->inputsRead |= (1 << inst->SrcReg[2].Index);
-
- parseState->numInst++;
-
- if (parseState->numInst >= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS)
- RETURN_ERROR1("Program too long");
- }
-
- RETURN_ERROR;
-}
-
-
-static GLboolean
-Parse_Program(struct parse_state *parseState,
- struct prog_instruction instBuffer[])
-{
- if (parseState->isVersion1_1) {
- if (!Parse_OptionSequence(parseState, instBuffer)) {
- return GL_FALSE;
- }
- }
- return Parse_InstructionSequence(parseState, instBuffer);
-}
-
-
-/**
- * Parse/compile the 'str' returning the compiled 'program'.
- * ctx->Program.ErrorPos will be -1 if successful. Otherwise, ErrorPos
- * indicates the position of the error in 'str'.
- */
-void
-_mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum dstTarget,
- const GLubyte *str, GLsizei len,
- struct gl_vertex_program *program)
-{
- struct parse_state parseState;
- struct prog_instruction instBuffer[MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS];
- struct prog_instruction *newInst;
- GLenum target;
- GLubyte *programString;
-
- /* Make a null-terminated copy of the program string */
- programString = (GLubyte *) MALLOC(len + 1);
- if (!programString) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- memcpy(programString, str, len);
- programString[len] = 0;
-
- /* Get ready to parse */
- parseState.ctx = ctx;
- parseState.start = programString;
- parseState.isPositionInvariant = GL_FALSE;
- parseState.isVersion1_1 = GL_FALSE;
- parseState.numInst = 0;
- parseState.inputsRead = 0;
- parseState.outputsWritten = 0;
- parseState.anyProgRegsWritten = GL_FALSE;
- parseState.indirectRegisterFiles = 0x0;
-
- /* Reset error state */
- _mesa_set_program_error(ctx, -1, NULL);
-
- /* check the program header */
- if (strncmp((const char *) programString, "!!VP1.0", 7) == 0) {
- target = GL_VERTEX_PROGRAM_NV;
- parseState.pos = programString + 7;
- parseState.isStateProgram = GL_FALSE;
- }
- else if (strncmp((const char *) programString, "!!VP1.1", 7) == 0) {
- target = GL_VERTEX_PROGRAM_NV;
- parseState.pos = programString + 7;
- parseState.isStateProgram = GL_FALSE;
- parseState.isVersion1_1 = GL_TRUE;
- }
- else if (strncmp((const char *) programString, "!!VSP1.0", 8) == 0) {
- target = GL_VERTEX_STATE_PROGRAM_NV;
- parseState.pos = programString + 8;
- parseState.isStateProgram = GL_TRUE;
- }
- else {
- /* invalid header */
- ctx->Program.ErrorPos = 0;
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(bad header)");
- return;
- }
-
- /* make sure target and header match */
- if (target != dstTarget) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glLoadProgramNV(target mismatch)");
- return;
- }
-
-
- if (Parse_Program(&parseState, instBuffer)) {
- gl_state_index state_tokens[STATE_LENGTH] = {0, 0, 0, 0, 0};
- int i;
-
- /* successful parse! */
-
- if (parseState.isStateProgram) {
- if (!parseState.anyProgRegsWritten) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glLoadProgramNV(c[#] not written)");
- return;
- }
- }
- else {
- if (!parseState.isPositionInvariant &&
- !(parseState.outputsWritten & (1 << VERT_RESULT_HPOS))) {
- /* bit 1 = HPOS register */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glLoadProgramNV(HPOS not written)");
- return;
- }
- }
-
- /* copy the compiled instructions */
- assert(parseState.numInst <= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS);
- newInst = _mesa_alloc_instructions(parseState.numInst);
- if (!newInst) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- free(programString);
- return; /* out of memory */
- }
- _mesa_copy_instructions(newInst, instBuffer, parseState.numInst);
-
- /* install the program */
- program->Base.Target = target;
- if (program->Base.String) {
- free(program->Base.String);
- }
- program->Base.String = programString;
- program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
- if (program->Base.Instructions) {
- free(program->Base.Instructions);
- }
- program->Base.Instructions = newInst;
- program->Base.InputsRead = parseState.inputsRead;
- if (parseState.isPositionInvariant)
- program->Base.InputsRead |= VERT_BIT_POS;
- program->Base.NumInstructions = parseState.numInst;
- program->Base.OutputsWritten = parseState.outputsWritten;
- program->IsPositionInvariant = parseState.isPositionInvariant;
- program->IsNVProgram = GL_TRUE;
-
-#ifdef DEBUG_foo
- printf("--- glLoadProgramNV result ---\n");
- _mesa_fprint_program_opt(stdout, &program->Base, PROG_PRINT_NV, 0);
- printf("------------------------------\n");
-#endif
-
- if (program->Base.Parameters)
- _mesa_free_parameter_list(program->Base.Parameters);
-
- 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
- * upload everything, _mesa_layout_parameters is the answer.
- */
- for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS; i++) {
- GLint index;
- state_tokens[2] = i;
- index = _mesa_add_state_reference(program->Base.Parameters,
- state_tokens);
- assert(index == i);
- }
- program->Base.NumParameters = program->Base.Parameters->NumParameters;
-
- _mesa_setup_nv_temporary_count(ctx, &program->Base);
- _mesa_emit_nv_temp_initialization(ctx, &program->Base);
- }
- else {
- /* Error! */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV");
- /* NOTE: _mesa_set_program_error would have been called already */
- /* GL_NV_vertex_program isn't supposed to set the error string
- * so we reset it here.
- */
- _mesa_set_program_error(ctx, ctx->Program.ErrorPos, NULL);
- }
-}
-
-
-const char *
-_mesa_nv_vertex_input_register_name(GLuint i)
-{
- ASSERT(i < MAX_NV_VERTEX_PROGRAM_INPUTS);
- return InputRegisters[i];
-}
-
-
-const char *
-_mesa_nv_vertex_output_register_name(GLuint i)
-{
- ASSERT(i < MAX_NV_VERTEX_PROGRAM_OUTPUTS);
- return OutputRegisters[i];
-}
-
diff --git a/src/mesa/program/nvvertparse.h b/src/mesa/program/nvvertparse.h
deleted file mode 100644
index e98e867..0000000
--- a/src/mesa/program/nvvertparse.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 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.
- *
- * Authors:
- * Brian Paul
- */
-
-
-#ifndef NVVERTPARSE_H
-#define NVVERTPARSE_H
-
-#include "main/mtypes.h"
-
-extern void
-_mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum target,
- const GLubyte *str, GLsizei len,
- struct gl_vertex_program *program);
-
-
-extern const char *
-_mesa_nv_vertex_input_register_name(GLuint i);
-
-extern const char *
-_mesa_nv_vertex_output_register_name(GLuint i);
-
-#endif
diff --git a/src/mesa/program/prog_cache.c b/src/mesa/program/prog_cache.c
deleted file mode 100644
index 56ca598..0000000
--- a/src/mesa/program/prog_cache.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/imports.h"
-#include "program/prog_cache.h"
-#include "program/program.h"
-
-
-struct cache_item
-{
- GLuint hash;
- void *key;
- struct gl_program *program;
- struct cache_item *next;
-};
-
-struct gl_program_cache
-{
- struct cache_item **items;
- struct cache_item *last;
- GLuint size, n_items;
-};
-
-
-
-/**
- * Compute hash index from state key.
- */
-static GLuint
-hash_key(const void *key, GLuint key_size)
-{
- const GLuint *ikey = (const GLuint *) key;
- GLuint hash = 0, i;
-
- assert(key_size >= 4);
-
- /* Make a slightly better attempt at a hash function:
- */
- for (i = 0; i < key_size / sizeof(*ikey); i++)
- {
- hash += ikey[i];
- hash += (hash << 10);
- hash ^= (hash >> 6);
- }
-
- return hash;
-}
-
-
-/**
- * Rebuild/expand the hash table to accomodate more entries
- */
-static void
-rehash(struct gl_program_cache *cache)
-{
- struct cache_item **items;
- struct cache_item *c, *next;
- GLuint size, i;
-
- cache->last = NULL;
-
- size = cache->size * 3;
- items = (struct cache_item**) malloc(size * sizeof(*items));
- memset(items, 0, size * sizeof(*items));
-
- for (i = 0; i < cache->size; i++)
- for (c = cache->items[i]; c; c = next) {
- next = c->next;
- c->next = items[c->hash % size];
- items[c->hash % size] = c;
- }
-
- free(cache->items);
- cache->items = items;
- cache->size = size;
-}
-
-
-static void
-clear_cache(struct gl_context *ctx, struct gl_program_cache *cache)
-{
- struct cache_item *c, *next;
- GLuint i;
-
- cache->last = NULL;
-
- for (i = 0; i < cache->size; i++) {
- for (c = cache->items[i]; c; c = next) {
- next = c->next;
- free(c->key);
- _mesa_reference_program(ctx, &c->program, NULL);
- free(c);
- }
- cache->items[i] = NULL;
- }
-
-
- cache->n_items = 0;
-}
-
-
-
-struct gl_program_cache *
-_mesa_new_program_cache(void)
-{
- struct gl_program_cache *cache = CALLOC_STRUCT(gl_program_cache);
- if (cache) {
- cache->size = 17;
- cache->items = (struct cache_item **)
- calloc(1, cache->size * sizeof(struct cache_item));
- if (!cache->items) {
- free(cache);
- return NULL;
- }
- }
- return cache;
-}
-
-
-void
-_mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *cache)
-{
- clear_cache(ctx, cache);
- free(cache->items);
- free(cache);
-}
-
-
-struct gl_program *
-_mesa_search_program_cache(struct gl_program_cache *cache,
- const void *key, GLuint keysize)
-{
- if (cache->last &&
- memcmp(cache->last->key, key, keysize) == 0) {
- return cache->last->program;
- }
- else {
- const GLuint hash = hash_key(key, keysize);
- struct cache_item *c;
-
- for (c = cache->items[hash % cache->size]; c; c = c->next) {
- if (c->hash == hash && memcmp(c->key, key, keysize) == 0) {
- cache->last = c;
- return c->program;
- }
- }
-
- return NULL;
- }
-}
-
-
-void
-_mesa_program_cache_insert(struct gl_context *ctx,
- struct gl_program_cache *cache,
- const void *key, GLuint keysize,
- struct gl_program *program)
-{
- const GLuint hash = hash_key(key, keysize);
- struct cache_item *c = CALLOC_STRUCT(cache_item);
-
- c->hash = hash;
-
- c->key = malloc(keysize);
- memcpy(c->key, key, keysize);
-
- c->program = program; /* no refcount change */
-
- if (cache->n_items > cache->size * 1.5) {
- if (cache->size < 1000)
- rehash(cache);
- else
- clear_cache(ctx, cache);
- }
-
- cache->n_items++;
- c->next = cache->items[hash % cache->size];
- cache->items[hash % cache->size] = c;
-}
diff --git a/src/mesa/program/prog_cache.h b/src/mesa/program/prog_cache.h
deleted file mode 100644
index 4907ae3..0000000
--- a/src/mesa/program/prog_cache.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 PROG_CACHE_H
-#define PROG_CACHE_H
-
-
-#include "main/mtypes.h"
-
-
-/** Opaque type */
-struct gl_program_cache;
-
-
-extern struct gl_program_cache *
-_mesa_new_program_cache(void);
-
-extern void
-_mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *pc);
-
-
-extern struct gl_program *
-_mesa_search_program_cache(struct gl_program_cache *cache,
- const void *key, GLuint keysize);
-
-extern void
-_mesa_program_cache_insert(struct gl_context *ctx,
- struct gl_program_cache *cache,
- const void *key, GLuint keysize,
- struct gl_program *program);
-
-
-#endif /* PROG_CACHE_H */
diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c
deleted file mode 100644
index 1d97a07..0000000
--- a/src/mesa/program/prog_execute.c
+++ /dev/null
@@ -1,1879 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.3
- *
- * 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 prog_execute.c
- * Software interpreter for vertex/fragment programs.
- * \author Brian Paul
- */
-
-/*
- * NOTE: we do everything in single-precision floating point; we don't
- * currently observe the single/half/fixed-precision qualifiers.
- *
- */
-
-
-#include "main/glheader.h"
-#include "main/colormac.h"
-#include "main/macros.h"
-#include "prog_execute.h"
-#include "prog_instruction.h"
-#include "prog_parameter.h"
-#include "prog_print.h"
-#include "prog_noise.h"
-
-
-/* debug predicate */
-#define DEBUG_PROG 0
-
-
-/**
- * Set x to positive or negative infinity.
- */
-#if defined(USE_IEEE) || defined(_WIN32)
-#define SET_POS_INFINITY(x) \
- do { \
- fi_type fi; \
- fi.i = 0x7F800000; \
- x = fi.f; \
- } while (0)
-#define SET_NEG_INFINITY(x) \
- do { \
- fi_type fi; \
- fi.i = 0xFF800000; \
- x = fi.f; \
- } while (0)
-#elif defined(VMS)
-#define SET_POS_INFINITY(x) x = __MAXFLOAT
-#define SET_NEG_INFINITY(x) x = -__MAXFLOAT
-#else
-#define SET_POS_INFINITY(x) x = (GLfloat) HUGE_VAL
-#define SET_NEG_INFINITY(x) x = (GLfloat) -HUGE_VAL
-#endif
-
-#define SET_FLOAT_BITS(x, bits) ((fi_type *) (void *) &(x))->i = bits
-
-
-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.
- */
-static INLINE const GLfloat *
-get_src_register_pointer(const struct prog_src_register *source,
- const struct gl_program_machine *machine)
-{
- const struct gl_program *prog = machine->CurProgram;
- GLint reg = source->Index;
-
- if (source->RelAddr) {
- /* add address register value to src index/offset */
- reg += machine->AddressReg[0][0];
- if (reg < 0) {
- return ZeroVec;
- }
- }
-
- switch (source->File) {
- case PROGRAM_TEMPORARY:
- if (reg >= MAX_PROGRAM_TEMPS)
- return ZeroVec;
- return machine->Temporaries[reg];
-
- case PROGRAM_INPUT:
- if (prog->Target == GL_VERTEX_PROGRAM_ARB) {
- if (reg >= VERT_ATTRIB_MAX)
- return ZeroVec;
- return machine->VertAttribs[reg];
- }
- else {
- if (reg >= FRAG_ATTRIB_MAX)
- return ZeroVec;
- return machine->Attribs[reg][machine->CurElement];
- }
-
- case PROGRAM_OUTPUT:
- if (reg >= MAX_PROGRAM_OUTPUTS)
- return ZeroVec;
- return machine->Outputs[reg];
-
- case PROGRAM_LOCAL_PARAM:
- if (reg >= MAX_PROGRAM_LOCAL_PARAMS)
- return ZeroVec;
- return machine->CurProgram->LocalParams[reg];
-
- case PROGRAM_ENV_PARAM:
- if (reg >= MAX_PROGRAM_ENV_PARAMS)
- return ZeroVec;
- return machine->EnvParams[reg];
-
- case PROGRAM_STATE_VAR:
- /* Fallthrough */
- case PROGRAM_CONSTANT:
- /* Fallthrough */
- case PROGRAM_UNIFORM:
- /* Fallthrough */
- case PROGRAM_NAMED_PARAM:
- if (reg >= (GLint) prog->Parameters->NumParameters)
- return ZeroVec;
- return prog->Parameters->ParameterValues[reg];
-
- default:
- _mesa_problem(NULL,
- "Invalid src register file %d in get_src_register_pointer()",
- source->File);
- return NULL;
- }
-}
-
-
-/**
- * Return a pointer to the 4-element float vector specified by the given
- * destination register.
- */
-static INLINE GLfloat *
-get_dst_register_pointer(const struct prog_dst_register *dest,
- struct gl_program_machine *machine)
-{
- static GLfloat dummyReg[4];
- GLint reg = dest->Index;
-
- if (dest->RelAddr) {
- /* add address register value to src index/offset */
- reg += machine->AddressReg[0][0];
- if (reg < 0) {
- return dummyReg;
- }
- }
-
- switch (dest->File) {
- case PROGRAM_TEMPORARY:
- if (reg >= MAX_PROGRAM_TEMPS)
- return dummyReg;
- return machine->Temporaries[reg];
-
- case PROGRAM_OUTPUT:
- if (reg >= MAX_PROGRAM_OUTPUTS)
- return dummyReg;
- return machine->Outputs[reg];
-
- case PROGRAM_WRITE_ONLY:
- return dummyReg;
-
- default:
- _mesa_problem(NULL,
- "Invalid dest register file %d in get_dst_register_pointer()",
- dest->File);
- return NULL;
- }
-}
-
-
-
-/**
- * Fetch a 4-element float vector from the given source register.
- * Apply swizzling and negating as needed.
- */
-static void
-fetch_vector4(const struct prog_src_register *source,
- const struct gl_program_machine *machine, GLfloat result[4])
-{
- const GLfloat *src = get_src_register_pointer(source, machine);
- ASSERT(src);
-
- if (source->Swizzle == SWIZZLE_NOOP) {
- /* no swizzling */
- COPY_4V(result, src);
- }
- else {
- ASSERT(GET_SWZ(source->Swizzle, 0) <= 3);
- ASSERT(GET_SWZ(source->Swizzle, 1) <= 3);
- ASSERT(GET_SWZ(source->Swizzle, 2) <= 3);
- ASSERT(GET_SWZ(source->Swizzle, 3) <= 3);
- result[0] = src[GET_SWZ(source->Swizzle, 0)];
- result[1] = src[GET_SWZ(source->Swizzle, 1)];
- result[2] = src[GET_SWZ(source->Swizzle, 2)];
- result[3] = src[GET_SWZ(source->Swizzle, 3)];
- }
-
- if (source->Abs) {
- result[0] = FABSF(result[0]);
- result[1] = FABSF(result[1]);
- result[2] = FABSF(result[2]);
- result[3] = FABSF(result[3]);
- }
- if (source->Negate) {
- ASSERT(source->Negate == NEGATE_XYZW);
- result[0] = -result[0];
- result[1] = -result[1];
- result[2] = -result[2];
- result[3] = -result[3];
- }
-
-#ifdef NAN_CHECK
- assert(!IS_INF_OR_NAN(result[0]));
- assert(!IS_INF_OR_NAN(result[0]));
- assert(!IS_INF_OR_NAN(result[0]));
- assert(!IS_INF_OR_NAN(result[0]));
-#endif
-}
-
-
-/**
- * Fetch a 4-element uint vector from the given source register.
- * Apply swizzling but not negation/abs.
- */
-static void
-fetch_vector4ui(const struct prog_src_register *source,
- const struct gl_program_machine *machine, GLuint result[4])
-{
- const GLuint *src = (GLuint *) get_src_register_pointer(source, machine);
- ASSERT(src);
-
- if (source->Swizzle == SWIZZLE_NOOP) {
- /* no swizzling */
- COPY_4V(result, src);
- }
- else {
- ASSERT(GET_SWZ(source->Swizzle, 0) <= 3);
- ASSERT(GET_SWZ(source->Swizzle, 1) <= 3);
- ASSERT(GET_SWZ(source->Swizzle, 2) <= 3);
- ASSERT(GET_SWZ(source->Swizzle, 3) <= 3);
- result[0] = src[GET_SWZ(source->Swizzle, 0)];
- result[1] = src[GET_SWZ(source->Swizzle, 1)];
- result[2] = src[GET_SWZ(source->Swizzle, 2)];
- result[3] = src[GET_SWZ(source->Swizzle, 3)];
- }
-
- /* Note: no Negate or Abs here */
-}
-
-
-
-/**
- * Fetch the derivative with respect to X or Y for the given register.
- * XXX this currently only works for fragment program input attribs.
- */
-static void
-fetch_vector4_deriv(struct gl_context * ctx,
- const struct prog_src_register *source,
- const struct gl_program_machine *machine,
- char xOrY, GLfloat result[4])
-{
- if (source->File == PROGRAM_INPUT &&
- source->Index < (GLint) machine->NumDeriv) {
- const GLint col = machine->CurElement;
- const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3];
- const GLfloat invQ = 1.0f / w;
- GLfloat deriv[4];
-
- if (xOrY == 'X') {
- deriv[0] = machine->DerivX[source->Index][0] * invQ;
- deriv[1] = machine->DerivX[source->Index][1] * invQ;
- deriv[2] = machine->DerivX[source->Index][2] * invQ;
- deriv[3] = machine->DerivX[source->Index][3] * invQ;
- }
- else {
- deriv[0] = machine->DerivY[source->Index][0] * invQ;
- deriv[1] = machine->DerivY[source->Index][1] * invQ;
- deriv[2] = machine->DerivY[source->Index][2] * invQ;
- deriv[3] = machine->DerivY[source->Index][3] * invQ;
- }
-
- result[0] = deriv[GET_SWZ(source->Swizzle, 0)];
- result[1] = deriv[GET_SWZ(source->Swizzle, 1)];
- result[2] = deriv[GET_SWZ(source->Swizzle, 2)];
- result[3] = deriv[GET_SWZ(source->Swizzle, 3)];
-
- if (source->Abs) {
- result[0] = FABSF(result[0]);
- result[1] = FABSF(result[1]);
- result[2] = FABSF(result[2]);
- result[3] = FABSF(result[3]);
- }
- if (source->Negate) {
- ASSERT(source->Negate == NEGATE_XYZW);
- result[0] = -result[0];
- result[1] = -result[1];
- result[2] = -result[2];
- result[3] = -result[3];
- }
- }
- else {
- ASSIGN_4V(result, 0.0, 0.0, 0.0, 0.0);
- }
-}
-
-
-/**
- * As above, but only return result[0] element.
- */
-static void
-fetch_vector1(const struct prog_src_register *source,
- const struct gl_program_machine *machine, GLfloat result[4])
-{
- const GLfloat *src = get_src_register_pointer(source, machine);
- ASSERT(src);
-
- result[0] = src[GET_SWZ(source->Swizzle, 0)];
-
- if (source->Abs) {
- result[0] = FABSF(result[0]);
- }
- if (source->Negate) {
- result[0] = -result[0];
- }
-}
-
-
-static GLuint
-fetch_vector1ui(const struct prog_src_register *source,
- const struct gl_program_machine *machine)
-{
- const GLuint *src = (GLuint *) get_src_register_pointer(source, machine);
- return src[GET_SWZ(source->Swizzle, 0)];
-}
-
-
-/**
- * Fetch texel from texture. Use partial derivatives when possible.
- */
-static INLINE void
-fetch_texel(struct gl_context *ctx,
- const struct gl_program_machine *machine,
- const struct prog_instruction *inst,
- const GLfloat texcoord[4], GLfloat lodBias,
- GLfloat color[4])
-{
- const GLuint unit = machine->Samplers[inst->TexSrcUnit];
-
- /* Note: we only have the right derivatives for fragment input attribs.
- */
- if (machine->NumDeriv > 0 &&
- inst->SrcReg[0].File == PROGRAM_INPUT &&
- inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) {
- /* simple texture fetch for which we should have derivatives */
- GLuint attr = inst->SrcReg[0].Index;
- machine->FetchTexelDeriv(ctx, texcoord,
- machine->DerivX[attr],
- machine->DerivY[attr],
- lodBias, unit, color);
- }
- else {
- machine->FetchTexelLod(ctx, texcoord, lodBias, unit, color);
- }
-}
-
-
-/**
- * Test value against zero and return GT, LT, EQ or UN if NaN.
- */
-static INLINE GLuint
-generate_cc(float value)
-{
- if (value != value)
- return COND_UN; /* NaN */
- if (value > 0.0F)
- return COND_GT;
- if (value < 0.0F)
- return COND_LT;
- return COND_EQ;
-}
-
-
-/**
- * Test if the ccMaskRule is satisfied by the given condition code.
- * Used to mask destination writes according to the current condition code.
- */
-static INLINE GLboolean
-test_cc(GLuint condCode, GLuint ccMaskRule)
-{
- switch (ccMaskRule) {
- case COND_EQ: return (condCode == COND_EQ);
- case COND_NE: return (condCode != COND_EQ);
- case COND_LT: return (condCode == COND_LT);
- case COND_GE: return (condCode == COND_GT || condCode == COND_EQ);
- case COND_LE: return (condCode == COND_LT || condCode == COND_EQ);
- case COND_GT: return (condCode == COND_GT);
- case COND_TR: return GL_TRUE;
- case COND_FL: return GL_FALSE;
- default: return GL_TRUE;
- }
-}
-
-
-/**
- * Evaluate the 4 condition codes against a predicate and return GL_TRUE
- * or GL_FALSE to indicate result.
- */
-static INLINE GLboolean
-eval_condition(const struct gl_program_machine *machine,
- const struct prog_instruction *inst)
-{
- const GLuint swizzle = inst->DstReg.CondSwizzle;
- const GLuint condMask = inst->DstReg.CondMask;
- if (test_cc(machine->CondCodes[GET_SWZ(swizzle, 0)], condMask) ||
- test_cc(machine->CondCodes[GET_SWZ(swizzle, 1)], condMask) ||
- test_cc(machine->CondCodes[GET_SWZ(swizzle, 2)], condMask) ||
- test_cc(machine->CondCodes[GET_SWZ(swizzle, 3)], condMask)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-
-
-/**
- * Store 4 floats into a register. Observe the instructions saturate and
- * set-condition-code flags.
- */
-static void
-store_vector4(const struct prog_instruction *inst,
- struct gl_program_machine *machine, const GLfloat value[4])
-{
- const struct prog_dst_register *dstReg = &(inst->DstReg);
- const GLboolean clamp = inst->SaturateMode == SATURATE_ZERO_ONE;
- GLuint writeMask = dstReg->WriteMask;
- GLfloat clampedValue[4];
- GLfloat *dst = get_dst_register_pointer(dstReg, machine);
-
-#if 0
- if (value[0] > 1.0e10 ||
- IS_INF_OR_NAN(value[0]) ||
- IS_INF_OR_NAN(value[1]) ||
- IS_INF_OR_NAN(value[2]) || IS_INF_OR_NAN(value[3]))
- printf("store %g %g %g %g\n", value[0], value[1], value[2], value[3]);
-#endif
-
- if (clamp) {
- clampedValue[0] = CLAMP(value[0], 0.0F, 1.0F);
- clampedValue[1] = CLAMP(value[1], 0.0F, 1.0F);
- clampedValue[2] = CLAMP(value[2], 0.0F, 1.0F);
- clampedValue[3] = CLAMP(value[3], 0.0F, 1.0F);
- value = clampedValue;
- }
-
- if (dstReg->CondMask != COND_TR) {
- /* condition codes may turn off some writes */
- if (writeMask & WRITEMASK_X) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 0)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_X;
- }
- if (writeMask & WRITEMASK_Y) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 1)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_Y;
- }
- if (writeMask & WRITEMASK_Z) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 2)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_Z;
- }
- if (writeMask & WRITEMASK_W) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 3)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_W;
- }
- }
-
-#ifdef NAN_CHECK
- assert(!IS_INF_OR_NAN(value[0]));
- assert(!IS_INF_OR_NAN(value[0]));
- assert(!IS_INF_OR_NAN(value[0]));
- assert(!IS_INF_OR_NAN(value[0]));
-#endif
-
- if (writeMask & WRITEMASK_X)
- dst[0] = value[0];
- if (writeMask & WRITEMASK_Y)
- dst[1] = value[1];
- if (writeMask & WRITEMASK_Z)
- dst[2] = value[2];
- if (writeMask & WRITEMASK_W)
- dst[3] = value[3];
-
- if (inst->CondUpdate) {
- if (writeMask & WRITEMASK_X)
- machine->CondCodes[0] = generate_cc(value[0]);
- if (writeMask & WRITEMASK_Y)
- machine->CondCodes[1] = generate_cc(value[1]);
- if (writeMask & WRITEMASK_Z)
- machine->CondCodes[2] = generate_cc(value[2]);
- if (writeMask & WRITEMASK_W)
- machine->CondCodes[3] = generate_cc(value[3]);
-#if DEBUG_PROG
- printf("CondCodes=(%s,%s,%s,%s) for:\n",
- _mesa_condcode_string(machine->CondCodes[0]),
- _mesa_condcode_string(machine->CondCodes[1]),
- _mesa_condcode_string(machine->CondCodes[2]),
- _mesa_condcode_string(machine->CondCodes[3]));
-#endif
- }
-}
-
-
-/**
- * Store 4 uints into a register. Observe the set-condition-code flags.
- */
-static void
-store_vector4ui(const struct prog_instruction *inst,
- struct gl_program_machine *machine, const GLuint value[4])
-{
- const struct prog_dst_register *dstReg = &(inst->DstReg);
- GLuint writeMask = dstReg->WriteMask;
- GLuint *dst = (GLuint *) get_dst_register_pointer(dstReg, machine);
-
- if (dstReg->CondMask != COND_TR) {
- /* condition codes may turn off some writes */
- if (writeMask & WRITEMASK_X) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 0)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_X;
- }
- if (writeMask & WRITEMASK_Y) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 1)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_Y;
- }
- if (writeMask & WRITEMASK_Z) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 2)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_Z;
- }
- if (writeMask & WRITEMASK_W) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 3)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_W;
- }
- }
-
- if (writeMask & WRITEMASK_X)
- dst[0] = value[0];
- if (writeMask & WRITEMASK_Y)
- dst[1] = value[1];
- if (writeMask & WRITEMASK_Z)
- dst[2] = value[2];
- if (writeMask & WRITEMASK_W)
- dst[3] = value[3];
-
- if (inst->CondUpdate) {
- if (writeMask & WRITEMASK_X)
- machine->CondCodes[0] = generate_cc((float)value[0]);
- if (writeMask & WRITEMASK_Y)
- machine->CondCodes[1] = generate_cc((float)value[1]);
- if (writeMask & WRITEMASK_Z)
- machine->CondCodes[2] = generate_cc((float)value[2]);
- if (writeMask & WRITEMASK_W)
- machine->CondCodes[3] = generate_cc((float)value[3]);
-#if DEBUG_PROG
- printf("CondCodes=(%s,%s,%s,%s) for:\n",
- _mesa_condcode_string(machine->CondCodes[0]),
- _mesa_condcode_string(machine->CondCodes[1]),
- _mesa_condcode_string(machine->CondCodes[2]),
- _mesa_condcode_string(machine->CondCodes[3]));
-#endif
- }
-}
-
-
-
-/**
- * Execute the given vertex/fragment program.
- *
- * \param ctx rendering context
- * \param program the program to execute
- * \param machine machine state (must be initialized)
- * \return GL_TRUE if program completed or GL_FALSE if program executed KIL.
- */
-GLboolean
-_mesa_execute_program(struct gl_context * ctx,
- const struct gl_program *program,
- struct gl_program_machine *machine)
-{
- const GLuint numInst = program->NumInstructions;
- const GLuint maxExec = 10000;
- GLuint pc, numExec = 0;
-
- machine->CurProgram = program;
-
- if (DEBUG_PROG) {
- printf("execute program %u --------------------\n", program->Id);
- }
-
- if (program->Target == GL_VERTEX_PROGRAM_ARB) {
- machine->EnvParams = ctx->VertexProgram.Parameters;
- }
- else {
- machine->EnvParams = ctx->FragmentProgram.Parameters;
- }
-
- for (pc = 0; pc < numInst; pc++) {
- const struct prog_instruction *inst = program->Instructions + pc;
-
- if (DEBUG_PROG) {
- _mesa_print_instruction(inst);
- }
-
- switch (inst->Opcode) {
- case OPCODE_ABS:
- {
- GLfloat a[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] = FABSF(a[0]);
- result[1] = FABSF(a[1]);
- result[2] = FABSF(a[2]);
- result[3] = FABSF(a[3]);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_ADD:
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = a[0] + b[0];
- result[1] = a[1] + b[1];
- result[2] = a[2] + b[2];
- result[3] = a[3] + b[3];
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("ADD (%g %g %g %g) = (%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]);
- }
- }
- break;
- case OPCODE_AND: /* bitwise AND */
- {
- GLuint a[4], b[4], result[4];
- fetch_vector4ui(&inst->SrcReg[0], machine, a);
- fetch_vector4ui(&inst->SrcReg[1], machine, b);
- result[0] = a[0] & b[0];
- result[1] = a[1] & b[1];
- result[2] = a[2] & b[2];
- result[3] = a[3] & b[3];
- store_vector4ui(inst, machine, result);
- }
- break;
- case OPCODE_ARL:
- {
- GLfloat t[4];
- fetch_vector4(&inst->SrcReg[0], machine, t);
- machine->AddressReg[0][0] = IFLOOR(t[0]);
- if (DEBUG_PROG) {
- printf("ARL %d\n", machine->AddressReg[0][0]);
- }
- }
- break;
- case OPCODE_BGNLOOP:
- /* no-op */
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
- == OPCODE_ENDLOOP);
- break;
- case OPCODE_ENDLOOP:
- /* subtract 1 here since pc is incremented by for(pc) loop */
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
- == OPCODE_BGNLOOP);
- pc = inst->BranchTarget - 1; /* go to matching BNGLOOP */
- break;
- case OPCODE_BGNSUB: /* begin subroutine */
- break;
- case OPCODE_ENDSUB: /* end subroutine */
- break;
- case OPCODE_BRA: /* branch (conditional) */
- if (eval_condition(machine, inst)) {
- /* take branch */
- /* Subtract 1 here since we'll do pc++ below */
- pc = inst->BranchTarget - 1;
- }
- break;
- case OPCODE_BRK: /* break out of loop (conditional) */
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
- == OPCODE_ENDLOOP);
- if (eval_condition(machine, inst)) {
- /* break out of loop */
- /* pc++ at end of for-loop will put us after the ENDLOOP inst */
- pc = inst->BranchTarget;
- }
- break;
- case OPCODE_CONT: /* continue loop (conditional) */
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
- == OPCODE_ENDLOOP);
- if (eval_condition(machine, inst)) {
- /* continue at ENDLOOP */
- /* Subtract 1 here since we'll do pc++ at end of for-loop */
- pc = inst->BranchTarget - 1;
- }
- break;
- case OPCODE_CAL: /* Call subroutine (conditional) */
- if (eval_condition(machine, inst)) {
- /* call the subroutine */
- if (machine->StackDepth >= MAX_PROGRAM_CALL_DEPTH) {
- return GL_TRUE; /* Per GL_NV_vertex_program2 spec */
- }
- machine->CallStack[machine->StackDepth++] = pc + 1; /* next inst */
- /* Subtract 1 here since we'll do pc++ at end of for-loop */
- pc = inst->BranchTarget - 1;
- }
- break;
- case OPCODE_CMP:
- {
- GLfloat a[4], b[4], c[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- fetch_vector4(&inst->SrcReg[2], machine, c);
- result[0] = a[0] < 0.0F ? b[0] : c[0];
- result[1] = a[1] < 0.0F ? b[1] : c[1];
- 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:
- {
- GLfloat a[4], result[4];
- fetch_vector1(&inst->SrcReg[0], machine, a);
- result[0] = result[1] = result[2] = result[3]
- = (GLfloat) cos(a[0]);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_DDX: /* Partial derivative with respect to X */
- {
- GLfloat result[4];
- fetch_vector4_deriv(ctx, &inst->SrcReg[0], machine,
- 'X', result);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_DDY: /* Partial derivative with respect to Y */
- {
- GLfloat result[4];
- fetch_vector4_deriv(ctx, &inst->SrcReg[0], machine,
- 'Y', result);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_DP2:
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = result[1] = result[2] = result[3] = DOT2(a, b);
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("DP2 %g = (%g %g) . (%g %g)\n",
- result[0], a[0], a[1], b[0], b[1]);
- }
- }
- break;
- case OPCODE_DP2A:
- {
- GLfloat a[4], b[4], c, result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- fetch_vector1(&inst->SrcReg[1], machine, &c);
- result[0] = result[1] = result[2] = result[3] = DOT2(a, b) + c;
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("DP2A %g = (%g %g) . (%g %g) + %g\n",
- result[0], a[0], a[1], b[0], b[1], c);
- }
- }
- break;
- case OPCODE_DP3:
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = result[1] = result[2] = result[3] = DOT3(a, b);
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("DP3 %g = (%g %g %g) . (%g %g %g)\n",
- result[0], a[0], a[1], a[2], b[0], b[1], b[2]);
- }
- }
- break;
- case OPCODE_DP4:
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = result[1] = result[2] = result[3] = DOT4(a, b);
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("DP4 %g = (%g, %g %g %g) . (%g, %g %g %g)\n",
- result[0], a[0], a[1], a[2], a[3],
- b[0], b[1], b[2], b[3]);
- }
- }
- break;
- case OPCODE_DPH:
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = result[1] = result[2] = result[3] = DOT3(a, b) + b[3];
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_DST: /* Distance vector */
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = 1.0F;
- result[1] = a[1] * b[1];
- result[2] = a[2];
- result[3] = b[3];
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_EXP:
- {
- GLfloat t[4], q[4], floor_t0;
- fetch_vector1(&inst->SrcReg[0], machine, t);
- floor_t0 = FLOORF(t[0]);
- if (floor_t0 > FLT_MAX_EXP) {
- SET_POS_INFINITY(q[0]);
- SET_POS_INFINITY(q[2]);
- }
- else if (floor_t0 < FLT_MIN_EXP) {
- q[0] = 0.0F;
- q[2] = 0.0F;
- }
- else {
- q[0] = LDEXPF(1.0, (int) floor_t0);
- /* Note: GL_NV_vertex_program expects
- * result.z = result.x * APPX(result.y)
- * We do what the ARB extension says.
- */
- q[2] = (GLfloat) pow(2.0, t[0]);
- }
- q[1] = t[0] - floor_t0;
- q[3] = 1.0F;
- store_vector4( inst, machine, q );
- }
- break;
- case OPCODE_EX2: /* Exponential base 2 */
- {
- GLfloat a[4], result[4], val;
- fetch_vector1(&inst->SrcReg[0], machine, a);
- val = (GLfloat) pow(2.0, a[0]);
- /*
- if (IS_INF_OR_NAN(val))
- val = 1.0e10;
- */
- result[0] = result[1] = result[2] = result[3] = val;
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_FLR:
- {
- GLfloat a[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] = FLOORF(a[0]);
- result[1] = FLOORF(a[1]);
- result[2] = FLOORF(a[2]);
- result[3] = FLOORF(a[3]);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_FRC:
- {
- GLfloat a[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] = a[0] - FLOORF(a[0]);
- result[1] = a[1] - FLOORF(a[1]);
- result[2] = a[2] - FLOORF(a[2]);
- result[3] = a[3] - FLOORF(a[3]);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_IF:
- {
- GLboolean cond;
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
- == OPCODE_ELSE ||
- program->Instructions[inst->BranchTarget].Opcode
- == OPCODE_ENDIF);
- /* eval condition */
- if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
- GLfloat a[4];
- fetch_vector1(&inst->SrcReg[0], machine, a);
- cond = (a[0] != 0.0);
- }
- else {
- cond = eval_condition(machine, inst);
- }
- if (DEBUG_PROG) {
- printf("IF: %d\n", cond);
- }
- /* do if/else */
- if (cond) {
- /* do if-clause (just continue execution) */
- }
- else {
- /* go to the instruction after ELSE or ENDIF */
- assert(inst->BranchTarget >= 0);
- pc = inst->BranchTarget;
- }
- }
- break;
- case OPCODE_ELSE:
- /* goto ENDIF */
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
- == OPCODE_ENDIF);
- assert(inst->BranchTarget >= 0);
- pc = inst->BranchTarget;
- break;
- case OPCODE_ENDIF:
- /* nothing */
- break;
- case OPCODE_KIL_NV: /* NV_f_p only (conditional) */
- if (eval_condition(machine, inst)) {
- return GL_FALSE;
- }
- break;
- case OPCODE_KIL: /* ARB_f_p only */
- {
- GLfloat a[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- if (DEBUG_PROG) {
- printf("KIL if (%g %g %g %g) <= 0.0\n",
- a[0], a[1], a[2], a[3]);
- }
-
- if (a[0] < 0.0F || a[1] < 0.0F || a[2] < 0.0F || a[3] < 0.0F) {
- return GL_FALSE;
- }
- }
- break;
- case OPCODE_LG2: /* log base 2 */
- {
- GLfloat a[4], result[4], val;
- fetch_vector1(&inst->SrcReg[0], machine, a);
- /* The fast LOG2 macro doesn't meet the precision requirements.
- */
- if (a[0] == 0.0F) {
- val = -FLT_MAX;
- }
- else {
- val = (float)(log(a[0]) * 1.442695F);
- }
- result[0] = result[1] = result[2] = result[3] = val;
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_LIT:
- {
- const GLfloat epsilon = 1.0F / 256.0F; /* from NV VP spec */
- GLfloat a[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- a[0] = MAX2(a[0], 0.0F);
- a[1] = MAX2(a[1], 0.0F);
- /* XXX ARB version clamps a[3], NV version doesn't */
- a[3] = CLAMP(a[3], -(128.0F - epsilon), (128.0F - epsilon));
- result[0] = 1.0F;
- result[1] = a[0];
- /* XXX we could probably just use pow() here */
- if (a[0] > 0.0F) {
- if (a[1] == 0.0 && a[3] == 0.0)
- result[2] = 1.0F;
- else
- result[2] = (GLfloat) pow(a[1], a[3]);
- }
- else {
- result[2] = 0.0F;
- }
- result[3] = 1.0F;
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("LIT (%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]);
- }
- }
- break;
- case OPCODE_LOG:
- {
- GLfloat t[4], q[4], abs_t0;
- fetch_vector1(&inst->SrcReg[0], machine, t);
- abs_t0 = FABSF(t[0]);
- if (abs_t0 != 0.0F) {
- /* Since we really can't handle infinite values on VMS
- * like other OSes we'll use __MAXFLOAT to represent
- * infinity. This may need some tweaking.
- */
-#ifdef VMS
- if (abs_t0 == __MAXFLOAT)
-#else
- if (IS_INF_OR_NAN(abs_t0))
-#endif
- {
- SET_POS_INFINITY(q[0]);
- q[1] = 1.0F;
- SET_POS_INFINITY(q[2]);
- }
- else {
- int exponent;
- GLfloat mantissa = FREXPF(t[0], &exponent);
- q[0] = (GLfloat) (exponent - 1);
- q[1] = (GLfloat) (2.0 * mantissa); /* map [.5, 1) -> [1, 2) */
-
- /* The fast LOG2 macro doesn't meet the precision
- * requirements.
- */
- q[2] = (float)(log(t[0]) * 1.442695F);
- }
- }
- else {
- SET_NEG_INFINITY(q[0]);
- q[1] = 1.0F;
- SET_NEG_INFINITY(q[2]);
- }
- q[3] = 1.0;
- store_vector4(inst, machine, q);
- }
- break;
- case OPCODE_LRP:
- {
- GLfloat a[4], b[4], c[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- fetch_vector4(&inst->SrcReg[2], machine, c);
- result[0] = a[0] * b[0] + (1.0F - a[0]) * c[0];
- result[1] = a[1] * b[1] + (1.0F - a[1]) * c[1];
- result[2] = a[2] * b[2] + (1.0F - a[2]) * c[2];
- result[3] = a[3] * b[3] + (1.0F - a[3]) * c[3];
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("LRP (%g %g %g %g) = (%g %g %g %g), "
- "(%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_MAD:
- {
- GLfloat a[4], b[4], c[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- fetch_vector4(&inst->SrcReg[2], machine, c);
- result[0] = a[0] * b[0] + c[0];
- result[1] = a[1] * b[1] + c[1];
- result[2] = a[2] * b[2] + c[2];
- result[3] = a[3] * b[3] + c[3];
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("MAD (%g %g %g %g) = (%g %g %g %g) * "
- "(%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_MAX:
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = MAX2(a[0], b[0]);
- result[1] = MAX2(a[1], b[1]);
- result[2] = MAX2(a[2], b[2]);
- result[3] = MAX2(a[3], b[3]);
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("MAX (%g %g %g %g) = (%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]);
- }
- }
- break;
- case OPCODE_MIN:
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = MIN2(a[0], b[0]);
- result[1] = MIN2(a[1], b[1]);
- result[2] = MIN2(a[2], b[2]);
- result[3] = MIN2(a[3], b[3]);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_MOV:
- {
- GLfloat result[4];
- fetch_vector4(&inst->SrcReg[0], machine, result);
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("MOV (%g %g %g %g)\n",
- result[0], result[1], result[2], result[3]);
- }
- }
- break;
- case OPCODE_MUL:
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = a[0] * b[0];
- result[1] = a[1] * b[1];
- result[2] = a[2] * b[2];
- result[3] = a[3] * b[3];
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("MUL (%g %g %g %g) = (%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]);
- }
- }
- break;
- case OPCODE_NOISE1:
- {
- GLfloat a[4], result[4];
- fetch_vector1(&inst->SrcReg[0], machine, a);
- result[0] =
- result[1] =
- result[2] =
- result[3] = _mesa_noise1(a[0]);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_NOISE2:
- {
- GLfloat a[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] =
- result[1] =
- result[2] = result[3] = _mesa_noise2(a[0], a[1]);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_NOISE3:
- {
- GLfloat a[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] =
- result[1] =
- result[2] =
- result[3] = _mesa_noise3(a[0], a[1], a[2]);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_NOISE4:
- {
- GLfloat a[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] =
- result[1] =
- result[2] =
- result[3] = _mesa_noise4(a[0], a[1], a[2], a[3]);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_NOP:
- break;
- case OPCODE_NOT: /* bitwise NOT */
- {
- GLuint a[4], result[4];
- fetch_vector4ui(&inst->SrcReg[0], machine, a);
- result[0] = ~a[0];
- result[1] = ~a[1];
- result[2] = ~a[2];
- result[3] = ~a[3];
- store_vector4ui(inst, machine, result);
- }
- break;
- case OPCODE_NRM3: /* 3-component normalization */
- {
- GLfloat a[4], result[4];
- GLfloat tmp;
- fetch_vector4(&inst->SrcReg[0], machine, a);
- tmp = a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
- if (tmp != 0.0F)
- tmp = INV_SQRTF(tmp);
- result[0] = tmp * a[0];
- result[1] = tmp * a[1];
- result[2] = tmp * a[2];
- result[3] = 0.0; /* undefined, but prevent valgrind warnings */
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_NRM4: /* 4-component normalization */
- {
- GLfloat a[4], result[4];
- GLfloat tmp;
- fetch_vector4(&inst->SrcReg[0], machine, a);
- tmp = a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3];
- if (tmp != 0.0F)
- tmp = INV_SQRTF(tmp);
- result[0] = tmp * a[0];
- result[1] = tmp * a[1];
- result[2] = tmp * a[2];
- result[3] = tmp * a[3];
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_OR: /* bitwise OR */
- {
- GLuint a[4], b[4], result[4];
- fetch_vector4ui(&inst->SrcReg[0], machine, a);
- fetch_vector4ui(&inst->SrcReg[1], machine, b);
- result[0] = a[0] | b[0];
- result[1] = a[1] | b[1];
- result[2] = a[2] | b[2];
- result[3] = a[3] | b[3];
- store_vector4ui(inst, machine, result);
- }
- break;
- case OPCODE_PK2H: /* pack two 16-bit floats in one 32-bit float */
- {
- GLfloat a[4];
- GLuint result[4];
- GLhalfNV hx, hy;
- fetch_vector4(&inst->SrcReg[0], machine, a);
- hx = _mesa_float_to_half(a[0]);
- hy = _mesa_float_to_half(a[1]);
- result[0] =
- result[1] =
- result[2] =
- result[3] = hx | (hy << 16);
- store_vector4ui(inst, machine, result);
- }
- break;
- case OPCODE_PK2US: /* pack two GLushorts into one 32-bit float */
- {
- GLfloat a[4];
- GLuint result[4], usx, usy;
- fetch_vector4(&inst->SrcReg[0], machine, a);
- a[0] = CLAMP(a[0], 0.0F, 1.0F);
- a[1] = CLAMP(a[1], 0.0F, 1.0F);
- usx = IROUND(a[0] * 65535.0F);
- usy = IROUND(a[1] * 65535.0F);
- result[0] =
- result[1] =
- result[2] =
- result[3] = usx | (usy << 16);
- store_vector4ui(inst, machine, result);
- }
- break;
- case OPCODE_PK4B: /* pack four GLbytes into one 32-bit float */
- {
- GLfloat a[4];
- GLuint result[4], ubx, uby, ubz, ubw;
- fetch_vector4(&inst->SrcReg[0], machine, a);
- a[0] = CLAMP(a[0], -128.0F / 127.0F, 1.0F);
- a[1] = CLAMP(a[1], -128.0F / 127.0F, 1.0F);
- a[2] = CLAMP(a[2], -128.0F / 127.0F, 1.0F);
- a[3] = CLAMP(a[3], -128.0F / 127.0F, 1.0F);
- ubx = IROUND(127.0F * a[0] + 128.0F);
- uby = IROUND(127.0F * a[1] + 128.0F);
- ubz = IROUND(127.0F * a[2] + 128.0F);
- ubw = IROUND(127.0F * a[3] + 128.0F);
- result[0] =
- result[1] =
- result[2] =
- result[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24);
- store_vector4ui(inst, machine, result);
- }
- break;
- case OPCODE_PK4UB: /* pack four GLubytes into one 32-bit float */
- {
- GLfloat a[4];
- GLuint result[4], ubx, uby, ubz, ubw;
- fetch_vector4(&inst->SrcReg[0], machine, a);
- a[0] = CLAMP(a[0], 0.0F, 1.0F);
- a[1] = CLAMP(a[1], 0.0F, 1.0F);
- a[2] = CLAMP(a[2], 0.0F, 1.0F);
- a[3] = CLAMP(a[3], 0.0F, 1.0F);
- ubx = IROUND(255.0F * a[0]);
- uby = IROUND(255.0F * a[1]);
- ubz = IROUND(255.0F * a[2]);
- ubw = IROUND(255.0F * a[3]);
- result[0] =
- result[1] =
- result[2] =
- result[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24);
- store_vector4ui(inst, machine, result);
- }
- break;
- case OPCODE_POW:
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector1(&inst->SrcReg[0], machine, a);
- fetch_vector1(&inst->SrcReg[1], machine, b);
- result[0] = result[1] = result[2] = result[3]
- = (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];
- fetch_vector1(&inst->SrcReg[0], machine, a);
- if (DEBUG_PROG) {
- if (a[0] == 0)
- printf("RCP(0)\n");
- else if (IS_INF_OR_NAN(a[0]))
- printf("RCP(inf)\n");
- }
- result[0] = result[1] = result[2] = result[3] = 1.0F / a[0];
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_RET: /* return from subroutine (conditional) */
- if (eval_condition(machine, inst)) {
- if (machine->StackDepth == 0) {
- return GL_TRUE; /* Per GL_NV_vertex_program2 spec */
- }
- /* subtract one because of pc++ in the for loop */
- pc = machine->CallStack[--machine->StackDepth] - 1;
- }
- break;
- case OPCODE_RFL: /* reflection vector */
- {
- GLfloat axis[4], dir[4], result[4], tmpX, tmpW;
- fetch_vector4(&inst->SrcReg[0], machine, axis);
- fetch_vector4(&inst->SrcReg[1], machine, dir);
- tmpW = DOT3(axis, axis);
- tmpX = (2.0F * DOT3(axis, dir)) / tmpW;
- result[0] = tmpX * axis[0] - dir[0];
- result[1] = tmpX * axis[1] - dir[1];
- result[2] = tmpX * axis[2] - dir[2];
- /* result[3] is never written! XXX enforce in parser! */
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_RSQ: /* 1 / sqrt() */
- {
- GLfloat a[4], result[4];
- fetch_vector1(&inst->SrcReg[0], machine, a);
- a[0] = FABSF(a[0]);
- result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]);
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("RSQ %g = 1/sqrt(|%g|)\n", result[0], a[0]);
- }
- }
- break;
- case OPCODE_SCS: /* sine and cos */
- {
- GLfloat a[4], result[4];
- fetch_vector1(&inst->SrcReg[0], machine, a);
- 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);
- }
- break;
- case OPCODE_SEQ: /* set on equal */
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = (a[0] == b[0]) ? 1.0F : 0.0F;
- result[1] = (a[1] == b[1]) ? 1.0F : 0.0F;
- result[2] = (a[2] == b[2]) ? 1.0F : 0.0F;
- result[3] = (a[3] == b[3]) ? 1.0F : 0.0F;
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("SEQ (%g %g %g %g) = (%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]);
- }
- }
- break;
- case OPCODE_SFL: /* set false, operands ignored */
- {
- static const GLfloat result[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_SGE: /* set on greater or equal */
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = (a[0] >= b[0]) ? 1.0F : 0.0F;
- result[1] = (a[1] >= b[1]) ? 1.0F : 0.0F;
- result[2] = (a[2] >= b[2]) ? 1.0F : 0.0F;
- result[3] = (a[3] >= b[3]) ? 1.0F : 0.0F;
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("SGE (%g %g %g %g) = (%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]);
- }
- }
- break;
- case OPCODE_SGT: /* set on greater */
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = (a[0] > b[0]) ? 1.0F : 0.0F;
- result[1] = (a[1] > b[1]) ? 1.0F : 0.0F;
- result[2] = (a[2] > b[2]) ? 1.0F : 0.0F;
- result[3] = (a[3] > b[3]) ? 1.0F : 0.0F;
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("SGT (%g %g %g %g) = (%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]);
- }
- }
- break;
- case OPCODE_SIN:
- {
- GLfloat a[4], result[4];
- fetch_vector1(&inst->SrcReg[0], machine, a);
- result[0] = result[1] = result[2] = result[3]
- = (GLfloat) sin(a[0]);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_SLE: /* set on less or equal */
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = (a[0] <= b[0]) ? 1.0F : 0.0F;
- result[1] = (a[1] <= b[1]) ? 1.0F : 0.0F;
- result[2] = (a[2] <= b[2]) ? 1.0F : 0.0F;
- result[3] = (a[3] <= b[3]) ? 1.0F : 0.0F;
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("SLE (%g %g %g %g) = (%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]);
- }
- }
- break;
- case OPCODE_SLT: /* set on less */
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = (a[0] < b[0]) ? 1.0F : 0.0F;
- result[1] = (a[1] < b[1]) ? 1.0F : 0.0F;
- result[2] = (a[2] < b[2]) ? 1.0F : 0.0F;
- result[3] = (a[3] < b[3]) ? 1.0F : 0.0F;
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("SLT (%g %g %g %g) = (%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]);
- }
- }
- break;
- case OPCODE_SNE: /* set on not equal */
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = (a[0] != b[0]) ? 1.0F : 0.0F;
- result[1] = (a[1] != b[1]) ? 1.0F : 0.0F;
- result[2] = (a[2] != b[2]) ? 1.0F : 0.0F;
- result[3] = (a[3] != b[3]) ? 1.0F : 0.0F;
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("SNE (%g %g %g %g) = (%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]);
- }
- }
- break;
- case OPCODE_SSG: /* set sign (-1, 0 or +1) */
- {
- GLfloat a[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] = (GLfloat) ((a[0] > 0.0F) - (a[0] < 0.0F));
- result[1] = (GLfloat) ((a[1] > 0.0F) - (a[1] < 0.0F));
- result[2] = (GLfloat) ((a[2] > 0.0F) - (a[2] < 0.0F));
- result[3] = (GLfloat) ((a[3] > 0.0F) - (a[3] < 0.0F));
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_STR: /* set true, operands ignored */
- {
- static const GLfloat result[4] = { 1.0F, 1.0F, 1.0F, 1.0F };
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_SUB:
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = a[0] - b[0];
- result[1] = a[1] - b[1];
- result[2] = a[2] - b[2];
- result[3] = a[3] - b[3];
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("SUB (%g %g %g %g) = (%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]);
- }
- }
- break;
- case OPCODE_SWZ: /* extended swizzle */
- {
- const struct prog_src_register *source = &inst->SrcReg[0];
- const GLfloat *src = get_src_register_pointer(source, machine);
- GLfloat result[4];
- GLuint i;
- for (i = 0; i < 4; i++) {
- const GLuint swz = GET_SWZ(source->Swizzle, i);
- if (swz == SWIZZLE_ZERO)
- result[i] = 0.0;
- else if (swz == SWIZZLE_ONE)
- result[i] = 1.0;
- else {
- ASSERT(swz >= 0);
- ASSERT(swz <= 3);
- result[i] = src[swz];
- }
- if (source->Negate & (1 << i))
- result[i] = -result[i];
- }
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_TEX: /* Both ARB and NV frag prog */
- /* Simple texel lookup */
- {
- GLfloat texcoord[4], color[4];
- fetch_vector4(&inst->SrcReg[0], machine, texcoord);
-
- fetch_texel(ctx, machine, inst, texcoord, 0.0, color);
-
- if (DEBUG_PROG) {
- printf("TEX (%g, %g, %g, %g) = texture[%d][%g, %g, %g, %g]\n",
- color[0], color[1], color[2], color[3],
- inst->TexSrcUnit,
- texcoord[0], texcoord[1], texcoord[2], texcoord[3]);
- }
- store_vector4(inst, machine, color);
- }
- break;
- case OPCODE_TXB: /* GL_ARB_fragment_program only */
- /* Texel lookup with LOD bias */
- {
- GLfloat texcoord[4], color[4], lodBias;
-
- fetch_vector4(&inst->SrcReg[0], machine, texcoord);
-
- /* texcoord[3] is the bias to add to lambda */
- lodBias = texcoord[3];
-
- fetch_texel(ctx, machine, inst, texcoord, lodBias, color);
-
- store_vector4(inst, machine, color);
- }
- break;
- case OPCODE_TXD: /* GL_NV_fragment_program only */
- /* Texture lookup w/ partial derivatives for LOD */
- {
- GLfloat texcoord[4], dtdx[4], dtdy[4], color[4];
- fetch_vector4(&inst->SrcReg[0], machine, texcoord);
- fetch_vector4(&inst->SrcReg[1], machine, dtdx);
- fetch_vector4(&inst->SrcReg[2], machine, dtdy);
- machine->FetchTexelDeriv(ctx, texcoord, dtdx, dtdy,
- 0.0, /* lodBias */
- inst->TexSrcUnit, color);
- 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 */
- {
- GLfloat texcoord[4], color[4];
-
- fetch_vector4(&inst->SrcReg[0], machine, texcoord);
- /* Not so sure about this test - if texcoord[3] is
- * zero, we'd probably be fine except for an ASSERT in
- * IROUND_POS() which gets triggered by the inf values created.
- */
- if (texcoord[3] != 0.0) {
- texcoord[0] /= texcoord[3];
- texcoord[1] /= texcoord[3];
- texcoord[2] /= texcoord[3];
- }
-
- fetch_texel(ctx, machine, inst, texcoord, 0.0, color);
-
- store_vector4(inst, machine, color);
- }
- break;
- case OPCODE_TXP_NV: /* GL_NV_fragment_program only */
- /* Texture lookup w/ projective divide, as above, but do not
- * do the divide by w if sampling from a cube map.
- */
- {
- GLfloat texcoord[4], color[4];
-
- fetch_vector4(&inst->SrcReg[0], machine, texcoord);
- if (inst->TexSrcTarget != TEXTURE_CUBE_INDEX &&
- texcoord[3] != 0.0) {
- texcoord[0] /= texcoord[3];
- texcoord[1] /= texcoord[3];
- texcoord[2] /= texcoord[3];
- }
-
- fetch_texel(ctx, machine, inst, texcoord, 0.0, color);
-
- store_vector4(inst, machine, color);
- }
- break;
- case OPCODE_TRUNC: /* truncate toward zero */
- {
- GLfloat a[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] = (GLfloat) (GLint) a[0];
- result[1] = (GLfloat) (GLint) a[1];
- result[2] = (GLfloat) (GLint) a[2];
- result[3] = (GLfloat) (GLint) a[3];
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_UP2H: /* unpack two 16-bit floats */
- {
- const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
- GLfloat result[4];
- GLushort hx, hy;
- hx = raw & 0xffff;
- hy = raw >> 16;
- result[0] = result[2] = _mesa_half_to_float(hx);
- result[1] = result[3] = _mesa_half_to_float(hy);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_UP2US: /* unpack two GLushorts */
- {
- const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
- GLfloat result[4];
- GLushort usx, usy;
- usx = raw & 0xffff;
- usy = raw >> 16;
- result[0] = result[2] = usx * (1.0f / 65535.0f);
- result[1] = result[3] = usy * (1.0f / 65535.0f);
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_UP4B: /* unpack four GLbytes */
- {
- const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
- GLfloat result[4];
- result[0] = (((raw >> 0) & 0xff) - 128) / 127.0F;
- result[1] = (((raw >> 8) & 0xff) - 128) / 127.0F;
- result[2] = (((raw >> 16) & 0xff) - 128) / 127.0F;
- result[3] = (((raw >> 24) & 0xff) - 128) / 127.0F;
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_UP4UB: /* unpack four GLubytes */
- {
- const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
- GLfloat result[4];
- result[0] = ((raw >> 0) & 0xff) / 255.0F;
- result[1] = ((raw >> 8) & 0xff) / 255.0F;
- result[2] = ((raw >> 16) & 0xff) / 255.0F;
- result[3] = ((raw >> 24) & 0xff) / 255.0F;
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_XOR: /* bitwise XOR */
- {
- GLuint a[4], b[4], result[4];
- fetch_vector4ui(&inst->SrcReg[0], machine, a);
- fetch_vector4ui(&inst->SrcReg[1], machine, b);
- result[0] = a[0] ^ b[0];
- result[1] = a[1] ^ b[1];
- result[2] = a[2] ^ b[2];
- result[3] = a[3] ^ b[3];
- store_vector4ui(inst, machine, result);
- }
- break;
- case OPCODE_XPD: /* cross product */
- {
- GLfloat a[4], b[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = a[1] * b[2] - a[2] * b[1];
- result[1] = a[2] * b[0] - a[0] * b[2];
- result[2] = a[0] * b[1] - a[1] * b[0];
- result[3] = 1.0;
- store_vector4(inst, machine, result);
- if (DEBUG_PROG) {
- printf("XPD (%g %g %g %g) = (%g %g %g) X (%g %g %g)\n",
- result[0], result[1], result[2], result[3],
- a[0], a[1], a[2], b[0], b[1], b[2]);
- }
- }
- break;
- case OPCODE_X2D: /* 2-D matrix transform */
- {
- GLfloat a[4], b[4], c[4], result[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- fetch_vector4(&inst->SrcReg[1], machine, b);
- fetch_vector4(&inst->SrcReg[2], machine, c);
- result[0] = a[0] + b[0] * c[0] + b[1] * c[1];
- result[1] = a[1] + b[0] * c[2] + b[1] * c[3];
- result[2] = a[2] + b[0] * c[0] + b[1] * c[1];
- result[3] = a[3] + b[0] * c[2] + b[1] * c[3];
- store_vector4(inst, machine, result);
- }
- break;
- case OPCODE_PRINT:
- {
- 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,
- a[0], a[1], a[2], a[3]);
- }
- else {
- printf("%s\n", (const char *) inst->Data);
- }
- }
- break;
- case OPCODE_END:
- return GL_TRUE;
- default:
- _mesa_problem(ctx, "Bad opcode %d in _mesa_execute_program",
- inst->Opcode);
- return GL_TRUE; /* return value doesn't matter */
- }
-
- numExec++;
- if (numExec > maxExec) {
- static GLboolean reported = GL_FALSE;
- if (!reported) {
- _mesa_problem(ctx, "Infinite loop detected in fragment program");
- reported = GL_TRUE;
- }
- return GL_TRUE;
- }
-
- } /* for pc */
-
- return GL_TRUE;
-}
diff --git a/src/mesa/program/prog_execute.h b/src/mesa/program/prog_execute.h
deleted file mode 100644
index cefd468..0000000
--- a/src/mesa/program/prog_execute.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.0.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.
- */
-
-#ifndef PROG_EXECUTE_H
-#define PROG_EXECUTE_H
-
-#include "main/config.h"
-#include "main/mtypes.h"
-
-
-typedef void (*FetchTexelLodFunc)(struct gl_context *ctx, const GLfloat texcoord[4],
- GLfloat lambda, GLuint unit, GLfloat color[4]);
-
-typedef void (*FetchTexelDerivFunc)(struct gl_context *ctx, const GLfloat texcoord[4],
- const GLfloat texdx[4],
- const GLfloat texdy[4],
- GLfloat lodBias,
- GLuint unit, GLfloat color[4]);
-
-
-/**
- * Virtual machine state used during execution of vertex/fragment programs.
- */
-struct gl_program_machine
-{
- const struct gl_program *CurProgram;
-
- /** Fragment Input attributes */
- GLfloat (*Attribs)[MAX_WIDTH][4];
- GLfloat (*DerivX)[4];
- GLfloat (*DerivY)[4];
- GLuint NumDeriv; /**< Max index into DerivX/Y arrays */
- GLuint CurElement; /**< Index into Attribs arrays */
-
- /** Vertex Input attribs */
- GLfloat VertAttribs[VERT_ATTRIB_MAX][4];
-
- GLfloat Temporaries[MAX_PROGRAM_TEMPS][4];
- GLfloat Outputs[MAX_PROGRAM_OUTPUTS][4];
- GLfloat (*EnvParams)[4]; /**< Vertex or Fragment env parameters */
- GLuint CondCodes[4]; /**< COND_* value for x/y/z/w */
- GLint AddressReg[MAX_PROGRAM_ADDRESS_REGS][4];
-
- const GLubyte *Samplers; /** Array mapping sampler var to tex unit */
-
- GLuint CallStack[MAX_PROGRAM_CALL_DEPTH]; /**< For CAL/RET instructions */
- GLuint StackDepth; /**< Index/ptr to top of CallStack[] */
-
- /** Texture fetch functions */
- FetchTexelLodFunc FetchTexelLod;
- FetchTexelDerivFunc FetchTexelDeriv;
-};
-
-
-extern void
-_mesa_get_program_register(struct gl_context *ctx, gl_register_file file,
- GLuint index, GLfloat val[4]);
-
-extern GLboolean
-_mesa_execute_program(struct gl_context *ctx,
- const struct gl_program *program,
- struct gl_program_machine *machine);
-
-
-#endif /* PROG_EXECUTE_H */
diff --git a/src/mesa/program/prog_instruction.c b/src/mesa/program/prog_instruction.c
deleted file mode 100644
index 5d6cb47..0000000
--- a/src/mesa/program/prog_instruction.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.3
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (C) 1999-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/glheader.h"
-#include "main/imports.h"
-#include "main/mtypes.h"
-#include "prog_instruction.h"
-
-
-/**
- * Initialize program instruction fields to defaults.
- * \param inst first instruction to initialize
- * \param count number of instructions to initialize
- */
-void
-_mesa_init_instructions(struct prog_instruction *inst, GLuint count)
-{
- GLuint i;
-
- memset(inst, 0, count * sizeof(struct prog_instruction));
-
- for (i = 0; i < count; i++) {
- inst[i].SrcReg[0].File = PROGRAM_UNDEFINED;
- inst[i].SrcReg[0].Swizzle = SWIZZLE_NOOP;
- inst[i].SrcReg[1].File = PROGRAM_UNDEFINED;
- inst[i].SrcReg[1].Swizzle = SWIZZLE_NOOP;
- inst[i].SrcReg[2].File = PROGRAM_UNDEFINED;
- inst[i].SrcReg[2].Swizzle = SWIZZLE_NOOP;
-
- inst[i].DstReg.File = PROGRAM_UNDEFINED;
- inst[i].DstReg.WriteMask = WRITEMASK_XYZW;
- inst[i].DstReg.CondMask = COND_TR;
- inst[i].DstReg.CondSwizzle = SWIZZLE_NOOP;
-
- inst[i].SaturateMode = SATURATE_OFF;
- inst[i].Precision = FLOAT32;
- }
-}
-
-
-/**
- * Allocate an array of program instructions.
- * \param numInst number of instructions
- * \return pointer to instruction memory
- */
-struct prog_instruction *
-_mesa_alloc_instructions(GLuint numInst)
-{
- return (struct prog_instruction *)
- calloc(1, numInst * sizeof(struct prog_instruction));
-}
-
-
-/**
- * Reallocate memory storing an array of program instructions.
- * This is used when we need to append additional instructions onto an
- * program.
- * \param oldInst pointer to first of old/src instructions
- * \param numOldInst number of instructions at <oldInst>
- * \param numNewInst desired size of new instruction array.
- * \return pointer to start of new instruction array.
- */
-struct prog_instruction *
-_mesa_realloc_instructions(struct prog_instruction *oldInst,
- GLuint numOldInst, GLuint numNewInst)
-{
- struct prog_instruction *newInst;
-
- newInst = (struct prog_instruction *)
- _mesa_realloc(oldInst,
- numOldInst * sizeof(struct prog_instruction),
- numNewInst * sizeof(struct prog_instruction));
-
- return newInst;
-}
-
-
-/**
- * Copy an array of program instructions.
- * \param dest pointer to destination.
- * \param src pointer to source.
- * \param n number of instructions to copy.
- * \return pointer to destination.
- */
-struct prog_instruction *
-_mesa_copy_instructions(struct prog_instruction *dest,
- const struct prog_instruction *src, GLuint n)
-{
- GLuint i;
- memcpy(dest, src, n * sizeof(struct prog_instruction));
- for (i = 0; i < n; i++) {
- if (src[i].Comment)
- dest[i].Comment = _mesa_strdup(src[i].Comment);
- }
- return dest;
-}
-
-
-/**
- * Free an array of instructions
- */
-void
-_mesa_free_instructions(struct prog_instruction *inst, GLuint count)
-{
- GLuint i;
- for (i = 0; i < count; i++) {
- if (inst[i].Data)
- free(inst[i].Data);
- if (inst[i].Comment)
- free((char *) inst[i].Comment);
- }
- free(inst);
-}
-
-
-/**
- * Basic info about each instruction
- */
-struct instruction_info
-{
- gl_inst_opcode Opcode;
- const char *Name;
- GLuint NumSrcRegs;
- GLuint NumDstRegs;
-};
-
-/**
- * Instruction info
- * \note Opcode should equal array index!
- */
-static const struct instruction_info InstInfo[MAX_OPCODE] = {
- { OPCODE_NOP, "NOP", 0, 0 },
- { OPCODE_ABS, "ABS", 1, 1 },
- { OPCODE_ADD, "ADD", 2, 1 },
- { OPCODE_AND, "AND", 2, 1 },
- { OPCODE_ARA, "ARA", 1, 1 },
- { OPCODE_ARL, "ARL", 1, 1 },
- { OPCODE_ARL_NV, "ARL_NV", 1, 1 },
- { OPCODE_ARR, "ARL", 1, 1 },
- { OPCODE_BGNLOOP,"BGNLOOP", 0, 0 },
- { OPCODE_BGNSUB, "BGNSUB", 0, 0 },
- { OPCODE_BRA, "BRA", 0, 0 },
- { OPCODE_BRK, "BRK", 0, 0 },
- { OPCODE_CAL, "CAL", 0, 0 },
- { OPCODE_CMP, "CMP", 3, 1 },
- { OPCODE_CONT, "CONT", 0, 0 },
- { OPCODE_COS, "COS", 1, 1 },
- { OPCODE_DDX, "DDX", 1, 1 },
- { OPCODE_DDY, "DDY", 1, 1 },
- { OPCODE_DP2, "DP2", 2, 1 },
- { OPCODE_DP2A, "DP2A", 3, 1 },
- { OPCODE_DP3, "DP3", 2, 1 },
- { OPCODE_DP4, "DP4", 2, 1 },
- { 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 },
- { OPCODE_EX2, "EX2", 1, 1 },
- { OPCODE_EXP, "EXP", 1, 1 },
- { OPCODE_FLR, "FLR", 1, 1 },
- { OPCODE_FRC, "FRC", 1, 1 },
- { OPCODE_IF, "IF", 1, 0 },
- { OPCODE_KIL, "KIL", 1, 0 },
- { OPCODE_KIL_NV, "KIL_NV", 0, 0 },
- { OPCODE_LG2, "LG2", 1, 1 },
- { OPCODE_LIT, "LIT", 1, 1 },
- { OPCODE_LOG, "LOG", 1, 1 },
- { OPCODE_LRP, "LRP", 3, 1 },
- { OPCODE_MAD, "MAD", 3, 1 },
- { OPCODE_MAX, "MAX", 2, 1 },
- { OPCODE_MIN, "MIN", 2, 1 },
- { OPCODE_MOV, "MOV", 1, 1 },
- { OPCODE_MUL, "MUL", 2, 1 },
- { OPCODE_NOISE1, "NOISE1", 1, 1 },
- { OPCODE_NOISE2, "NOISE2", 1, 1 },
- { OPCODE_NOISE3, "NOISE3", 1, 1 },
- { OPCODE_NOISE4, "NOISE4", 1, 1 },
- { OPCODE_NOT, "NOT", 1, 1 },
- { OPCODE_NRM3, "NRM3", 1, 1 },
- { OPCODE_NRM4, "NRM4", 1, 1 },
- { OPCODE_OR, "OR", 2, 1 },
- { OPCODE_PK2H, "PK2H", 1, 1 },
- { OPCODE_PK2US, "PK2US", 1, 1 },
- { OPCODE_PK4B, "PK4B", 1, 1 },
- { OPCODE_PK4UB, "PK4UB", 1, 1 },
- { OPCODE_POW, "POW", 2, 1 },
- { OPCODE_POPA, "POPA", 0, 0 },
- { OPCODE_PRINT, "PRINT", 1, 0 },
- { OPCODE_PUSHA, "PUSHA", 0, 0 },
- { OPCODE_RCC, "RCC", 1, 1 },
- { OPCODE_RCP, "RCP", 1, 1 },
- { OPCODE_RET, "RET", 0, 0 },
- { OPCODE_RFL, "RFL", 1, 1 },
- { OPCODE_RSQ, "RSQ", 1, 1 },
- { OPCODE_SCS, "SCS", 1, 1 },
- { OPCODE_SEQ, "SEQ", 2, 1 },
- { OPCODE_SFL, "SFL", 0, 1 },
- { OPCODE_SGE, "SGE", 2, 1 },
- { OPCODE_SGT, "SGT", 2, 1 },
- { OPCODE_SIN, "SIN", 1, 1 },
- { OPCODE_SLE, "SLE", 2, 1 },
- { OPCODE_SLT, "SLT", 2, 1 },
- { OPCODE_SNE, "SNE", 2, 1 },
- { OPCODE_SSG, "SSG", 1, 1 },
- { OPCODE_STR, "STR", 0, 1 },
- { OPCODE_SUB, "SUB", 2, 1 },
- { OPCODE_SWZ, "SWZ", 1, 1 },
- { OPCODE_TEX, "TEX", 1, 1 },
- { OPCODE_TXB, "TXB", 1, 1 },
- { OPCODE_TXD, "TXD", 3, 1 },
- { OPCODE_TXL, "TXL", 1, 1 },
- { OPCODE_TXP, "TXP", 1, 1 },
- { OPCODE_TXP_NV, "TXP_NV", 1, 1 },
- { OPCODE_TRUNC, "TRUNC", 1, 1 },
- { OPCODE_UP2H, "UP2H", 1, 1 },
- { OPCODE_UP2US, "UP2US", 1, 1 },
- { OPCODE_UP4B, "UP4B", 1, 1 },
- { OPCODE_UP4UB, "UP4UB", 1, 1 },
- { OPCODE_X2D, "X2D", 3, 1 },
- { OPCODE_XOR, "XOR", 2, 1 },
- { OPCODE_XPD, "XPD", 2, 1 }
-};
-
-
-/**
- * Return the number of src registers for the given instruction/opcode.
- */
-GLuint
-_mesa_num_inst_src_regs(gl_inst_opcode opcode)
-{
- ASSERT(opcode < MAX_OPCODE);
- ASSERT(opcode == InstInfo[opcode].Opcode);
- ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode);
- return InstInfo[opcode].NumSrcRegs;
-}
-
-
-/**
- * Return the number of dst registers for the given instruction/opcode.
- */
-GLuint
-_mesa_num_inst_dst_regs(gl_inst_opcode opcode)
-{
- ASSERT(opcode < MAX_OPCODE);
- ASSERT(opcode == InstInfo[opcode].Opcode);
- ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode);
- return InstInfo[opcode].NumDstRegs;
-}
-
-
-GLboolean
-_mesa_is_tex_instruction(gl_inst_opcode opcode)
-{
- return (opcode == OPCODE_TEX ||
- opcode == OPCODE_TXB ||
- opcode == OPCODE_TXD ||
- opcode == OPCODE_TXL ||
- opcode == OPCODE_TXP);
-}
-
-
-/**
- * Check if there's a potential src/dst register data dependency when
- * using SOA execution.
- * Example:
- * MOV T, T.yxwz;
- * This would expand into:
- * MOV t0, t1;
- * MOV t1, t0;
- * MOV t2, t3;
- * MOV t3, t2;
- * The second instruction will have the wrong value for t0 if executed as-is.
- */
-GLboolean
-_mesa_check_soa_dependencies(const struct prog_instruction *inst)
-{
- GLuint i, chan;
-
- if (inst->DstReg.WriteMask == WRITEMASK_X ||
- inst->DstReg.WriteMask == WRITEMASK_Y ||
- inst->DstReg.WriteMask == WRITEMASK_Z ||
- inst->DstReg.WriteMask == WRITEMASK_W ||
- inst->DstReg.WriteMask == 0x0) {
- /* no chance of data dependency */
- return GL_FALSE;
- }
-
- /* loop over src regs */
- for (i = 0; i < 3; i++) {
- if (inst->SrcReg[i].File == inst->DstReg.File &&
- inst->SrcReg[i].Index == inst->DstReg.Index) {
- /* loop over dest channels */
- GLuint channelsWritten = 0x0;
- for (chan = 0; chan < 4; chan++) {
- if (inst->DstReg.WriteMask & (1 << chan)) {
- /* check if we're reading a channel that's been written */
- GLuint swizzle = GET_SWZ(inst->SrcReg[i].Swizzle, chan);
- if (swizzle <= SWIZZLE_W &&
- (channelsWritten & (1 << swizzle))) {
- return GL_TRUE;
- }
-
- channelsWritten |= (1 << chan);
- }
- }
- }
- }
- return GL_FALSE;
-}
-
-
-/**
- * Return string name for given program opcode.
- */
-const char *
-_mesa_opcode_string(gl_inst_opcode opcode)
-{
- if (opcode < MAX_OPCODE)
- return InstInfo[opcode].Name;
- else {
- static char s[20];
- _mesa_snprintf(s, sizeof(s), "OP%u", opcode);
- return s;
- }
-}
-
diff --git a/src/mesa/program/prog_instruction.h b/src/mesa/program/prog_instruction.h
deleted file mode 100644
index a383828..0000000
--- a/src/mesa/program/prog_instruction.h
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.3
- *
- * 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 prog_instruction.h
- *
- * Vertex/fragment program instruction datatypes and constants.
- *
- * \author Brian Paul
- * \author Keith Whitwell
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-
-#ifndef PROG_INSTRUCTION_H
-#define PROG_INSTRUCTION_H
-
-
-#include "main/glheader.h"
-
-
-/**
- * Swizzle indexes.
- * Do not change!
- */
-/*@{*/
-#define SWIZZLE_X 0
-#define SWIZZLE_Y 1
-#define SWIZZLE_Z 2
-#define SWIZZLE_W 3
-#define SWIZZLE_ZERO 4 /**< For SWZ instruction only */
-#define SWIZZLE_ONE 5 /**< For SWZ instruction only */
-#define SWIZZLE_NIL 7 /**< used during shader code gen (undefined value) */
-/*@}*/
-
-#define MAKE_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9))
-#define SWIZZLE_NOOP MAKE_SWIZZLE4(0,1,2,3)
-#define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7)
-#define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1)
-
-#define SWIZZLE_XYZW MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W)
-#define SWIZZLE_XXXX MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)
-#define SWIZZLE_YYYY MAKE_SWIZZLE4(SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y)
-#define SWIZZLE_ZZZZ MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z)
-#define SWIZZLE_WWWW MAKE_SWIZZLE4(SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W)
-
-
-/**
- * Writemask values, 1 bit per component.
- */
-/*@{*/
-#define WRITEMASK_X 0x1
-#define WRITEMASK_Y 0x2
-#define WRITEMASK_XY 0x3
-#define WRITEMASK_Z 0x4
-#define WRITEMASK_XZ 0x5
-#define WRITEMASK_YZ 0x6
-#define WRITEMASK_XYZ 0x7
-#define WRITEMASK_W 0x8
-#define WRITEMASK_XW 0x9
-#define WRITEMASK_YW 0xa
-#define WRITEMASK_XYW 0xb
-#define WRITEMASK_ZW 0xc
-#define WRITEMASK_XZW 0xd
-#define WRITEMASK_YZW 0xe
-#define WRITEMASK_XYZW 0xf
-/*@}*/
-
-
-/**
- * Condition codes
- */
-/*@{*/
-#define COND_GT 1 /**< greater than zero */
-#define COND_EQ 2 /**< equal to zero */
-#define COND_LT 3 /**< less than zero */
-#define COND_UN 4 /**< unordered (NaN) */
-#define COND_GE 5 /**< greater than or equal to zero */
-#define COND_LE 6 /**< less than or equal to zero */
-#define COND_NE 7 /**< not equal to zero */
-#define COND_TR 8 /**< always true */
-#define COND_FL 9 /**< always false */
-/*@}*/
-
-
-/**
- * Instruction precision for GL_NV_fragment_program
- */
-/*@{*/
-#define FLOAT32 0x1
-#define FLOAT16 0x2
-#define FIXED12 0x4
-/*@}*/
-
-
-/**
- * Saturation modes when storing values.
- */
-/*@{*/
-#define SATURATE_OFF 0
-#define SATURATE_ZERO_ONE 1
-/*@}*/
-
-
-/**
- * Per-component negation masks
- */
-/*@{*/
-#define NEGATE_X 0x1
-#define NEGATE_Y 0x2
-#define NEGATE_Z 0x4
-#define NEGATE_W 0x8
-#define NEGATE_XYZ 0x7
-#define NEGATE_XYZW 0xf
-#define NEGATE_NONE 0x0
-/*@}*/
-
-
-/**
- * Program instruction opcodes for vertex, fragment and geometry programs.
- */
-typedef enum prog_opcode {
- /* ARB_vp ARB_fp NV_vp NV_fp GLSL */
- /*------------------------------------------*/
- OPCODE_NOP = 0, /* X */
- OPCODE_ABS, /* X X 1.1 X */
- OPCODE_ADD, /* X X X X X */
- OPCODE_AND, /* */
- OPCODE_ARA, /* 2 */
- 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 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 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 */
- OPCODE_EX2, /* X X 2 X X */
- OPCODE_EXP, /* X X X */
- OPCODE_FLR, /* X X 2 X X */
- OPCODE_FRC, /* X X 2 X X */
- OPCODE_IF, /* opt */
- OPCODE_KIL, /* X */
- OPCODE_KIL_NV, /* X X */
- OPCODE_LG2, /* X X 2 X X */
- OPCODE_LIT, /* X X X X */
- OPCODE_LOG, /* X 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 */
- OPCODE_MOV, /* X X X X X */
- OPCODE_MUL, /* X X X X X */
- OPCODE_NOISE1, /* X */
- OPCODE_NOISE2, /* X */
- OPCODE_NOISE3, /* X */
- OPCODE_NOISE4, /* X */
- OPCODE_NOT, /* */
- OPCODE_NRM3, /* X */
- OPCODE_NRM4, /* X */
- OPCODE_OR, /* */
- OPCODE_PK2H, /* X */
- OPCODE_PK2US, /* X */
- OPCODE_PK4B, /* X */
- OPCODE_PK4UB, /* X */
- OPCODE_POW, /* X X X X */
- OPCODE_POPA, /* 3 */
- OPCODE_PRINT, /* X X */
- OPCODE_PUSHA, /* 3 */
- OPCODE_RCC, /* 1.1 */
- OPCODE_RCP, /* X X X X X */
- OPCODE_RET, /* 2 2 X */
- OPCODE_RFL, /* X X */
- OPCODE_RSQ, /* X X X X X */
- OPCODE_SCS, /* X */
- OPCODE_SEQ, /* 2 X X */
- OPCODE_SFL, /* 2 X */
- OPCODE_SGE, /* X X X X X */
- OPCODE_SGT, /* 2 X X */
- OPCODE_SIN, /* X 2 X X */
- OPCODE_SLE, /* 2 X X */
- OPCODE_SLT, /* X X X X X */
- OPCODE_SNE, /* 2 X X */
- OPCODE_SSG, /* 2 */
- OPCODE_STR, /* 2 X */
- OPCODE_SUB, /* X X 1.1 X X */
- OPCODE_SWZ, /* X X */
- OPCODE_TEX, /* X 3 X X */
- OPCODE_TXB, /* X 3 X */
- OPCODE_TXD, /* X X */
- OPCODE_TXL, /* 3 2 X */
- OPCODE_TXP, /* X X */
- OPCODE_TXP_NV, /* 3 X */
- OPCODE_TRUNC, /* X */
- OPCODE_UP2H, /* X */
- OPCODE_UP2US, /* X */
- OPCODE_UP4B, /* X */
- OPCODE_UP4UB, /* X */
- OPCODE_X2D, /* X */
- OPCODE_XOR, /* */
- OPCODE_XPD, /* X X X */
- MAX_OPCODE
-} gl_inst_opcode;
-
-
-/**
- * Number of bits for the src/dst register Index field.
- * This limits the size of temp/uniform register files.
- */
-#define INST_INDEX_BITS 11
-
-
-/**
- * Instruction source register.
- */
-struct prog_src_register
-{
- GLuint File:4; /**< One of the PROGRAM_* register file values. */
- GLint Index:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit.
- * May be negative for relative addressing.
- */
- GLuint Swizzle:12;
- GLuint RelAddr:1;
-
- /** Take the component-wise absolute value */
- GLuint Abs:1;
-
- /**
- * Post-Abs negation.
- * This will either be NEGATE_NONE or NEGATE_XYZW, except for the SWZ
- * 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. */
-};
-
-
-/**
- * Instruction destination register.
- */
-struct prog_dst_register
-{
- GLuint File:4; /**< One of the PROGRAM_* register file values */
- GLuint Index:INST_INDEX_BITS; /**< Unsigned, never negative */
- GLuint WriteMask:4;
- GLuint RelAddr:1;
-
- /**
- * \name Conditional destination update control.
- *
- * \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2,
- * NV_vertex_program2_option.
- */
- /*@{*/
- /**
- * Takes one of the 9 possible condition values (EQ, FL, GT, GE, LE, LT,
- * NE, TR, or UN). Dest reg is only written to if the matching
- * (swizzled) condition code value passes. When a conditional update mask
- * is not specified, this will be \c COND_TR.
- */
- GLuint CondMask:4;
-
- /**
- * Condition code swizzle value.
- */
- GLuint CondSwizzle:12;
-
- /**
- * Selects the condition code register to use for conditional destination
- * update masking. In NV_fragmnet_program or NV_vertex_program2 mode, only
- * condition code register 0 is available. In NV_vertex_program3 mode,
- * condition code registers 0 and 1 are available.
- */
- GLuint CondSrc:1;
- /*@}*/
-};
-
-
-/**
- * Vertex/fragment program instruction.
- */
-struct prog_instruction
-{
- gl_inst_opcode Opcode;
- struct prog_src_register SrcReg[3];
- struct prog_dst_register DstReg;
-
- /**
- * Indicates that the instruction should update the condition code
- * register.
- *
- * \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2,
- * NV_vertex_program2_option.
- */
- GLuint CondUpdate:1;
-
- /**
- * If prog_instruction::CondUpdate is \c GL_TRUE, this value selects the
- * condition code register that is to be updated.
- *
- * In GL_NV_fragment_program or GL_NV_vertex_program2 mode, only condition
- * code register 0 is available. In GL_NV_vertex_program3 mode, condition
- * code registers 0 and 1 are available.
- *
- * \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2,
- * NV_vertex_program2_option.
- */
- GLuint CondDst:1;
-
- /**
- * Saturate each value of the vectored result to the range [0,1] or the
- * range [-1,1]. \c SSAT mode (i.e., saturation to the range [-1,1]) is
- * only available in NV_fragment_program2 mode.
- * Value is one of the SATURATE_* tokens.
- *
- * \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program3.
- */
- GLuint SaturateMode:2;
-
- /**
- * Per-instruction selectable precision: FLOAT32, FLOAT16, FIXED12.
- *
- * \since
- * NV_fragment_program, NV_fragment_program_option.
- */
- GLuint Precision:3;
-
- /**
- * \name Extra fields for TEX, TXB, TXD, TXL, TXP instructions.
- */
- /*@{*/
- /** Source texture unit. */
- GLuint TexSrcUnit:5;
-
- /** Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX */
- GLuint TexSrcTarget:3;
-
- /** True if tex instruction should do shadow comparison */
- GLuint TexShadow:1;
- /*@}*/
-
- /**
- * For BRA and CAL instructions, the location to jump to.
- * For BGNLOOP, points to ENDLOOP (and vice-versa).
- * For BRK, points to ENDLOOP
- * For IF, points to ELSE or ENDIF.
- * For ELSE, points to ENDIF.
- */
- GLint BranchTarget;
-
- /** for debugging purposes */
- const char *Comment;
-
- /** Arbitrary data. Used for OPCODE_PRINT and some drivers */
- void *Data;
-
- /** for driver use (try to remove someday) */
- GLint Aux;
-};
-
-
-extern void
-_mesa_init_instructions(struct prog_instruction *inst, GLuint count);
-
-extern struct prog_instruction *
-_mesa_alloc_instructions(GLuint numInst);
-
-extern struct prog_instruction *
-_mesa_realloc_instructions(struct prog_instruction *oldInst,
- GLuint numOldInst, GLuint numNewInst);
-
-extern struct prog_instruction *
-_mesa_copy_instructions(struct prog_instruction *dest,
- const struct prog_instruction *src, GLuint n);
-
-extern void
-_mesa_free_instructions(struct prog_instruction *inst, GLuint count);
-
-extern GLuint
-_mesa_num_inst_src_regs(gl_inst_opcode opcode);
-
-extern GLuint
-_mesa_num_inst_dst_regs(gl_inst_opcode opcode);
-
-extern GLboolean
-_mesa_is_tex_instruction(gl_inst_opcode opcode);
-
-extern GLboolean
-_mesa_check_soa_dependencies(const struct prog_instruction *inst);
-
-extern const char *
-_mesa_opcode_string(gl_inst_opcode opcode);
-
-
-#endif /* PROG_INSTRUCTION_H */
diff --git a/src/mesa/program/prog_noise.c b/src/mesa/program/prog_noise.c
deleted file mode 100644
index 1713ddb..0000000
--- a/src/mesa/program/prog_noise.c
+++ /dev/null
@@ -1,638 +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.
- */
-
-/*
- * SimplexNoise1234
- * Copyright (c) 2003-2005, Stefan Gustavson
- *
- * Contact: stegu@itn.liu.se
- */
-
-/**
- * \file
- * \brief C implementation of Perlin Simplex Noise over 1, 2, 3 and 4 dims.
- * \author Stefan Gustavson (stegu@itn.liu.se)
- *
- *
- * This implementation is "Simplex Noise" as presented by
- * Ken Perlin at a relatively obscure and not often cited course
- * session "Real-Time Shading" at Siggraph 2001 (before real
- * time shading actually took on), under the title "hardware noise".
- * The 3D function is numerically equivalent to his Java reference
- * code available in the PDF course notes, although I re-implemented
- * it from scratch to get more readable code. The 1D, 2D and 4D cases
- * were implemented from scratch by me from Ken Perlin's text.
- *
- * This file has no dependencies on any other file, not even its own
- * header file. The header file is made for use by external code only.
- */
-
-
-#include "main/imports.h"
-#include "prog_noise.h"
-
-#define FASTFLOOR(x) ( ((x)>0) ? ((int)x) : (((int)x)-1) )
-
-/*
- * ---------------------------------------------------------------------
- * Static data
- */
-
-/**
- * Permutation table. This is just a random jumble of all numbers 0-255,
- * repeated twice to avoid wrapping the index at 255 for each lookup.
- * This needs to be exactly the same for all instances on all platforms,
- * so it's easiest to just keep it as static explicit data.
- * This also removes the need for any initialisation of this class.
- *
- * Note that making this an int[] instead of a char[] might make the
- * code run faster on platforms with a high penalty for unaligned single
- * byte addressing. Intel x86 is generally single-byte-friendly, but
- * some other CPUs are faster with 4-aligned reads.
- * However, a char[] is smaller, which avoids cache trashing, and that
- * is probably the most important aspect on most architectures.
- * This array is accessed a *lot* by the noise functions.
- * A vector-valued noise over 3D accesses it 96 times, and a
- * float-valued 4D noise 64 times. We want this to fit in the cache!
- */
-unsigned char perm[512] = { 151, 160, 137, 91, 90, 15,
- 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8,
- 99, 37, 240, 21, 10, 23,
- 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35,
- 11, 32, 57, 177, 33,
- 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71,
- 134, 139, 48, 27, 166,
- 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41,
- 55, 46, 245, 40, 244,
- 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89,
- 18, 169, 200, 196,
- 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217,
- 226, 250, 124, 123,
- 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58,
- 17, 182, 189, 28, 42,
- 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155,
- 167, 43, 172, 9,
- 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104,
- 218, 246, 97, 228,
- 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235,
- 249, 14, 239, 107,
- 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45,
- 127, 4, 150, 254,
- 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66,
- 215, 61, 156, 180,
- 151, 160, 137, 91, 90, 15,
- 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8,
- 99, 37, 240, 21, 10, 23,
- 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35,
- 11, 32, 57, 177, 33,
- 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71,
- 134, 139, 48, 27, 166,
- 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41,
- 55, 46, 245, 40, 244,
- 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89,
- 18, 169, 200, 196,
- 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217,
- 226, 250, 124, 123,
- 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58,
- 17, 182, 189, 28, 42,
- 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155,
- 167, 43, 172, 9,
- 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104,
- 218, 246, 97, 228,
- 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235,
- 249, 14, 239, 107,
- 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45,
- 127, 4, 150, 254,
- 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66,
- 215, 61, 156, 180
-};
-
-/*
- * ---------------------------------------------------------------------
- */
-
-/*
- * Helper functions to compute gradients-dot-residualvectors (1D to 4D)
- * Note that these generate gradients of more than unit length. To make
- * a close match with the value range of classic Perlin noise, the final
- * noise values need to be rescaled to fit nicely within [-1,1].
- * (The simplex noise functions as such also have different scaling.)
- * Note also that these noise functions are the most practical and useful
- * signed version of Perlin noise. To return values according to the
- * RenderMan specification from the SL noise() and pnoise() functions,
- * the noise values need to be scaled and offset to [0,1], like this:
- * float SLnoise = (SimplexNoise1234::noise(x,y,z) + 1.0) * 0.5;
- */
-
-static float
-grad1(int hash, float x)
-{
- int h = hash & 15;
- float grad = 1.0f + (h & 7); /* Gradient value 1.0, 2.0, ..., 8.0 */
- if (h & 8)
- grad = -grad; /* Set a random sign for the gradient */
- return (grad * x); /* Multiply the gradient with the distance */
-}
-
-static float
-grad2(int hash, float x, float y)
-{
- int h = hash & 7; /* Convert low 3 bits of hash code */
- float u = h < 4 ? x : y; /* into 8 simple gradient directions, */
- float v = h < 4 ? y : x; /* and compute the dot product with (x,y). */
- return ((h & 1) ? -u : u) + ((h & 2) ? -2.0f * v : 2.0f * v);
-}
-
-static float
-grad3(int hash, float x, float y, float z)
-{
- int h = hash & 15; /* Convert low 4 bits of hash code into 12 simple */
- float u = h < 8 ? x : y; /* gradient directions, and compute dot product. */
- float v = h < 4 ? y : h == 12 || h == 14 ? x : z; /* Fix repeats at h = 12 to 15 */
- return ((h & 1) ? -u : u) + ((h & 2) ? -v : v);
-}
-
-static float
-grad4(int hash, float x, float y, float z, float t)
-{
- int h = hash & 31; /* Convert low 5 bits of hash code into 32 simple */
- float u = h < 24 ? x : y; /* gradient directions, and compute dot product. */
- float v = h < 16 ? y : z;
- float w = h < 8 ? z : t;
- return ((h & 1) ? -u : u) + ((h & 2) ? -v : v) + ((h & 4) ? -w : w);
-}
-
-/**
- * A lookup table to traverse the simplex around a given point in 4D.
- * Details can be found where this table is used, in the 4D noise method.
- * TODO: This should not be required, backport it from Bill's GLSL code!
- */
-static unsigned char simplex[64][4] = {
- {0, 1, 2, 3}, {0, 1, 3, 2}, {0, 0, 0, 0}, {0, 2, 3, 1},
- {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {1, 2, 3, 0},
- {0, 2, 1, 3}, {0, 0, 0, 0}, {0, 3, 1, 2}, {0, 3, 2, 1},
- {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {1, 3, 2, 0},
- {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
- {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
- {1, 2, 0, 3}, {0, 0, 0, 0}, {1, 3, 0, 2}, {0, 0, 0, 0},
- {0, 0, 0, 0}, {0, 0, 0, 0}, {2, 3, 0, 1}, {2, 3, 1, 0},
- {1, 0, 2, 3}, {1, 0, 3, 2}, {0, 0, 0, 0}, {0, 0, 0, 0},
- {0, 0, 0, 0}, {2, 0, 3, 1}, {0, 0, 0, 0}, {2, 1, 3, 0},
- {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
- {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
- {2, 0, 1, 3}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
- {3, 0, 1, 2}, {3, 0, 2, 1}, {0, 0, 0, 0}, {3, 1, 2, 0},
- {2, 1, 0, 3}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
- {3, 1, 0, 2}, {0, 0, 0, 0}, {3, 2, 0, 1}, {3, 2, 1, 0}
-};
-
-
-/** 1D simplex noise */
-GLfloat
-_mesa_noise1(GLfloat x)
-{
- int i0 = FASTFLOOR(x);
- int i1 = i0 + 1;
- float x0 = x - i0;
- float x1 = x0 - 1.0f;
- float t1 = 1.0f - x1 * x1;
- float n0, n1;
-
- float t0 = 1.0f - x0 * x0;
-/* if(t0 < 0.0f) t0 = 0.0f; // this never happens for the 1D case */
- t0 *= t0;
- n0 = t0 * t0 * grad1(perm[i0 & 0xff], x0);
-
-/* if(t1 < 0.0f) t1 = 0.0f; // this never happens for the 1D case */
- t1 *= t1;
- n1 = t1 * t1 * grad1(perm[i1 & 0xff], x1);
- /* The maximum value of this noise is 8*(3/4)^4 = 2.53125 */
- /* A factor of 0.395 would scale to fit exactly within [-1,1], but */
- /* we want to match PRMan's 1D noise, so we scale it down some more. */
- return 0.25f * (n0 + n1);
-}
-
-
-/** 2D simplex noise */
-GLfloat
-_mesa_noise2(GLfloat x, GLfloat y)
-{
-#define F2 0.366025403f /* F2 = 0.5*(sqrt(3.0)-1.0) */
-#define G2 0.211324865f /* G2 = (3.0-Math.sqrt(3.0))/6.0 */
-
- float n0, n1, n2; /* Noise contributions from the three corners */
-
- /* Skew the input space to determine which simplex cell we're in */
- float s = (x + y) * F2; /* Hairy factor for 2D */
- float xs = x + s;
- float ys = y + s;
- int i = FASTFLOOR(xs);
- int j = FASTFLOOR(ys);
-
- float t = (float) (i + j) * G2;
- float X0 = i - t; /* Unskew the cell origin back to (x,y) space */
- float Y0 = j - t;
- float x0 = x - X0; /* The x,y distances from the cell origin */
- float y0 = y - Y0;
-
- float x1, y1, x2, y2;
- int ii, jj;
- float t0, t1, t2;
-
- /* For the 2D case, the simplex shape is an equilateral triangle. */
- /* Determine which simplex we are in. */
- int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */
- if (x0 > y0) {
- i1 = 1;
- j1 = 0;
- } /* lower triangle, XY order: (0,0)->(1,0)->(1,1) */
- else {
- i1 = 0;
- j1 = 1;
- } /* upper triangle, YX order: (0,0)->(0,1)->(1,1) */
-
- /* A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and */
- /* a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where */
- /* c = (3-sqrt(3))/6 */
-
- x1 = x0 - i1 + G2; /* Offsets for middle corner in (x,y) unskewed coords */
- y1 = y0 - j1 + G2;
- x2 = x0 - 1.0f + 2.0f * G2; /* Offsets for last corner in (x,y) unskewed coords */
- y2 = y0 - 1.0f + 2.0f * G2;
-
- /* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
- ii = i % 256;
- jj = j % 256;
-
- /* Calculate the contribution from the three corners */
- t0 = 0.5f - x0 * x0 - y0 * y0;
- if (t0 < 0.0f)
- n0 = 0.0f;
- else {
- t0 *= t0;
- n0 = t0 * t0 * grad2(perm[ii + perm[jj]], x0, y0);
- }
-
- t1 = 0.5f - x1 * x1 - y1 * y1;
- if (t1 < 0.0f)
- n1 = 0.0f;
- else {
- t1 *= t1;
- n1 = t1 * t1 * grad2(perm[ii + i1 + perm[jj + j1]], x1, y1);
- }
-
- t2 = 0.5f - x2 * x2 - y2 * y2;
- if (t2 < 0.0f)
- n2 = 0.0f;
- else {
- t2 *= t2;
- n2 = t2 * t2 * grad2(perm[ii + 1 + perm[jj + 1]], x2, y2);
- }
-
- /* Add contributions from each corner to get the final noise value. */
- /* The result is scaled to return values in the interval [-1,1]. */
- return 40.0f * (n0 + n1 + n2); /* TODO: The scale factor is preliminary! */
-}
-
-
-/** 3D simplex noise */
-GLfloat
-_mesa_noise3(GLfloat x, GLfloat y, GLfloat z)
-{
-/* Simple skewing factors for the 3D case */
-#define F3 0.333333333f
-#define G3 0.166666667f
-
- float n0, n1, n2, n3; /* Noise contributions from the four corners */
-
- /* Skew the input space to determine which simplex cell we're in */
- float s = (x + y + z) * F3; /* Very nice and simple skew factor for 3D */
- float xs = x + s;
- float ys = y + s;
- float zs = z + s;
- int i = FASTFLOOR(xs);
- int j = FASTFLOOR(ys);
- int k = FASTFLOOR(zs);
-
- float t = (float) (i + j + k) * G3;
- float X0 = i - t; /* Unskew the cell origin back to (x,y,z) space */
- float Y0 = j - t;
- float Z0 = k - t;
- float x0 = x - X0; /* The x,y,z distances from the cell origin */
- float y0 = y - Y0;
- float z0 = z - Z0;
-
- float x1, y1, z1, x2, y2, z2, x3, y3, z3;
- int ii, jj, kk;
- float t0, t1, t2, t3;
-
- /* For the 3D case, the simplex shape is a slightly irregular tetrahedron. */
- /* Determine which simplex we are in. */
- int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */
- int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */
-
-/* This code would benefit from a backport from the GLSL version! */
- if (x0 >= y0) {
- if (y0 >= z0) {
- i1 = 1;
- j1 = 0;
- k1 = 0;
- i2 = 1;
- j2 = 1;
- k2 = 0;
- } /* X Y Z order */
- else if (x0 >= z0) {
- i1 = 1;
- j1 = 0;
- k1 = 0;
- i2 = 1;
- j2 = 0;
- k2 = 1;
- } /* X Z Y order */
- else {
- i1 = 0;
- j1 = 0;
- k1 = 1;
- i2 = 1;
- j2 = 0;
- k2 = 1;
- } /* Z X Y order */
- }
- else { /* x0<y0 */
- if (y0 < z0) {
- i1 = 0;
- j1 = 0;
- k1 = 1;
- i2 = 0;
- j2 = 1;
- k2 = 1;
- } /* Z Y X order */
- else if (x0 < z0) {
- i1 = 0;
- j1 = 1;
- k1 = 0;
- i2 = 0;
- j2 = 1;
- k2 = 1;
- } /* Y Z X order */
- else {
- i1 = 0;
- j1 = 1;
- k1 = 0;
- i2 = 1;
- j2 = 1;
- k2 = 0;
- } /* Y X Z order */
- }
-
- /* A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in
- * (x,y,z), a step of (0,1,0) in (i,j,k) means a step of
- * (-c,1-c,-c) in (x,y,z), and a step of (0,0,1) in (i,j,k) means a
- * step of (-c,-c,1-c) in (x,y,z), where c = 1/6.
- */
-
- x1 = x0 - i1 + G3; /* Offsets for second corner in (x,y,z) coords */
- y1 = y0 - j1 + G3;
- z1 = z0 - k1 + G3;
- x2 = x0 - i2 + 2.0f * G3; /* Offsets for third corner in (x,y,z) coords */
- y2 = y0 - j2 + 2.0f * G3;
- z2 = z0 - k2 + 2.0f * G3;
- x3 = x0 - 1.0f + 3.0f * G3;/* Offsets for last corner in (x,y,z) coords */
- y3 = y0 - 1.0f + 3.0f * G3;
- z3 = z0 - 1.0f + 3.0f * G3;
-
- /* Wrap the integer indices at 256 to avoid indexing perm[] out of bounds */
- ii = i % 256;
- jj = j % 256;
- kk = k % 256;
-
- /* Calculate the contribution from the four corners */
- t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0;
- if (t0 < 0.0f)
- n0 = 0.0f;
- else {
- t0 *= t0;
- n0 = t0 * t0 * grad3(perm[ii + perm[jj + perm[kk]]], x0, y0, z0);
- }
-
- t1 = 0.6f - x1 * x1 - y1 * y1 - z1 * z1;
- if (t1 < 0.0f)
- n1 = 0.0f;
- else {
- t1 *= t1;
- n1 =
- t1 * t1 * grad3(perm[ii + i1 + perm[jj + j1 + perm[kk + k1]]], x1,
- y1, z1);
- }
-
- t2 = 0.6f - x2 * x2 - y2 * y2 - z2 * z2;
- if (t2 < 0.0f)
- n2 = 0.0f;
- else {
- t2 *= t2;
- n2 =
- t2 * t2 * grad3(perm[ii + i2 + perm[jj + j2 + perm[kk + k2]]], x2,
- y2, z2);
- }
-
- t3 = 0.6f - x3 * x3 - y3 * y3 - z3 * z3;
- if (t3 < 0.0f)
- n3 = 0.0f;
- else {
- t3 *= t3;
- n3 =
- t3 * t3 * grad3(perm[ii + 1 + perm[jj + 1 + perm[kk + 1]]], x3, y3,
- z3);
- }
-
- /* Add contributions from each corner to get the final noise value.
- * The result is scaled to stay just inside [-1,1]
- */
- return 32.0f * (n0 + n1 + n2 + n3); /* TODO: The scale factor is preliminary! */
-}
-
-
-/** 4D simplex noise */
-GLfloat
-_mesa_noise4(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- /* The skewing and unskewing factors are hairy again for the 4D case */
-#define F4 0.309016994f /* F4 = (Math.sqrt(5.0)-1.0)/4.0 */
-#define G4 0.138196601f /* G4 = (5.0-Math.sqrt(5.0))/20.0 */
-
- float n0, n1, n2, n3, n4; /* Noise contributions from the five corners */
-
- /* Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in */
- float s = (x + y + z + w) * F4; /* Factor for 4D skewing */
- float xs = x + s;
- float ys = y + s;
- float zs = z + s;
- float ws = w + s;
- int i = FASTFLOOR(xs);
- int j = FASTFLOOR(ys);
- int k = FASTFLOOR(zs);
- int l = FASTFLOOR(ws);
-
- float t = (i + j + k + l) * G4; /* Factor for 4D unskewing */
- float X0 = i - t; /* Unskew the cell origin back to (x,y,z,w) space */
- float Y0 = j - t;
- float Z0 = k - t;
- float W0 = l - t;
-
- float x0 = x - X0; /* The x,y,z,w distances from the cell origin */
- float y0 = y - Y0;
- float z0 = z - Z0;
- float w0 = w - W0;
-
- /* For the 4D case, the simplex is a 4D shape I won't even try to describe.
- * To find out which of the 24 possible simplices we're in, we need to
- * determine the magnitude ordering of x0, y0, z0 and w0.
- * The method below is a good way of finding the ordering of x,y,z,w and
- * then find the correct traversal order for the simplex we're in.
- * First, six pair-wise comparisons are performed between each possible pair
- * of the four coordinates, and the results are used to add up binary bits
- * for an integer index.
- */
- int c1 = (x0 > y0) ? 32 : 0;
- int c2 = (x0 > z0) ? 16 : 0;
- int c3 = (y0 > z0) ? 8 : 0;
- int c4 = (x0 > w0) ? 4 : 0;
- int c5 = (y0 > w0) ? 2 : 0;
- int c6 = (z0 > w0) ? 1 : 0;
- int c = c1 + c2 + c3 + c4 + c5 + c6;
-
- int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */
- int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */
- int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */
-
- float x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4;
- int ii, jj, kk, ll;
- float t0, t1, t2, t3, t4;
-
- /*
- * simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some
- * order. Many values of c will never occur, since e.g. x>y>z>w
- * makes x<z, y<w and x<w impossible. Only the 24 indices which
- * have non-zero entries make any sense. We use a thresholding to
- * set the coordinates in turn from the largest magnitude. The
- * number 3 in the "simplex" array is at the position of the
- * largest coordinate.
- */
- i1 = simplex[c][0] >= 3 ? 1 : 0;
- j1 = simplex[c][1] >= 3 ? 1 : 0;
- k1 = simplex[c][2] >= 3 ? 1 : 0;
- l1 = simplex[c][3] >= 3 ? 1 : 0;
- /* The number 2 in the "simplex" array is at the second largest coordinate. */
- i2 = simplex[c][0] >= 2 ? 1 : 0;
- j2 = simplex[c][1] >= 2 ? 1 : 0;
- k2 = simplex[c][2] >= 2 ? 1 : 0;
- l2 = simplex[c][3] >= 2 ? 1 : 0;
- /* The number 1 in the "simplex" array is at the second smallest coordinate. */
- i3 = simplex[c][0] >= 1 ? 1 : 0;
- j3 = simplex[c][1] >= 1 ? 1 : 0;
- k3 = simplex[c][2] >= 1 ? 1 : 0;
- l3 = simplex[c][3] >= 1 ? 1 : 0;
- /* The fifth corner has all coordinate offsets = 1, so no need to look that up. */
-
- x1 = x0 - i1 + G4; /* Offsets for second corner in (x,y,z,w) coords */
- y1 = y0 - j1 + G4;
- z1 = z0 - k1 + G4;
- w1 = w0 - l1 + G4;
- x2 = x0 - i2 + 2.0f * G4; /* Offsets for third corner in (x,y,z,w) coords */
- y2 = y0 - j2 + 2.0f * G4;
- z2 = z0 - k2 + 2.0f * G4;
- w2 = w0 - l2 + 2.0f * G4;
- x3 = x0 - i3 + 3.0f * G4; /* Offsets for fourth corner in (x,y,z,w) coords */
- y3 = y0 - j3 + 3.0f * G4;
- z3 = z0 - k3 + 3.0f * G4;
- w3 = w0 - l3 + 3.0f * G4;
- x4 = x0 - 1.0f + 4.0f * G4; /* Offsets for last corner in (x,y,z,w) coords */
- y4 = y0 - 1.0f + 4.0f * G4;
- z4 = z0 - 1.0f + 4.0f * G4;
- w4 = w0 - 1.0f + 4.0f * G4;
-
- /* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
- ii = i % 256;
- jj = j % 256;
- kk = k % 256;
- ll = l % 256;
-
- /* Calculate the contribution from the five corners */
- t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;
- if (t0 < 0.0f)
- n0 = 0.0f;
- else {
- t0 *= t0;
- n0 =
- t0 * t0 * grad4(perm[ii + perm[jj + perm[kk + perm[ll]]]], x0, y0,
- z0, w0);
- }
-
- t1 = 0.6f - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;
- if (t1 < 0.0f)
- n1 = 0.0f;
- else {
- t1 *= t1;
- n1 =
- t1 * t1 *
- grad4(perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]],
- x1, y1, z1, w1);
- }
-
- t2 = 0.6f - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;
- if (t2 < 0.0f)
- n2 = 0.0f;
- else {
- t2 *= t2;
- n2 =
- t2 * t2 *
- grad4(perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]],
- x2, y2, z2, w2);
- }
-
- t3 = 0.6f - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;
- if (t3 < 0.0f)
- n3 = 0.0f;
- else {
- t3 *= t3;
- n3 =
- t3 * t3 *
- grad4(perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]],
- x3, y3, z3, w3);
- }
-
- t4 = 0.6f - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;
- if (t4 < 0.0f)
- n4 = 0.0f;
- else {
- t4 *= t4;
- n4 =
- t4 * t4 *
- grad4(perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]], x4,
- y4, z4, w4);
- }
-
- /* Sum up and scale the result to cover the range [-1,1] */
- return 27.0f * (n0 + n1 + n2 + n3 + n4); /* TODO: The scale factor is preliminary! */
-}
diff --git a/src/mesa/program/prog_noise.h b/src/mesa/program/prog_noise.h
deleted file mode 100644
index dd7986e..0000000
--- a/src/mesa/program/prog_noise.h
+++ /dev/null
@@ -1,36 +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.
- */
-
-#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);
-extern GLfloat _mesa_noise4(GLfloat, GLfloat, GLfloat, GLfloat);
-
-#endif
-
diff --git a/src/mesa/program/prog_optimize.c b/src/mesa/program/prog_optimize.c
deleted file mode 100644
index 96971f2..0000000
--- a/src/mesa/program/prog_optimize.c
+++ /dev/null
@@ -1,1250 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * 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
- * VMWARE 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/glheader.h"
-#include "main/context.h"
-#include "main/macros.h"
-#include "program.h"
-#include "prog_instruction.h"
-#include "prog_optimize.h"
-#include "prog_print.h"
-
-
-#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;
-
-#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,
- GLuint arg, GLuint dst_mask)
-{
- GLuint read_mask, channel_mask;
- GLuint comp;
-
- ASSERT(arg < _mesa_num_inst_src_regs(inst->Opcode));
-
- /* 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
- */
-static GLuint
-remove_instructions(struct gl_program *prog, const GLboolean *removeFlags)
-{
- GLint i, removeEnd = 0, removeCount = 0;
- GLuint totalRemoved = 0;
-
- /* go backward */
- for (i = prog->NumInstructions - 1; i >= 0; i--) {
- if (removeFlags[i]) {
- totalRemoved++;
- if (removeCount == 0) {
- /* begin a run of instructions to remove */
- removeEnd = i;
- removeCount = 1;
- }
- else {
- /* extend the run of instructions to remove */
- removeCount++;
- }
- }
- else {
- /* don't remove this instruction, but check if the preceeding
- * instructions are to be removed.
- */
- if (removeCount > 0) {
- GLint removeStart = removeEnd - removeCount + 1;
- _mesa_delete_instructions(prog, removeStart, removeCount);
- removeStart = removeCount = 0; /* reset removal info */
- }
- }
- }
- /* Finish removing if the first instruction was to be removed. */
- if (removeCount > 0) {
- GLint removeStart = removeEnd - removeCount + 1;
- _mesa_delete_instructions(prog, removeStart, removeCount);
- }
- return totalRemoved;
-}
-
-
-/**
- * Remap register indexes according to map.
- * \param prog the program to search/replace
- * \param file the type of register file to search/replace
- * \param map maps old register indexes to new indexes
- */
-static void
-replace_regs(struct gl_program *prog, gl_register_file file, const GLint map[])
-{
- GLuint i;
-
- for (i = 0; i < prog->NumInstructions; i++) {
- 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 == file) {
- GLuint index = inst->SrcReg[j].Index;
- ASSERT(map[index] >= 0);
- inst->SrcReg[j].Index = map[index];
- }
- }
- if (inst->DstReg.File == file) {
- const GLuint index = inst->DstReg.Index;
- ASSERT(map[index] >= 0);
- inst->DstReg.Index = map[index];
- }
- }
-}
-
-
-/**
- * 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 GLboolean
-_mesa_remove_dead_code_global(struct gl_program *prog)
-{
- GLboolean tempRead[REG_ALLOCATE_MAX_PROGRAM_TEMPS][4];
- GLboolean *removeInst; /* per-instruction removal flag */
- GLuint i, rem = 0, comp;
-
- memset(tempRead, 0, sizeof(tempRead));
-
- if (dbg) {
- printf("Optimize: Begin dead code removal\n");
- /*_mesa_print_program(prog);*/
- }
-
- removeInst = (GLboolean *)
- calloc(1, prog->NumInstructions * sizeof(GLboolean));
-
- /* Determine which temps are read and written */
- 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;
-
- /* check src regs */
- for (j = 0; j < numSrc; j++) {
- if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) {
- const GLuint index = inst->SrcReg[j].Index;
- GLuint read_mask;
- ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS);
- read_mask = get_src_arg_mask(inst, j, NO_MASK);
-
- if (inst->SrcReg[j].RelAddr) {
- if (dbg)
- printf("abort remove dead code (indirect temp)\n");
- goto done;
- }
-
- for (comp = 0; comp < 4; comp++) {
- const GLuint swz = GET_SWZ(inst->SrcReg[j].Swizzle, comp);
- ASSERT(swz < 4);
- if ((read_mask & (1 << swz)) == 0)
- continue;
- if (swz <= SWIZZLE_W)
- tempRead[index][swz] = GL_TRUE;
- }
- }
- }
-
- /* check dst reg */
- if (inst->DstReg.File == PROGRAM_TEMPORARY) {
- const GLuint index = inst->DstReg.Index;
- ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS);
-
- if (inst->DstReg.RelAddr) {
- if (dbg)
- printf("abort remove dead code (indirect temp)\n");
- goto done;
- }
-
- if (inst->CondUpdate) {
- /* If we're writing to this register and setting condition
- * codes we cannot remove the instruction. Prevent removal
- * by setting the 'read' flag.
- */
- tempRead[index][0] = GL_TRUE;
- tempRead[index][1] = GL_TRUE;
- tempRead[index][2] = GL_TRUE;
- tempRead[index][3] = GL_TRUE;
- }
- }
- }
-
- /* find instructions that write to dead registers, flag for removal */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
- const GLuint numDst = _mesa_num_inst_dst_regs(inst->Opcode);
-
- if (numDst != 0 && inst->DstReg.File == PROGRAM_TEMPORARY) {
- GLint chan, index = inst->DstReg.Index;
-
- for (chan = 0; chan < 4; chan++) {
- if (!tempRead[index][chan] &&
- inst->DstReg.WriteMask & (1 << chan)) {
- if (dbg) {
- printf("Remove writemask on %u.%c\n", i,
- chan == 3 ? 'w' : 'x' + chan);
- }
- inst->DstReg.WriteMask &= ~(1 << chan);
- rem++;
- }
- }
-
- if (inst->DstReg.WriteMask == 0) {
- /* If we cleared all writes, the instruction can be removed. */
- if (dbg)
- printf("Remove instruction %u: \n", i);
- removeInst[i] = GL_TRUE;
- }
- }
- }
-
- /* now remove the instructions which aren't needed */
- rem = remove_instructions(prog, removeInst);
-
- if (dbg) {
- printf("Optimize: End dead code removal.\n");
- printf(" %u channel writes removed\n", rem);
- printf(" %u instructions removed\n", rem);
- /*_mesa_print_program(prog);*/
- }
-
-done:
- free(removeInst);
- return rem != 0;
-}
-
-
-enum inst_use
-{
- READ,
- WRITE,
- FLOW,
- END
-};
-
-
-/**
- * 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 inst_use
-find_next_use(const struct gl_program *prog,
- GLuint start,
- GLuint index,
- GLuint mask)
-{
- GLuint i;
-
- for (i = start; i < prog->NumInstructions; i++) {
- const struct prog_instruction *inst = prog->Instructions + i;
- switch (inst->Opcode) {
- case OPCODE_BGNLOOP:
- 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].RelAddr ||
- (inst->SrcReg[j].File == PROGRAM_TEMPORARY &&
- inst->SrcReg[j].Index == index &&
- (get_src_arg_mask(inst,j,NO_MASK) & mask)))
- return READ;
- }
- 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;
-}
-
-
-/**
- * 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:
- case OPCODE_BGNSUB:
- case OPCODE_BRA:
- case OPCODE_CAL:
- case OPCODE_CONT:
- case OPCODE_IF:
- case OPCODE_ELSE:
- case OPCODE_END:
- case OPCODE_ENDIF:
- case OPCODE_ENDLOOP:
- case OPCODE_ENDSUB:
- case OPCODE_RET:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
-/**
- * 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.
- */
-static void
-_mesa_remove_extra_move_use(struct gl_program *prog)
-{
- GLuint i, j;
-
- if (dbg) {
- printf("Optimize: Begin remove extra move use\n");
- _mesa_print_program(prog);
- }
-
- /*
- * Look for sequences such as this:
- * MOV tmpX, arg0;
- * ...
- * FOO tmpY, tmpX, arg1;
- * and convert into:
- * MOV tmpX, arg0;
- * ...
- * FOO tmpY, arg0, arg1;
- */
-
- 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;
-
- /* 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
- * this MOV.
- */
- for (j = i + 1; j < prog->NumInstructions; j++) {
- struct prog_instruction *inst2 = prog->Instructions + j;
- 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++) {
- 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);
-
- /* 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;
- }
- }
-
- /* 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;
- }
- }
-
- if (dbg) {
- printf("Optimize: End remove extra move use.\n");
- /*_mesa_print_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 GLboolean
-_mesa_remove_extra_moves(struct gl_program *prog)
-{
- GLboolean *removeInst; /* per-instruction removal flag */
- GLuint i, rem = 0, nesting = 0;
-
- if (dbg) {
- printf("Optimize: Begin remove extra moves\n");
- _mesa_print_program(prog);
- }
-
- removeInst = (GLboolean *)
- calloc(1, prog->NumInstructions * sizeof(GLboolean));
-
- /*
- * Look for sequences such as this:
- * FOO tmpX, arg0, arg1;
- * MOV tmpY, tmpX;
- * and convert into:
- * FOO tmpY, arg0, arg1;
- */
-
- for (i = 0; i < prog->NumInstructions; i++) {
- const struct prog_instruction *mov = prog->Instructions + i;
-
- switch (mov->Opcode) {
- case OPCODE_BGNLOOP:
- case OPCODE_BGNSUB:
- case OPCODE_IF:
- nesting++;
- break;
- case OPCODE_ENDLOOP:
- case OPCODE_ENDSUB:
- case OPCODE_ENDIF:
- nesting--;
- break;
- case OPCODE_MOV:
- if (i > 0 &&
- can_downward_mov_be_modifed(mov) &&
- mov->SrcReg[0].File == PROGRAM_TEMPORARY &&
- nesting == 0)
- {
-
- /* see if this MOV can be removed */
- const GLuint id = mov->SrcReg[0].Index;
- struct prog_instruction *prevInst;
- GLuint prevI;
-
- /* get pointer to previous instruction */
- prevI = i - 1;
- while (prevI > 0 && removeInst[prevI])
- prevI--;
- prevInst = prog->Instructions + prevI;
-
- if (prevInst->DstReg.File == PROGRAM_TEMPORARY &&
- prevInst->DstReg.Index == id &&
- prevInst->DstReg.RelAddr == 0 &&
- prevInst->DstReg.CondSrc == 0 &&
- prevInst->DstReg.CondMask == COND_TR) {
-
- 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.
- * Transform:
- * prevI: FOO tempIndex, x, y;
- * i: MOV z, tempIndex;
- * Into:
- * prevI: FOO z, x, y;
- */
- 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);
- }
- }
- }
- }
- }
- break;
- default:
- ; /* nothing */
- }
- }
-
- /* now remove the instructions which aren't needed */
- rem = remove_instructions(prog, removeInst);
-
- free(removeInst);
-
- if (dbg) {
- printf("Optimize: End remove extra moves. %u instructions removed\n", rem);
- /*_mesa_print_program(prog);*/
- }
-
- return rem != 0;
-}
-
-
-/** A live register interval */
-struct interval
-{
- GLuint Reg; /** The temporary register index */
- GLuint Start, End; /** Start/end instruction numbers */
-};
-
-
-/** A list of register intervals */
-struct interval_list
-{
- GLuint Num;
- struct interval Intervals[REG_ALLOCATE_MAX_PROGRAM_TEMPS];
-};
-
-
-static void
-append_interval(struct interval_list *list, const struct interval *inv)
-{
- list->Intervals[list->Num++] = *inv;
-}
-
-
-/** Insert interval inv into list, sorted by interval end */
-static void
-insert_interval_by_end(struct interval_list *list, const struct interval *inv)
-{
- /* XXX we could do a binary search insertion here since list is sorted */
- GLint i = list->Num - 1;
- while (i >= 0 && list->Intervals[i].End > inv->End) {
- list->Intervals[i + 1] = list->Intervals[i];
- i--;
- }
- list->Intervals[i + 1] = *inv;
- list->Num++;
-
-#ifdef DEBUG
- {
- GLuint i;
- for (i = 0; i + 1 < list->Num; i++) {
- ASSERT(list->Intervals[i].End <= list->Intervals[i + 1].End);
- }
- }
-#endif
-}
-
-
-/** Remove the given interval from the interval list */
-static void
-remove_interval(struct interval_list *list, const struct interval *inv)
-{
- /* XXX we could binary search since list is sorted */
- GLuint k;
- for (k = 0; k < list->Num; k++) {
- if (list->Intervals[k].Reg == inv->Reg) {
- /* found, remove it */
- ASSERT(list->Intervals[k].Start == inv->Start);
- ASSERT(list->Intervals[k].End == inv->End);
- while (k < list->Num - 1) {
- list->Intervals[k] = list->Intervals[k + 1];
- k++;
- }
- list->Num--;
- return;
- }
- }
-}
-
-
-/** called by qsort() */
-static int
-compare_start(const void *a, const void *b)
-{
- const struct interval *ia = (const struct interval *) a;
- const struct interval *ib = (const struct interval *) b;
- if (ia->Start < ib->Start)
- return -1;
- else if (ia->Start > ib->Start)
- return +1;
- else
- return 0;
-}
-
-
-/** sort the interval list according to interval starts */
-static void
-sort_interval_list_by_start(struct interval_list *list)
-{
- qsort(list->Intervals, list->Num, sizeof(struct interval), compare_start);
-#ifdef DEBUG
- {
- GLuint i;
- for (i = 0; i + 1 < list->Num; i++) {
- ASSERT(list->Intervals[i].Start <= list->Intervals[i + 1].Start);
- }
- }
-#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[],
- struct loop_info *loopStack, GLuint loopStackDepth,
- GLuint index, GLuint ic)
-{
- 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;
- }
- else {
- intEnd[index] = ic;
- }
-}
-
-
-/**
- * Find first/last instruction that references each temporary register.
- */
-GLboolean
-_mesa_find_temp_intervals(const struct prog_instruction *instructions,
- GLuint numInstructions,
- GLint intBegin[REG_ALLOCATE_MAX_PROGRAM_TEMPS],
- GLint intEnd[REG_ALLOCATE_MAX_PROGRAM_TEMPS])
-{
- struct loop_info loopStack[MAX_LOOP_NESTING];
- GLuint loopStackDepth = 0;
- GLuint i;
-
- for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++){
- intBegin[i] = intEnd[i] = -1;
- }
-
- /* Scan instructions looking for temporary registers */
- for (i = 0; i < numInstructions; i++) {
- const struct prog_instruction *inst = instructions + i;
- if (inst->Opcode == OPCODE_BGNLOOP) {
- loopStack[loopStackDepth].Start = i;
- loopStack[loopStackDepth].End = inst->BranchTarget;
- loopStackDepth++;
- }
- else if (inst->Opcode == OPCODE_ENDLOOP) {
- loopStackDepth--;
- }
- else if (inst->Opcode == OPCODE_CAL) {
- return GL_FALSE;
- }
- else {
- const GLuint numSrc = 3;/*_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;
- if (inst->SrcReg[j].RelAddr)
- return GL_FALSE;
- 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, loopStack, loopStackDepth,
- index, i);
- }
- }
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Find the live intervals for each temporary register in the program.
- * For register R, the interval [A,B] indicates that R is referenced
- * from instruction A through instruction B.
- * Special consideration is needed for loops and subroutines.
- * \return GL_TRUE if success, GL_FALSE if we cannot proceed for some reason
- */
-static GLboolean
-find_live_intervals(struct gl_program *prog,
- struct interval_list *liveIntervals)
-{
- GLint intBegin[REG_ALLOCATE_MAX_PROGRAM_TEMPS];
- GLint intEnd[REG_ALLOCATE_MAX_PROGRAM_TEMPS];
- GLuint i;
-
- /*
- * Note: we'll return GL_FALSE below if we find relative indexing
- * into the TEMP register file. We can't handle that yet.
- * We also give up on subroutines for now.
- */
-
- if (dbg) {
- printf("Optimize: Begin find intervals\n");
- }
-
- /* build intermediate arrays */
- if (!_mesa_find_temp_intervals(prog->Instructions, prog->NumInstructions,
- intBegin, intEnd))
- return GL_FALSE;
-
- /* Build live intervals list from intermediate arrays */
- liveIntervals->Num = 0;
- for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++) {
- if (intBegin[i] >= 0) {
- struct interval inv;
- inv.Reg = i;
- inv.Start = intBegin[i];
- inv.End = intEnd[i];
- append_interval(liveIntervals, &inv);
- }
- }
-
- /* Sort the list according to interval starts */
- sort_interval_list_by_start(liveIntervals);
-
- if (dbg) {
- /* print interval info */
- for (i = 0; i < liveIntervals->Num; i++) {
- const struct interval *inv = liveIntervals->Intervals + i;
- printf("Reg[%d] live [%d, %d]:",
- inv->Reg, inv->Start, inv->End);
- if (1) {
- GLuint j;
- for (j = 0; j < inv->Start; j++)
- printf(" ");
- for (j = inv->Start; j <= inv->End; j++)
- printf("x");
- }
- printf("\n");
- }
- }
-
- return GL_TRUE;
-}
-
-
-/** Scan the array of used register flags to find free entry */
-static GLint
-alloc_register(GLboolean usedRegs[REG_ALLOCATE_MAX_PROGRAM_TEMPS])
-{
- GLuint k;
- for (k = 0; k < REG_ALLOCATE_MAX_PROGRAM_TEMPS; k++) {
- if (!usedRegs[k]) {
- usedRegs[k] = GL_TRUE;
- return k;
- }
- }
- return -1;
-}
-
-
-/**
- * This function implements "Linear Scan Register Allocation" to reduce
- * the number of temporary registers used by the program.
- *
- * We compute the "live interval" for all temporary registers then
- * examine the overlap of the intervals to allocate new registers.
- * Basically, if two intervals do not overlap, they can use the same register.
- */
-static void
-_mesa_reallocate_registers(struct gl_program *prog)
-{
- struct interval_list liveIntervals;
- GLint registerMap[REG_ALLOCATE_MAX_PROGRAM_TEMPS];
- GLboolean usedRegs[REG_ALLOCATE_MAX_PROGRAM_TEMPS];
- GLuint i;
- GLint maxTemp = -1;
-
- if (dbg) {
- printf("Optimize: Begin live-interval register reallocation\n");
- _mesa_print_program(prog);
- }
-
- for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++){
- registerMap[i] = -1;
- usedRegs[i] = GL_FALSE;
- }
-
- if (!find_live_intervals(prog, &liveIntervals)) {
- if (dbg)
- printf("Aborting register reallocation\n");
- return;
- }
-
- {
- struct interval_list activeIntervals;
- activeIntervals.Num = 0;
-
- /* loop over live intervals, allocating a new register for each */
- for (i = 0; i < liveIntervals.Num; i++) {
- const struct interval *live = liveIntervals.Intervals + i;
-
- if (dbg)
- printf("Consider register %u\n", live->Reg);
-
- /* Expire old intervals. Intervals which have ended with respect
- * to the live interval can have their remapped registers freed.
- */
- {
- GLint j;
- for (j = 0; j < (GLint) activeIntervals.Num; j++) {
- const struct interval *inv = activeIntervals.Intervals + j;
- if (inv->End >= live->Start) {
- /* Stop now. Since the activeInterval list is sorted
- * we know we don't have to go further.
- */
- break;
- }
- else {
- /* Interval 'inv' has expired */
- const GLint regNew = registerMap[inv->Reg];
- ASSERT(regNew >= 0);
-
- if (dbg)
- printf(" expire interval for reg %u\n", inv->Reg);
-
- /* remove interval j from active list */
- remove_interval(&activeIntervals, inv);
- j--; /* counter-act j++ in for-loop above */
-
- /* return register regNew to the free pool */
- if (dbg)
- printf(" free reg %d\n", regNew);
- ASSERT(usedRegs[regNew] == GL_TRUE);
- usedRegs[regNew] = GL_FALSE;
- }
- }
- }
-
- /* find a free register for this live interval */
- {
- const GLint k = alloc_register(usedRegs);
- if (k < 0) {
- /* out of registers, give up */
- return;
- }
- registerMap[live->Reg] = k;
- maxTemp = MAX2(maxTemp, k);
- if (dbg)
- printf(" remap register %u -> %d\n", live->Reg, k);
- }
-
- /* Insert this live interval into the active list which is sorted
- * by increasing end points.
- */
- insert_interval_by_end(&activeIntervals, live);
- }
- }
-
- if (maxTemp + 1 < (GLint) liveIntervals.Num) {
- /* OK, we've reduced the number of registers needed.
- * Scan the program and replace all the old temporary register
- * indexes with the new indexes.
- */
- replace_regs(prog, PROGRAM_TEMPORARY, registerMap);
-
- prog->NumTemporaries = maxTemp + 1;
- }
-
- if (dbg) {
- printf("Optimize: End live-interval register reallocation\n");
- printf("Num temp regs before: %u after: %u\n",
- liveIntervals.Num, maxTemp + 1);
- _mesa_print_program(prog);
- }
-}
-
-
-#if 0
-static void
-print_it(struct gl_context *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.
- */
-void
-_mesa_optimize_program(struct gl_context *ctx, struct gl_program *program)
-{
- 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/src/mesa/program/prog_optimize.h b/src/mesa/program/prog_optimize.h
deleted file mode 100644
index 00f1080..0000000
--- a/src/mesa/program/prog_optimize.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * 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
- * VMWARE 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 PROG_OPT_H
-#define PROG_OPT_H
-
-
-#include "main/config.h"
-#include "main/mtypes.h"
-
-
-struct gl_program;
-struct prog_instruction;
-
-
-extern GLboolean
-_mesa_find_temp_intervals(const struct prog_instruction *instructions,
- GLuint numInstructions,
- GLint intBegin[MAX_PROGRAM_TEMPS],
- GLint intEnd[MAX_PROGRAM_TEMPS]);
-
-extern void
-_mesa_optimize_program(struct gl_context *ctx, struct gl_program *program);
-
-#endif
diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c
deleted file mode 100644
index 3570cab..0000000
--- a/src/mesa/program/prog_parameter.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.3
- *
- * 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 prog_parameter.c
- * Program parameter lists and functions.
- * \author Brian Paul
- */
-
-
-#include "main/glheader.h"
-#include "main/imports.h"
-#include "main/macros.h"
-#include "prog_instruction.h"
-#include "prog_parameter.h"
-#include "prog_statevars.h"
-
-
-struct gl_program_parameter_list *
-_mesa_new_parameter_list(void)
-{
- return CALLOC_STRUCT(gl_program_parameter_list);
-}
-
-
-struct gl_program_parameter_list *
-_mesa_new_parameter_list_sized(unsigned size)
-{
- struct gl_program_parameter_list *p = _mesa_new_parameter_list();
-
- if ((p != NULL) && (size != 0)) {
- p->Size = size;
-
- /* alloc arrays */
- p->Parameters = (struct gl_program_parameter *)
- calloc(1, size * sizeof(struct gl_program_parameter));
-
- p->ParameterValues = (GLfloat (*)[4])
- _mesa_align_malloc(size * 4 *sizeof(GLfloat), 16);
-
-
- if ((p->Parameters == NULL) || (p->ParameterValues == NULL)) {
- free(p->Parameters);
- _mesa_align_free(p->ParameterValues);
- free(p);
- p = NULL;
- }
- }
-
- return p;
-}
-
-
-/**
- * Free a parameter list and all its parameters
- */
-void
-_mesa_free_parameter_list(struct gl_program_parameter_list *paramList)
-{
- GLuint i;
- for (i = 0; i < paramList->NumParameters; i++) {
- if (paramList->Parameters[i].Name)
- free((void *) paramList->Parameters[i].Name);
- }
- free(paramList->Parameters);
- if (paramList->ParameterValues)
- _mesa_align_free(paramList->ParameterValues);
- free(paramList);
-}
-
-
-/**
- * Add a new parameter to a parameter list.
- * Note that parameter values are usually 4-element GLfloat vectors.
- * When size > 4 we'll allocate a sequential block of parameters to
- * store all the values (in blocks of 4).
- *
- * \param paramList the list to add the parameter to
- * \param type type of parameter, such as
- * \param name the parameter name, will be duplicated/copied!
- * \param size number of elements in 'values' vector (1..4, or more)
- * \param datatype GL_FLOAT, GL_FLOAT_VECx, GL_INT, GL_INT_VECx or GL_NONE.
- * \param values initial parameter value, up to 4 GLfloats, or NULL
- * \param state state indexes, or NULL
- * \return index of new parameter in the list, or -1 if error (out of mem)
- */
-GLint
-_mesa_add_parameter(struct gl_program_parameter_list *paramList,
- gl_register_file type, const char *name,
- GLuint size, GLenum datatype, const GLfloat *values,
- const gl_state_index state[STATE_LENGTH],
- GLbitfield flags)
-{
- const GLuint oldNum = paramList->NumParameters;
- const GLuint sz4 = (size + 3) / 4; /* no. of new param slots needed */
-
- assert(size > 0);
-
- if (oldNum + sz4 > paramList->Size) {
- /* Need to grow the parameter list array (alloc some extra) */
- paramList->Size = paramList->Size + 4 * sz4;
-
- /* realloc arrays */
- paramList->Parameters = (struct gl_program_parameter *)
- _mesa_realloc(paramList->Parameters,
- oldNum * sizeof(struct gl_program_parameter),
- paramList->Size * sizeof(struct gl_program_parameter));
-
- paramList->ParameterValues = (GLfloat (*)[4])
- _mesa_align_realloc(paramList->ParameterValues, /* old buf */
- oldNum * 4 * sizeof(GLfloat), /* old size */
- paramList->Size * 4 *sizeof(GLfloat), /* new sz */
- 16);
- }
-
- if (!paramList->Parameters ||
- !paramList->ParameterValues) {
- /* out of memory */
- paramList->NumParameters = 0;
- paramList->Size = 0;
- return -1;
- }
- else {
- GLuint i;
-
- paramList->NumParameters = oldNum + sz4;
-
- memset(&paramList->Parameters[oldNum], 0,
- sz4 * sizeof(struct gl_program_parameter));
-
- for (i = 0; i < sz4; i++) {
- struct gl_program_parameter *p = paramList->Parameters + oldNum + i;
- p->Name = name ? _mesa_strdup(name) : NULL;
- p->Type = type;
- p->Size = size;
- p->DataType = datatype;
- p->Flags = flags;
- if (values) {
- COPY_4V(paramList->ParameterValues[oldNum + i], values);
- values += 4;
- p->Initialized = GL_TRUE;
- }
- else {
- /* silence valgrind */
- ASSIGN_4V(paramList->ParameterValues[oldNum + i], 0, 0, 0, 0);
- }
- size -= 4;
- }
-
- if (state) {
- for (i = 0; i < STATE_LENGTH; i++)
- paramList->Parameters[oldNum].StateIndexes[i] = state[i];
- }
-
- return (GLint) oldNum;
- }
-}
-
-
-/**
- * Add a new named program parameter (Ex: NV_fragment_program DEFINE statement)
- * \return index of the new entry in the parameter list
- */
-GLint
-_mesa_add_named_parameter(struct gl_program_parameter_list *paramList,
- const char *name, const GLfloat values[4])
-{
- return _mesa_add_parameter(paramList, PROGRAM_NAMED_PARAM, name,
- 4, GL_NONE, values, NULL, 0x0);
-
-}
-
-
-/**
- * Add a new named constant to the parameter list.
- * This will be used when the program contains something like this:
- * PARAM myVals = { 0, 1, 2, 3 };
- *
- * \param paramList the parameter list
- * \param name the name for the constant
- * \param values four float values
- * \return index/position of the new parameter in the parameter list
- */
-GLint
-_mesa_add_named_constant(struct gl_program_parameter_list *paramList,
- const char *name, const GLfloat values[4],
- GLuint size)
-{
- /* first check if this is a duplicate constant */
- GLint pos;
- for (pos = 0; pos < (GLint)paramList->NumParameters; pos++) {
- const GLfloat *pvals = paramList->ParameterValues[pos];
- if (pvals[0] == values[0] &&
- pvals[1] == values[1] &&
- pvals[2] == values[2] &&
- pvals[3] == values[3] &&
- strcmp(paramList->Parameters[pos].Name, name) == 0) {
- /* Same name and value is already in the param list - reuse it */
- return pos;
- }
- }
- /* not found, add new parameter */
- return _mesa_add_parameter(paramList, PROGRAM_CONSTANT, name,
- size, GL_NONE, values, NULL, 0x0);
-}
-
-
-/**
- * Add a new unnamed constant to the parameter list. This will be used
- * when a fragment/vertex program contains something like this:
- * MOV r, { 0, 1, 2, 3 };
- * If swizzleOut is non-null we'll search the parameter list for an
- * existing instance of the constant which matches with a swizzle.
- *
- * \param paramList the parameter list
- * \param values four float values
- * \param swizzleOut returns swizzle mask for accessing the constant
- * \return index/position of the new parameter in the parameter list.
- */
-GLint
-_mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList,
- const GLfloat values[4], GLuint size,
- GLuint *swizzleOut)
-{
- GLint pos;
- ASSERT(size >= 1);
- ASSERT(size <= 4);
-
- if (swizzleOut &&
- _mesa_lookup_parameter_constant(paramList, values,
- size, &pos, swizzleOut)) {
- return pos;
- }
-
- /* Look for empty space in an already unnamed constant parameter
- * to add this constant. This will only work for single-element
- * constants because we rely on smearing (i.e. .yyyy or .zzzz).
- */
- if (size == 1 && swizzleOut) {
- for (pos = 0; pos < (GLint) paramList->NumParameters; pos++) {
- struct gl_program_parameter *p = paramList->Parameters + pos;
- if (p->Type == PROGRAM_CONSTANT && p->Size + size <= 4) {
- /* ok, found room */
- GLfloat *pVal = paramList->ParameterValues[pos];
- GLuint swz = p->Size; /* 1, 2 or 3 for Y, Z, W */
- pVal[p->Size] = values[0];
- p->Size++;
- *swizzleOut = MAKE_SWIZZLE4(swz, swz, swz, swz);
- return pos;
- }
- }
- }
-
- /* add a new parameter to store this constant */
- pos = _mesa_add_parameter(paramList, PROGRAM_CONSTANT, NULL,
- size, GL_NONE, values, NULL, 0x0);
- if (pos >= 0 && swizzleOut) {
- if (size == 1)
- *swizzleOut = SWIZZLE_XXXX;
- else
- *swizzleOut = SWIZZLE_NOOP;
- }
- return pos;
-}
-
-/**
- * Add parameter representing a varying variable.
- */
-GLint
-_mesa_add_varying(struct gl_program_parameter_list *paramList,
- 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) {
- /* already in list */
- return i;
- }
- else {
- /*assert(size == 4);*/
- i = _mesa_add_parameter(paramList, PROGRAM_VARYING, name,
- size, datatype, NULL, NULL, flags);
- return i;
- }
-}
-
-
-/**
- * Add parameter representing a vertex program attribute.
- * \param size size of attribute (in floats), may be -1 if unknown
- * \param attrib the attribute index, or -1 if unknown
- */
-GLint
-_mesa_add_attribute(struct gl_program_parameter_list *paramList,
- const char *name, GLint size, GLenum datatype, GLint attrib)
-{
- GLint i = _mesa_lookup_parameter_index(paramList, -1, name);
- if (i >= 0) {
- /* replace */
- if (attrib < 0)
- attrib = i;
- paramList->Parameters[i].StateIndexes[0] = attrib;
- }
- else {
- /* add */
- gl_state_index state[STATE_LENGTH];
- state[0] = (gl_state_index) attrib;
- if (size < 0)
- size = 4;
- i = _mesa_add_parameter(paramList, PROGRAM_INPUT, name,
- size, datatype, NULL, state, 0x0);
- }
- return i;
-}
-
-
-
-#if 0 /* not used yet */
-/**
- * Returns the number of 4-component registers needed to store a piece
- * of GL state. For matrices this may be as many as 4 registers,
- * everything else needs
- * just 1 register.
- */
-static GLuint
-sizeof_state_reference(const GLint *stateTokens)
-{
- if (stateTokens[0] == STATE_MATRIX) {
- GLuint rows = stateTokens[4] - stateTokens[3] + 1;
- assert(rows >= 1);
- assert(rows <= 4);
- return rows;
- }
- else {
- return 1;
- }
-}
-#endif
-
-
-/**
- * Add a new state reference to the parameter list.
- * This will be used when the program contains something like this:
- * PARAM ambient = state.material.front.ambient;
- *
- * \param paramList the parameter list
- * \param stateTokens an array of 5 (STATE_LENGTH) state tokens
- * \return index of the new parameter.
- */
-GLint
-_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
- const gl_state_index stateTokens[STATE_LENGTH])
-{
- const GLuint size = 4; /* XXX fix */
- char *name;
- GLint index;
-
- /* Check if the state reference is already in the list */
- for (index = 0; index < (GLint) paramList->NumParameters; index++) {
- if (!memcmp(paramList->Parameters[index].StateIndexes,
- stateTokens, STATE_LENGTH * sizeof(gl_state_index))) {
- return index;
- }
- }
-
- name = _mesa_program_state_string(stateTokens);
- index = _mesa_add_parameter(paramList, PROGRAM_STATE_VAR, name,
- size, GL_NONE,
- NULL, (gl_state_index *) stateTokens, 0x0);
- paramList->StateFlags |= _mesa_program_state_flags(stateTokens);
-
- /* free name string here since we duplicated it in add_parameter() */
- free(name);
-
- return index;
-}
-
-
-/**
- * Lookup a parameter value by name in the given parameter list.
- * \return pointer to the float[4] values.
- */
-GLfloat *
-_mesa_lookup_parameter_value(const struct gl_program_parameter_list *paramList,
- GLsizei nameLen, const char *name)
-{
- GLint i = _mesa_lookup_parameter_index(paramList, nameLen, name);
- if (i < 0)
- return NULL;
- else
- return paramList->ParameterValues[i];
-}
-
-
-/**
- * Given a program parameter name, find its position in the list of parameters.
- * \param paramList the parameter list to search
- * \param nameLen length of name (in chars).
- * If length is negative, assume that name is null-terminated.
- * \param name the name to search for
- * \return index of parameter in the list.
- */
-GLint
-_mesa_lookup_parameter_index(const struct gl_program_parameter_list *paramList,
- GLsizei nameLen, const char *name)
-{
- GLint i;
-
- if (!paramList)
- return -1;
-
- if (nameLen == -1) {
- /* name is null-terminated */
- for (i = 0; i < (GLint) paramList->NumParameters; i++) {
- if (paramList->Parameters[i].Name &&
- strcmp(paramList->Parameters[i].Name, name) == 0)
- return i;
- }
- }
- else {
- /* name is not null-terminated, use nameLen */
- for (i = 0; i < (GLint) paramList->NumParameters; i++) {
- if (paramList->Parameters[i].Name &&
- strncmp(paramList->Parameters[i].Name, name, nameLen) == 0
- && strlen(paramList->Parameters[i].Name) == (size_t)nameLen)
- return i;
- }
- }
- return -1;
-}
-
-
-/**
- * Look for a float vector in the given parameter list. The float vector
- * may be of length 1, 2, 3 or 4. If swizzleOut is non-null, we'll try
- * swizzling to find a match.
- * \param list the parameter list to search
- * \param v the float vector to search for
- * \param vSize number of element in v
- * \param posOut returns the position of the constant, if found
- * \param swizzleOut returns a swizzle mask describing location of the
- * vector elements if found.
- * \return GL_TRUE if found, GL_FALSE if not found
- */
-GLboolean
-_mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list,
- const GLfloat v[], GLuint vSize,
- GLint *posOut, GLuint *swizzleOut)
-{
- GLuint i;
-
- assert(vSize >= 1);
- assert(vSize <= 4);
-
- if (!list) {
- *posOut = -1;
- return GL_FALSE;
- }
-
- for (i = 0; i < list->NumParameters; i++) {
- if (list->Parameters[i].Type == PROGRAM_CONSTANT) {
- if (!swizzleOut) {
- /* swizzle not allowed */
- GLuint j, match = 0;
- for (j = 0; j < vSize; j++) {
- if (v[j] == list->ParameterValues[i][j])
- match++;
- }
- if (match == vSize) {
- *posOut = i;
- return GL_TRUE;
- }
- }
- else {
- /* try matching w/ swizzle */
- if (vSize == 1) {
- /* look for v[0] anywhere within float[4] value */
- GLuint j;
- for (j = 0; j < list->Parameters[i].Size; j++) {
- if (list->ParameterValues[i][j] == v[0]) {
- /* found it */
- *posOut = i;
- *swizzleOut = MAKE_SWIZZLE4(j, j, j, j);
- return GL_TRUE;
- }
- }
- }
- else if (vSize <= list->Parameters[i].Size) {
- /* see if we can match this constant (with a swizzle) */
- GLuint swz[4];
- GLuint match = 0, j, k;
- for (j = 0; j < vSize; j++) {
- if (v[j] == list->ParameterValues[i][j]) {
- swz[j] = j;
- match++;
- }
- else {
- for (k = 0; k < list->Parameters[i].Size; k++) {
- if (v[j] == list->ParameterValues[i][k]) {
- swz[j] = k;
- match++;
- break;
- }
- }
- }
- }
- /* smear last value to remaining positions */
- for (; j < 4; j++)
- swz[j] = swz[j-1];
-
- if (match == vSize) {
- *posOut = i;
- *swizzleOut = MAKE_SWIZZLE4(swz[0], swz[1], swz[2], swz[3]);
- return GL_TRUE;
- }
- }
- }
- }
- }
-
- *posOut = -1;
- return GL_FALSE;
-}
-
-
-struct gl_program_parameter_list *
-_mesa_clone_parameter_list(const struct gl_program_parameter_list *list)
-{
- struct gl_program_parameter_list *clone;
- GLuint i;
-
- clone = _mesa_new_parameter_list();
- if (!clone)
- return NULL;
-
- /** Not too efficient, but correct */
- for (i = 0; i < list->NumParameters; i++) {
- struct gl_program_parameter *p = list->Parameters + i;
- struct gl_program_parameter *pCopy;
- GLuint size = MIN2(p->Size, 4);
- GLint j = _mesa_add_parameter(clone, p->Type, p->Name, size, p->DataType,
- list->ParameterValues[i], NULL, 0x0);
- ASSERT(j >= 0);
- pCopy = clone->Parameters + j;
- pCopy->Flags = p->Flags;
- /* copy state indexes */
- if (p->Type == PROGRAM_STATE_VAR) {
- GLint k;
- for (k = 0; k < STATE_LENGTH; k++) {
- pCopy->StateIndexes[k] = p->StateIndexes[k];
- }
- }
- else {
- clone->Parameters[j].Size = p->Size;
- }
-
- }
-
- clone->StateFlags = list->StateFlags;
-
- return clone;
-}
-
-
-/**
- * Return a new parameter list which is listA + listB.
- */
-struct gl_program_parameter_list *
-_mesa_combine_parameter_lists(const struct gl_program_parameter_list *listA,
- const struct gl_program_parameter_list *listB)
-{
- struct gl_program_parameter_list *list;
-
- if (listA) {
- list = _mesa_clone_parameter_list(listA);
- if (list && listB) {
- GLuint i;
- for (i = 0; i < listB->NumParameters; i++) {
- struct gl_program_parameter *param = listB->Parameters + i;
- _mesa_add_parameter(list, param->Type, param->Name, param->Size,
- param->DataType,
- listB->ParameterValues[i],
- param->StateIndexes,
- param->Flags);
- }
- }
- }
- else if (listB) {
- list = _mesa_clone_parameter_list(listB);
- }
- else {
- list = NULL;
- }
- return list;
-}
-
-
-
-/**
- * Find longest name of all uniform parameters in list.
- */
-GLuint
-_mesa_longest_parameter_name(const struct gl_program_parameter_list *list,
- gl_register_file type)
-{
- GLuint i, maxLen = 0;
- if (!list)
- return 0;
- for (i = 0; i < list->NumParameters; i++) {
- if (list->Parameters[i].Type == type) {
- GLuint len = strlen(list->Parameters[i].Name);
- if (len > maxLen)
- maxLen = len;
- }
- }
- return maxLen;
-}
-
-
-/**
- * Count the number of parameters in the last that match the given type.
- */
-GLuint
-_mesa_num_parameters_of_type(const struct gl_program_parameter_list *list,
- gl_register_file type)
-{
- GLuint i, count = 0;
- if (list) {
- for (i = 0; i < list->NumParameters; i++) {
- if (list->Parameters[i].Type == type)
- count++;
- }
- }
- return count;
-}
diff --git a/src/mesa/program/prog_parameter_layout.c b/src/mesa/program/prog_parameter_layout.c
deleted file mode 100644
index d7dc97e..0000000
--- a/src/mesa/program/prog_parameter_layout.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \file prog_parameter_layout.c
- * \brief Helper functions to layout storage for program parameters
- *
- * \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"
-#include "prog_instruction.h"
-#include "program_parser.h"
-
-unsigned
-_mesa_combine_swizzles(unsigned base, unsigned applied)
-{
- unsigned swiz = 0;
- unsigned i;
-
- for (i = 0; i < 4; i++) {
- const unsigned s = GET_SWZ(applied, i);
-
- swiz |= ((s <= SWIZZLE_W) ? GET_SWZ(base, s) : s) << (i * 3);
- }
-
- return swiz;
-}
-
-
-/**
- * Copy indirect access array from one parameter list to another
- *
- * \param src Parameter array copied from
- * \param dst Parameter array copied to
- * \param first Index of first element in \c src to copy
- * \param count Number of elements to copy
- *
- * \return
- * The location in \c dst of the first element copied from \c src on
- * success. -1 on failure.
- *
- * \warning
- * This function assumes that there is already enough space available in
- * \c dst to hold all of the elements that will be copied over.
- */
-static int
-copy_indirect_accessed_array(struct gl_program_parameter_list *src,
- struct gl_program_parameter_list *dst,
- unsigned first, unsigned count)
-{
- const int base = dst->NumParameters;
- unsigned i, j;
-
- for (i = first; i < (first + count); i++) {
- struct gl_program_parameter *curr = & src->Parameters[i];
-
- if (curr->Type == PROGRAM_CONSTANT) {
- j = dst->NumParameters;
- } else {
- for (j = 0; j < dst->NumParameters; j++) {
- if (memcmp(dst->Parameters[j].StateIndexes, curr->StateIndexes,
- sizeof(curr->StateIndexes)) == 0) {
- return -1;
- }
- }
- }
-
- assert(j == dst->NumParameters);
-
- /* copy src parameter [i] to dest parameter [j] */
- memcpy(& dst->Parameters[j], curr,
- sizeof(dst->Parameters[j]));
- memcpy(dst->ParameterValues[j], src->ParameterValues[i],
- sizeof(GLfloat) * 4);
-
- /* Pointer to the string name was copied. Null-out src param name
- * to prevent double free later.
- */
- curr->Name = NULL;
-
- dst->NumParameters++;
- }
-
- return base;
-}
-
-
-/**
- * XXX description???
- * \return GL_TRUE for success, GL_FALSE for failure
- */
-GLboolean
-_mesa_layout_parameters(struct asm_parser_state *state)
-{
- struct gl_program_parameter_list *layout;
- struct asm_instruction *inst;
- unsigned i;
-
- layout =
- _mesa_new_parameter_list_sized(state->prog->Parameters->NumParameters);
-
- /* PASS 1: Move any parameters that are accessed indirectly from the
- * original parameter list to the new parameter list.
- */
- for (inst = state->inst_head; inst != NULL; inst = inst->next) {
- for (i = 0; i < 3; i++) {
- if (inst->SrcReg[i].Base.RelAddr) {
- /* Only attempt to add the to the new parameter list once.
- */
- if (!inst->SrcReg[i].Symbol->pass1_done) {
- const int new_begin =
- copy_indirect_accessed_array(state->prog->Parameters, layout,
- inst->SrcReg[i].Symbol->param_binding_begin,
- inst->SrcReg[i].Symbol->param_binding_length);
-
- if (new_begin < 0) {
- return GL_FALSE;
- }
-
- inst->SrcReg[i].Symbol->param_binding_begin = new_begin;
- inst->SrcReg[i].Symbol->pass1_done = 1;
- }
-
- /* Previously the Index was just the offset from the parameter
- * array. Now that the base of the parameter array is known, the
- * index can be updated to its actual value.
- */
- inst->Base.SrcReg[i] = inst->SrcReg[i].Base;
- inst->Base.SrcReg[i].Index +=
- inst->SrcReg[i].Symbol->param_binding_begin;
- }
- }
- }
-
- /* PASS 2: Move any parameters that are not accessed indirectly from the
- * original parameter list to the new parameter list.
- */
- for (inst = state->inst_head; inst != NULL; inst = inst->next) {
- for (i = 0; i < 3; i++) {
- const struct gl_program_parameter *p;
- const int idx = inst->SrcReg[i].Base.Index;
- unsigned swizzle = SWIZZLE_NOOP;
-
- /* All relative addressed operands were processed on the first
- * pass. Just skip them here.
- */
- if (inst->SrcReg[i].Base.RelAddr) {
- continue;
- }
-
- if ((inst->SrcReg[i].Base.File <= PROGRAM_VARYING )
- || (inst->SrcReg[i].Base.File >= PROGRAM_WRITE_ONLY)) {
- continue;
- }
-
- inst->Base.SrcReg[i] = inst->SrcReg[i].Base;
- p = & state->prog->Parameters->Parameters[idx];
-
- switch (p->Type) {
- case PROGRAM_CONSTANT: {
- const float *const v =
- state->prog->Parameters->ParameterValues[idx];
-
- inst->Base.SrcReg[i].Index =
- _mesa_add_unnamed_constant(layout, v, p->Size, & swizzle);
-
- inst->Base.SrcReg[i].Swizzle =
- _mesa_combine_swizzles(swizzle, inst->Base.SrcReg[i].Swizzle);
- break;
- }
-
- case PROGRAM_STATE_VAR:
- inst->Base.SrcReg[i].Index =
- _mesa_add_state_reference(layout, p->StateIndexes);
- break;
-
- default:
- break;
- }
-
- inst->SrcReg[i].Base.File = p->Type;
- inst->Base.SrcReg[i].File = p->Type;
- }
- }
-
- _mesa_free_parameter_list(state->prog->Parameters);
- state->prog->Parameters = layout;
-
- return GL_TRUE;
-}
diff --git a/src/mesa/program/prog_parameter_layout.h b/src/mesa/program/prog_parameter_layout.h
deleted file mode 100644
index 99a7b6c..0000000
--- a/src/mesa/program/prog_parameter_layout.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \file prog_parameter_layout.h
- * \brief Helper functions to layout storage for program parameters
- *
- * \author Ian Romanick <ian.d.romanick@intel.com>
- */
-
-#pragma once
-
-#ifndef PROG_PARAMETER_LAYOUT_H
-#define PROG_PARAMETER_LAYOUT_H
-
-extern unsigned _mesa_combine_swizzles(unsigned base, unsigned applied);
-
-struct asm_parser_state;
-
-extern GLboolean _mesa_layout_parameters(struct asm_parser_state *state);
-
-#endif /* PROG_PARAMETER_LAYOUT_H */
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
deleted file mode 100644
index abebf39..0000000
--- a/src/mesa/program/prog_print.c
+++ /dev/null
@@ -1,1084 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.3
- *
- * Copyright (C) 1999-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 prog_print.c
- * Print vertex/fragment programs - for debugging.
- * \author Brian Paul
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/imports.h"
-#include "prog_instruction.h"
-#include "prog_parameter.h"
-#include "prog_print.h"
-#include "prog_statevars.h"
-
-
-
-/**
- * Return string name for given program/register file.
- */
-const char *
-_mesa_register_file_name(gl_register_file f)
-{
- switch (f) {
- case PROGRAM_TEMPORARY:
- return "TEMP";
- case PROGRAM_LOCAL_PARAM:
- return "LOCAL";
- case PROGRAM_ENV_PARAM:
- return "ENV";
- case PROGRAM_STATE_VAR:
- return "STATE";
- case PROGRAM_INPUT:
- return "INPUT";
- case PROGRAM_OUTPUT:
- return "OUTPUT";
- case PROGRAM_NAMED_PARAM:
- return "NAMED";
- case PROGRAM_CONSTANT:
- return "CONST";
- case PROGRAM_UNIFORM:
- return "UNIFORM";
- case PROGRAM_VARYING:
- return "VARYING";
- case PROGRAM_WRITE_ONLY:
- return "WRITE_ONLY";
- case PROGRAM_ADDRESS:
- return "ADDR";
- case PROGRAM_SAMPLER:
- return "SAMPLER";
- case PROGRAM_UNDEFINED:
- return "UNDEFINED";
- default:
- {
- static char s[20];
- _mesa_snprintf(s, sizeof(s), "FILE%u", f);
- return s;
- }
- }
-}
-
-
-/**
- * Return ARB_v/f_prog-style input attrib string.
- */
-static const char *
-arb_input_attrib_string(GLint index, GLenum progType)
-{
- /*
- * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens.
- */
- const char *vertAttribs[] = {
- "vertex.position",
- "vertex.weight",
- "vertex.normal",
- "vertex.color.primary",
- "vertex.color.secondary",
- "vertex.fogcoord",
- "vertex.(six)",
- "vertex.(seven)",
- "vertex.texcoord[0]",
- "vertex.texcoord[1]",
- "vertex.texcoord[2]",
- "vertex.texcoord[3]",
- "vertex.texcoord[4]",
- "vertex.texcoord[5]",
- "vertex.texcoord[6]",
- "vertex.texcoord[7]",
- "vertex.attrib[0]",
- "vertex.attrib[1]",
- "vertex.attrib[2]",
- "vertex.attrib[3]",
- "vertex.attrib[4]",
- "vertex.attrib[5]",
- "vertex.attrib[6]",
- "vertex.attrib[7]",
- "vertex.attrib[8]",
- "vertex.attrib[9]",
- "vertex.attrib[10]",
- "vertex.attrib[11]",
- "vertex.attrib[12]",
- "vertex.attrib[13]",
- "vertex.attrib[14]",
- "vertex.attrib[15]"
- };
- const char *fragAttribs[] = {
- "fragment.position",
- "fragment.color.primary",
- "fragment.color.secondary",
- "fragment.fogcoord",
- "fragment.texcoord[0]",
- "fragment.texcoord[1]",
- "fragment.texcoord[2]",
- "fragment.texcoord[3]",
- "fragment.texcoord[4]",
- "fragment.texcoord[5]",
- "fragment.texcoord[6]",
- "fragment.texcoord[7]",
- "fragment.varying[0]",
- "fragment.varying[1]",
- "fragment.varying[2]",
- "fragment.varying[3]",
- "fragment.varying[4]",
- "fragment.varying[5]",
- "fragment.varying[6]",
- "fragment.varying[7]"
- };
-
- /* sanity checks */
- assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0);
- assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0);
-
- if (progType == GL_VERTEX_PROGRAM_ARB) {
- assert(index < sizeof(vertAttribs) / sizeof(vertAttribs[0]));
- return vertAttribs[index];
- }
- else {
- assert(index < sizeof(fragAttribs) / sizeof(fragAttribs[0]));
- return fragAttribs[index];
- }
-}
-
-
-/**
- * Print a vertex program's InputsRead field in human-readable format.
- * For debugging.
- */
-void
-_mesa_print_vp_inputs(GLbitfield inputs)
-{
- printf("VP Inputs 0x%x: \n", inputs);
- while (inputs) {
- GLint attr = _mesa_ffs(inputs) - 1;
- const char *name = arb_input_attrib_string(attr,
- GL_VERTEX_PROGRAM_ARB);
- printf(" %d: %s\n", attr, name);
- inputs &= ~(1 << attr);
- }
-}
-
-
-/**
- * Print a fragment program's InputsRead field in human-readable format.
- * For debugging.
- */
-void
-_mesa_print_fp_inputs(GLbitfield inputs)
-{
- printf("FP Inputs 0x%x: \n", inputs);
- while (inputs) {
- GLint attr = _mesa_ffs(inputs) - 1;
- const char *name = arb_input_attrib_string(attr,
- GL_FRAGMENT_PROGRAM_ARB);
- printf(" %d: %s\n", attr, name);
- inputs &= ~(1 << attr);
- }
-}
-
-
-
-/**
- * Return ARB_v/f_prog-style output attrib string.
- */
-static const char *
-arb_output_attrib_string(GLint index, GLenum progType)
-{
- /*
- * These strings should match the VERT_RESULT_x and FRAG_RESULT_x tokens.
- */
- const char *vertResults[] = {
- "result.position",
- "result.color.primary",
- "result.color.secondary",
- "result.fogcoord",
- "result.texcoord[0]",
- "result.texcoord[1]",
- "result.texcoord[2]",
- "result.texcoord[3]",
- "result.texcoord[4]",
- "result.texcoord[5]",
- "result.texcoord[6]",
- "result.texcoord[7]",
- "result.varying[0]",
- "result.varying[1]",
- "result.varying[2]",
- "result.varying[3]",
- "result.varying[4]",
- "result.varying[5]",
- "result.varying[6]",
- "result.varying[7]"
- };
- const char *fragResults[] = {
- "result.color",
- "result.color(half)",
- "result.depth",
- "result.color[0]",
- "result.color[1]",
- "result.color[2]",
- "result.color[3]"
- };
-
- if (progType == GL_VERTEX_PROGRAM_ARB) {
- assert(index < sizeof(vertResults) / sizeof(vertResults[0]));
- return vertResults[index];
- }
- else {
- assert(index < sizeof(fragResults) / sizeof(fragResults[0]));
- return fragResults[index];
- }
-}
-
-
-/**
- * Return string representation of the given register.
- * Note that some types of registers (like PROGRAM_UNIFORM) aren't defined
- * by the ARB/NV program languages so we've taken some liberties here.
- * \param f the register file (PROGRAM_INPUT, PROGRAM_TEMPORARY, etc)
- * \param index number of the register in the register file
- * \param mode the output format/mode/style
- * \param prog pointer to containing program
- */
-static const char *
-reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode,
- GLboolean relAddr, const struct gl_program *prog,
- GLboolean hasIndex2, GLboolean relAddr2, GLint index2)
-{
- static char str[100];
- const char *addr = relAddr ? "ADDR+" : "";
-
- str[0] = 0;
-
- switch (mode) {
- case PROG_PRINT_DEBUG:
- sprintf(str, "%s[%s%d]",
- _mesa_register_file_name(f), 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:
- switch (f) {
- case PROGRAM_INPUT:
- sprintf(str, "%s", arb_input_attrib_string(index, prog->Target));
- break;
- case PROGRAM_OUTPUT:
- sprintf(str, "%s", arb_output_attrib_string(index, prog->Target));
- break;
- case PROGRAM_TEMPORARY:
- sprintf(str, "temp%d", index);
- break;
- case PROGRAM_ENV_PARAM:
- sprintf(str, "program.env[%s%d]", addr, index);
- break;
- case PROGRAM_LOCAL_PARAM:
- sprintf(str, "program.local[%s%d]", addr, index);
- break;
- case PROGRAM_VARYING: /* extension */
- sprintf(str, "varying[%s%d]", addr, index);
- break;
- case PROGRAM_CONSTANT: /* extension */
- sprintf(str, "constant[%s%d]", addr, index);
- break;
- case PROGRAM_UNIFORM: /* extension */
- sprintf(str, "uniform[%s%d]", addr, index);
- break;
- case PROGRAM_STATE_VAR:
- {
- struct gl_program_parameter *param
- = prog->Parameters->Parameters + index;
- char *state = _mesa_program_state_string(param->StateIndexes);
- sprintf(str, "%s", state);
- free(state);
- }
- break;
- case PROGRAM_ADDRESS:
- sprintf(str, "A%d", index);
- break;
- default:
- _mesa_problem(NULL, "bad file in reg_string()");
- }
- break;
-
- case PROG_PRINT_NV:
- switch (f) {
- case PROGRAM_INPUT:
- if (prog->Target == GL_VERTEX_PROGRAM_ARB)
- sprintf(str, "v[%d]", index);
- else
- sprintf(str, "f[%d]", index);
- break;
- case PROGRAM_OUTPUT:
- sprintf(str, "o[%d]", index);
- break;
- case PROGRAM_TEMPORARY:
- sprintf(str, "R%d", index);
- break;
- case PROGRAM_ENV_PARAM:
- sprintf(str, "c[%d]", index);
- break;
- case PROGRAM_VARYING: /* extension */
- sprintf(str, "varying[%s%d]", addr, index);
- break;
- case PROGRAM_UNIFORM: /* extension */
- sprintf(str, "uniform[%s%d]", addr, index);
- break;
- case PROGRAM_CONSTANT: /* extension */
- sprintf(str, "constant[%s%d]", addr, index);
- break;
- case PROGRAM_STATE_VAR: /* extension */
- sprintf(str, "state[%s%d]", addr, index);
- break;
- default:
- _mesa_problem(NULL, "bad file in reg_string()");
- }
- break;
-
- default:
- _mesa_problem(NULL, "bad mode in reg_string()");
- }
-
- return str;
-}
-
-
-/**
- * Return a string representation of the given swizzle word.
- * If extended is true, use extended (comma-separated) format.
- * \param swizzle the swizzle field
- * \param negateBase 4-bit negation vector
- * \param extended if true, also allow 0, 1 values
- */
-const char *
-_mesa_swizzle_string(GLuint swizzle, GLuint negateMask, GLboolean extended)
-{
- static const char swz[] = "xyzw01!?"; /* See SWIZZLE_x definitions */
- static char s[20];
- GLuint i = 0;
-
- if (!extended && swizzle == SWIZZLE_NOOP && negateMask == 0)
- return ""; /* no swizzle/negation */
-
- if (!extended)
- s[i++] = '.';
-
- if (negateMask & NEGATE_X)
- s[i++] = '-';
- s[i++] = swz[GET_SWZ(swizzle, 0)];
-
- if (extended) {
- s[i++] = ',';
- }
-
- if (negateMask & NEGATE_Y)
- s[i++] = '-';
- s[i++] = swz[GET_SWZ(swizzle, 1)];
-
- if (extended) {
- s[i++] = ',';
- }
-
- if (negateMask & NEGATE_Z)
- s[i++] = '-';
- s[i++] = swz[GET_SWZ(swizzle, 2)];
-
- if (extended) {
- s[i++] = ',';
- }
-
- if (negateMask & NEGATE_W)
- s[i++] = '-';
- s[i++] = swz[GET_SWZ(swizzle, 3)];
-
- s[i] = 0;
- return s;
-}
-
-
-void
-_mesa_print_swizzle(GLuint swizzle)
-{
- if (swizzle == SWIZZLE_XYZW) {
- printf(".xyzw\n");
- }
- else {
- const char *s = _mesa_swizzle_string(swizzle, 0, 0);
- printf("%s\n", s);
- }
-}
-
-
-const char *
-_mesa_writemask_string(GLuint writeMask)
-{
- static char s[10];
- GLuint i = 0;
-
- if (writeMask == WRITEMASK_XYZW)
- return "";
-
- s[i++] = '.';
- if (writeMask & WRITEMASK_X)
- s[i++] = 'x';
- if (writeMask & WRITEMASK_Y)
- s[i++] = 'y';
- if (writeMask & WRITEMASK_Z)
- s[i++] = 'z';
- if (writeMask & WRITEMASK_W)
- s[i++] = 'w';
-
- s[i] = 0;
- return s;
-}
-
-
-const char *
-_mesa_condcode_string(GLuint condcode)
-{
- switch (condcode) {
- case COND_GT: return "GT";
- case COND_EQ: return "EQ";
- case COND_LT: return "LT";
- case COND_UN: return "UN";
- case COND_GE: return "GE";
- case COND_LE: return "LE";
- case COND_NE: return "NE";
- case COND_TR: return "TR";
- case COND_FL: return "FL";
- default: return "cond???";
- }
-}
-
-
-static void
-fprint_dst_reg(FILE * f,
- const struct prog_dst_register *dstReg,
- gl_prog_print_mode mode,
- const struct gl_program *prog)
-{
- fprintf(f, "%s%s",
- reg_string((gl_register_file) dstReg->File,
- dstReg->Index, mode, dstReg->RelAddr, prog,
- GL_FALSE, GL_FALSE, 0),
- _mesa_writemask_string(dstReg->WriteMask));
-
- if (dstReg->CondMask != COND_TR) {
- fprintf(f, " (%s.%s)",
- _mesa_condcode_string(dstReg->CondMask),
- _mesa_swizzle_string(dstReg->CondSwizzle,
- GL_FALSE, GL_FALSE));
- }
-
-#if 0
- fprintf(f, "%s[%d]%s",
- _mesa_register_file_name((gl_register_file) dstReg->File),
- dstReg->Index,
- _mesa_writemask_string(dstReg->WriteMask));
-#endif
-}
-
-
-static void
-fprint_src_reg(FILE *f,
- const struct prog_src_register *srcReg,
- gl_prog_print_mode mode,
- const struct gl_program *prog)
-{
- const char *abs = srcReg->Abs ? "|" : "";
-
- fprintf(f, "%s%s%s%s",
- abs,
- reg_string((gl_register_file) srcReg->File,
- srcReg->Index, mode, srcReg->RelAddr, prog,
- srcReg->HasIndex2, srcReg->RelAddr2, srcReg->Index2),
- _mesa_swizzle_string(srcReg->Swizzle,
- srcReg->Negate, GL_FALSE),
- abs);
-#if 0
- fprintf(f, "%s[%d]%s",
- _mesa_register_file_name((gl_register_file) srcReg->File),
- srcReg->Index,
- _mesa_swizzle_string(srcReg->Swizzle,
- srcReg->Negate, GL_FALSE));
-#endif
-}
-
-
-static void
-fprint_comment(FILE *f, const struct prog_instruction *inst)
-{
- if (inst->Comment)
- fprintf(f, "; # %s\n", inst->Comment);
- else
- fprintf(f, ";\n");
-}
-
-
-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;
-
- fprintf(f, "%s", opcode_string);
- if (inst->CondUpdate)
- fprintf(f, ".C");
-
- /* frag prog only */
- if (inst->SaturateMode == SATURATE_ZERO_ONE)
- fprintf(f, "_SAT");
-
- fprintf(f, " ");
- if (inst->DstReg.File != PROGRAM_UNDEFINED) {
- fprint_dst_reg(f, &inst->DstReg, mode, prog);
- }
- else {
- fprintf(f, " ???");
- }
-
- if (numRegs > 0)
- fprintf(f, ", ");
-
- for (j = 0; j < numRegs; j++) {
- fprint_src_reg(f, inst->SrcReg + j, mode, prog);
- if (j + 1 < numRegs)
- fprintf(f, ", ");
- }
-
- fprint_comment(f, inst);
-}
-
-
-void
-_mesa_print_alu_instruction(const struct prog_instruction *inst,
- const char *opcode_string, GLuint numRegs)
-{
- _mesa_fprint_alu_instruction(stderr, inst, opcode_string,
- numRegs, PROG_PRINT_DEBUG, NULL);
-}
-
-
-/**
- * Print a single vertex/fragment program instruction.
- */
-GLint
-_mesa_fprint_instruction_opt(FILE *f,
- const struct prog_instruction *inst,
- GLint indent,
- gl_prog_print_mode mode,
- const struct gl_program *prog)
-{
- GLint i;
-
- if (inst->Opcode == OPCODE_ELSE ||
- inst->Opcode == OPCODE_ENDIF ||
- inst->Opcode == OPCODE_ENDLOOP ||
- inst->Opcode == OPCODE_ENDSUB) {
- indent -= 3;
- }
- for (i = 0; i < indent; i++) {
- fprintf(f, " ");
- }
-
- switch (inst->Opcode) {
- case OPCODE_PRINT:
- fprintf(f, "PRINT '%s'", (char *) inst->Data);
- if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
- fprintf(f, ", ");
- fprintf(f, "%s[%d]%s",
- _mesa_register_file_name((gl_register_file) inst->SrcReg[0].File),
- inst->SrcReg[0].Index,
- _mesa_swizzle_string(inst->SrcReg[0].Swizzle,
- inst->SrcReg[0].Negate, GL_FALSE));
- }
- if (inst->Comment)
- fprintf(f, " # %s", inst->Comment);
- fprint_comment(f, inst);
- break;
- case OPCODE_SWZ:
- fprintf(f, "SWZ");
- if (inst->SaturateMode == SATURATE_ZERO_ONE)
- fprintf(f, "_SAT");
- fprintf(f, " ");
- fprint_dst_reg(f, &inst->DstReg, mode, prog);
- fprintf(f, ", %s[%d], %s",
- _mesa_register_file_name((gl_register_file) inst->SrcReg[0].File),
- inst->SrcReg[0].Index,
- _mesa_swizzle_string(inst->SrcReg[0].Swizzle,
- inst->SrcReg[0].Negate, GL_TRUE));
- fprint_comment(f, inst);
- break;
- case OPCODE_TEX:
- case OPCODE_TXP:
- case OPCODE_TXL:
- case OPCODE_TXB:
- fprintf(f, "%s", _mesa_opcode_string(inst->Opcode));
- if (inst->SaturateMode == SATURATE_ZERO_ONE)
- fprintf(f, "_SAT");
- fprintf(f, " ");
- fprint_dst_reg(f, &inst->DstReg, mode, prog);
- fprintf(f, ", ");
- fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
- fprintf(f, ", texture[%d], ", inst->TexSrcUnit);
- switch (inst->TexSrcTarget) {
- case TEXTURE_1D_INDEX: fprintf(f, "1D"); break;
- case TEXTURE_2D_INDEX: fprintf(f, "2D"); break;
- case TEXTURE_3D_INDEX: fprintf(f, "3D"); break;
- case TEXTURE_CUBE_INDEX: fprintf(f, "CUBE"); break;
- case TEXTURE_RECT_INDEX: fprintf(f, "RECT"); break;
- case TEXTURE_1D_ARRAY_INDEX: fprintf(f, "1D_ARRAY"); break;
- case TEXTURE_2D_ARRAY_INDEX: fprintf(f, "2D_ARRAY"); break;
- default:
- ;
- }
- if (inst->TexShadow)
- fprintf(f, " SHADOW");
- fprint_comment(f, inst);
- break;
-
- case OPCODE_KIL:
- fprintf(f, "%s", _mesa_opcode_string(inst->Opcode));
- fprintf(f, " ");
- fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
- fprint_comment(f, inst);
- break;
- case OPCODE_KIL_NV:
- fprintf(f, "%s", _mesa_opcode_string(inst->Opcode));
- fprintf(f, " ");
- fprintf(f, "%s.%s",
- _mesa_condcode_string(inst->DstReg.CondMask),
- _mesa_swizzle_string(inst->DstReg.CondSwizzle,
- GL_FALSE, GL_FALSE));
- fprint_comment(f, inst);
- break;
-
- case OPCODE_ARL:
- fprintf(f, "ARL ");
- fprint_dst_reg(f, &inst->DstReg, mode, prog);
- fprintf(f, ", ");
- fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
- fprint_comment(f, inst);
- break;
- case OPCODE_BRA:
- fprintf(f, "BRA %d (%s%s)",
- inst->BranchTarget,
- _mesa_condcode_string(inst->DstReg.CondMask),
- _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE));
- fprint_comment(f, inst);
- break;
- case OPCODE_IF:
- if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
- /* Use ordinary register */
- fprintf(f, "IF ");
- fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
- fprintf(f, "; ");
- }
- else {
- /* Use cond codes */
- fprintf(f, "IF (%s%s);",
- _mesa_condcode_string(inst->DstReg.CondMask),
- _mesa_swizzle_string(inst->DstReg.CondSwizzle,
- 0, GL_FALSE));
- }
- fprintf(f, " # (if false, goto %d)", inst->BranchTarget);
- fprint_comment(f, inst);
- return indent + 3;
- case OPCODE_ELSE:
- fprintf(f, "ELSE; # (goto %d)\n", inst->BranchTarget);
- return indent + 3;
- case OPCODE_ENDIF:
- fprintf(f, "ENDIF;\n");
- break;
- case OPCODE_BGNLOOP:
- fprintf(f, "BGNLOOP; # (end at %d)\n", inst->BranchTarget);
- return indent + 3;
- case OPCODE_ENDLOOP:
- fprintf(f, "ENDLOOP; # (goto %d)\n", inst->BranchTarget);
- break;
- case OPCODE_BRK:
- case OPCODE_CONT:
- fprintf(f, "%s (%s%s); # (goto %d)",
- _mesa_opcode_string(inst->Opcode),
- _mesa_condcode_string(inst->DstReg.CondMask),
- _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE),
- inst->BranchTarget);
- fprint_comment(f, inst);
- break;
-
- case OPCODE_BGNSUB:
- if (mode == PROG_PRINT_NV) {
- fprintf(f, "%s:\n", inst->Comment); /* comment is label */
- return indent;
- }
- else {
- fprintf(f, "BGNSUB");
- fprint_comment(f, inst);
- return indent + 3;
- }
- case OPCODE_ENDSUB:
- if (mode == PROG_PRINT_DEBUG) {
- fprintf(f, "ENDSUB");
- fprint_comment(f, inst);
- }
- break;
- case OPCODE_CAL:
- if (mode == PROG_PRINT_NV) {
- fprintf(f, "CAL %s; # (goto %d)\n", inst->Comment, inst->BranchTarget);
- }
- else {
- fprintf(f, "CAL %u", inst->BranchTarget);
- fprint_comment(f, inst);
- }
- break;
- case OPCODE_RET:
- fprintf(f, "RET (%s%s)",
- _mesa_condcode_string(inst->DstReg.CondMask),
- _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE));
- fprint_comment(f, inst);
- break;
-
- case OPCODE_END:
- fprintf(f, "END\n");
- break;
- case OPCODE_NOP:
- if (mode == PROG_PRINT_DEBUG) {
- fprintf(f, "NOP");
- fprint_comment(f, inst);
- }
- else if (inst->Comment) {
- /* ARB/NV extensions don't have NOP instruction */
- 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 */
- _mesa_fprint_alu_instruction(f, inst,
- _mesa_opcode_string(inst->Opcode),
- _mesa_num_inst_src_regs(inst->Opcode),
- mode, prog);
- }
- else {
- _mesa_fprint_alu_instruction(f, inst,
- _mesa_opcode_string(inst->Opcode),
- 3/*_mesa_num_inst_src_regs(inst->Opcode)*/,
- mode, prog);
- }
- break;
- }
- return indent;
-}
-
-
-GLint
-_mesa_print_instruction_opt(const struct prog_instruction *inst,
- GLint indent,
- gl_prog_print_mode mode,
- const struct gl_program *prog)
-{
- return _mesa_fprint_instruction_opt(stderr, inst, indent, mode, prog);
-}
-
-
-void
-_mesa_print_instruction(const struct prog_instruction *inst)
-{
- /* note: 4th param should be ignored for PROG_PRINT_DEBUG */
- _mesa_fprint_instruction_opt(stderr, inst, 0, PROG_PRINT_DEBUG, NULL);
-}
-
-
-
-/**
- * Print program, with options.
- */
-void
-_mesa_fprint_program_opt(FILE *f,
- const struct gl_program *prog,
- gl_prog_print_mode mode,
- GLboolean lineNumbers)
-{
- GLuint i, indent = 0;
-
- switch (prog->Target) {
- case GL_VERTEX_PROGRAM_ARB:
- if (mode == PROG_PRINT_ARB)
- fprintf(f, "!!ARBvp1.0\n");
- else if (mode == PROG_PRINT_NV)
- fprintf(f, "!!VP1.0\n");
- else
- fprintf(f, "# Vertex Program/Shader %u\n", prog->Id);
- break;
- case GL_FRAGMENT_PROGRAM_ARB:
- case GL_FRAGMENT_PROGRAM_NV:
- if (mode == PROG_PRINT_ARB)
- fprintf(f, "!!ARBfp1.0\n");
- else if (mode == PROG_PRINT_NV)
- fprintf(f, "!!FP1.0\n");
- 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++) {
- if (lineNumbers)
- fprintf(f, "%3d: ", i);
- indent = _mesa_fprint_instruction_opt(f, prog->Instructions + i,
- indent, mode, prog);
- }
-}
-
-
-/**
- * Print program to stderr, default options.
- */
-void
-_mesa_print_program(const struct gl_program *prog)
-{
- _mesa_fprint_program_opt(stderr, prog, PROG_PRINT_DEBUG, GL_TRUE);
-}
-
-
-/**
- * Return binary representation of 64-bit value (as a string).
- * Insert a comma to separate each group of 8 bits.
- * Note we return a pointer to local static storage so this is not
- * re-entrant, etc.
- * XXX move to imports.[ch] if useful elsewhere.
- */
-static const char *
-binary(GLbitfield64 val)
-{
- static char buf[80];
- GLint i, len = 0;
- for (i = 63; i >= 0; --i) {
- if (val & (BITFIELD64_BIT(i)))
- buf[len++] = '1';
- else if (len > 0 || i == 0)
- buf[len++] = '0';
- if (len > 0 && ((i-1) % 8) == 7)
- buf[len++] = ',';
- }
- buf[len] = '\0';
- return buf;
-}
-
-
-/**
- * Print all of a program's parameters/fields to given file.
- */
-static void
-_mesa_fprint_program_parameters(FILE *f,
- struct gl_context *ctx,
- const struct gl_program *prog)
-{
- GLuint i;
-
- fprintf(f, "InputsRead: 0x%x (0b%s)\n",
- prog->InputsRead, binary(prog->InputsRead));
- fprintf(f, "OutputsWritten: 0x%llx (0b%s)\n",
- (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=[ ");
- for (i = 0; i < MAX_SAMPLERS; i++) {
- fprintf(f, "%d ", prog->SamplerUnits[i]);
- }
- fprintf(f, "]\n");
-
- _mesa_load_state_parameters(ctx, prog->Parameters);
-
-#if 0
- fprintf(f, "Local Params:\n");
- for (i = 0; i < MAX_PROGRAM_LOCAL_PARAMS; i++){
- const GLfloat *p = prog->LocalParams[i];
- fprintf(f, "%2d: %f, %f, %f, %f\n", i, p[0], p[1], p[2], p[3]);
- }
-#endif
- _mesa_print_parameter_list(prog->Parameters);
-}
-
-
-/**
- * Print all of a program's parameters/fields to stderr.
- */
-void
-_mesa_print_program_parameters(struct gl_context *ctx, const struct gl_program *prog)
-{
- _mesa_fprint_program_parameters(stderr, ctx, prog);
-}
-
-
-/**
- * Print a program parameter list to given file.
- */
-static void
-_mesa_fprint_parameter_list(FILE *f,
- const struct gl_program_parameter_list *list)
-{
- GLuint i;
-
- if (!list)
- return;
-
- if (0)
- fprintf(f, "param list %p\n", (void *) list);
- fprintf(f, "dirty state flags: 0x%x\n", list->StateFlags);
- for (i = 0; i < list->NumParameters; i++){
- struct gl_program_parameter *param = list->Parameters + i;
- const GLfloat *v = list->ParameterValues[i];
- fprintf(f, "param[%d] sz=%d %s %s = {%.3g, %.3g, %.3g, %.3g}",
- i, param->Size,
- _mesa_register_file_name(list->Parameters[i].Type),
- param->Name, v[0], v[1], v[2], v[3]);
- if (param->Flags & PROG_PARAM_BIT_CENTROID)
- fprintf(f, " Centroid");
- if (param->Flags & PROG_PARAM_BIT_INVARIANT)
- fprintf(f, " Invariant");
- if (param->Flags & PROG_PARAM_BIT_FLAT)
- fprintf(f, " Flat");
- if (param->Flags & PROG_PARAM_BIT_LINEAR)
- fprintf(f, " Linear");
- fprintf(f, "\n");
- }
-}
-
-
-/**
- * Print a program parameter list to stderr.
- */
-void
-_mesa_print_parameter_list(const struct gl_program_parameter_list *list)
-{
- _mesa_fprint_parameter_list(stderr, list);
-}
-
-
-/**
- * Write shader and associated info to a file.
- */
-void
-_mesa_write_shader_to_file(const struct gl_shader *shader)
-{
- const char *type;
- char filename[100];
- FILE *f;
-
- if (shader->Type == GL_FRAGMENT_SHADER)
- type = "frag";
- 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");
- if (!f) {
- fprintf(stderr, "Unable to open %s for writing\n", filename);
- return;
- }
-
- fprintf(f, "/* Shader %u source, checksum %u */\n", shader->Name, shader->SourceChecksum);
- fputs(shader->Source, f);
- fprintf(f, "\n");
-
- fprintf(f, "/* Compile status: %s */\n",
- shader->CompileStatus ? "ok" : "fail");
- fprintf(f, "/* Log Info: */\n");
- if (shader->InfoLog) {
- fputs(shader->InfoLog, f);
- }
- 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);
- fprintf(f, "*/\n");
- fprintf(f, "/* Parameters / constants */\n");
- fprintf(f, "/*\n");
- _mesa_fprint_parameter_list(f, shader->Program->Parameters);
- fprintf(f, "*/\n");
- }
-
- fclose(f);
-}
-
-
-/**
- * Append the shader's uniform info/values to the shader log file.
- * The log file will typically have been created by the
- * _mesa_write_shader_to_file function.
- */
-void
-_mesa_append_uniforms_to_file(const struct gl_shader *shader,
- const struct gl_program *prog)
-{
- const char *type;
- char filename[100];
- FILE *f;
-
- if (shader->Type == GL_FRAGMENT_SHADER)
- type = "frag";
- else
- type = "vert";
-
- _mesa_snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type);
- f = fopen(filename, "a"); /* append */
- if (!f) {
- fprintf(stderr, "Unable to open %s for appending\n", filename);
- return;
- }
-
- fprintf(f, "/* First-draw parameters / constants */\n");
- fprintf(f, "/*\n");
- _mesa_fprint_parameter_list(f, prog->Parameters);
- fprintf(f, "*/\n");
-
- fclose(f);
-}
diff --git a/src/mesa/program/prog_print.h b/src/mesa/program/prog_print.h
deleted file mode 100644
index d962087..0000000
--- a/src/mesa/program/prog_print.h
+++ /dev/null
@@ -1,120 +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.
- */
-
-
-#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.
- */
-typedef enum {
- PROG_PRINT_ARB,
- PROG_PRINT_NV,
- PROG_PRINT_DEBUG
-} gl_prog_print_mode;
-
-
-extern const char *
-_mesa_register_file_name(gl_register_file f);
-
-extern void
-_mesa_print_vp_inputs(GLbitfield inputs);
-
-extern void
-_mesa_print_fp_inputs(GLbitfield inputs);
-
-extern const char *
-_mesa_condcode_string(GLuint condcode);
-
-extern const char *
-_mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended);
-
-const char *
-_mesa_writemask_string(GLuint writeMask);
-
-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);
-
-extern void
-_mesa_print_instruction(const struct prog_instruction *inst);
-
-extern GLint
-_mesa_fprint_instruction_opt(FILE *f,
- const struct prog_instruction *inst,
- GLint indent,
- gl_prog_print_mode mode,
- const struct gl_program *prog);
-
-extern GLint
-_mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent,
- gl_prog_print_mode mode,
- const struct gl_program *prog);
-
-extern void
-_mesa_print_program(const struct gl_program *prog);
-
-extern void
-_mesa_fprint_program_opt(FILE *f,
- const struct gl_program *prog, gl_prog_print_mode mode,
- GLboolean lineNumbers);
-
-extern void
-_mesa_print_program_parameters(struct gl_context *ctx, const struct gl_program *prog);
-
-extern void
-_mesa_print_parameter_list(const struct gl_program_parameter_list *list);
-
-
-extern void
-_mesa_write_shader_to_file(const struct gl_shader *shader);
-
-extern void
-_mesa_append_uniforms_to_file(const struct gl_shader *shader,
- const struct gl_program *prog);
-
-
-#endif /* PROG_PRINT_H */
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
deleted file mode 100644
index c310acb..0000000
--- a/src/mesa/program/prog_statevars.c
+++ /dev/null
@@ -1,1182 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-/**
- * \file prog_statevars.c
- * Program state variable management.
- * \author Brian Paul
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/imports.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "prog_statevars.h"
-#include "prog_parameter.h"
-
-
-/**
- * Use the list of tokens in the state[] array to find global GL state
- * and return it in <value>. Usually, four values are returned in <value>
- * but matrix queries may return as many as 16 values.
- * This function is used for ARB vertex/fragment programs.
- * The program parser will produce the state[] values.
- */
-static void
-_mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
- GLfloat *value)
-{
- switch (state[0]) {
- case STATE_MATERIAL:
- {
- /* state[1] is either 0=front or 1=back side */
- const GLuint face = (GLuint) state[1];
- const struct gl_material *mat = &ctx->Light.Material;
- ASSERT(face == 0 || face == 1);
- /* we rely on tokens numbered so that _BACK_ == _FRONT_+ 1 */
- ASSERT(MAT_ATTRIB_FRONT_AMBIENT + 1 == MAT_ATTRIB_BACK_AMBIENT);
- /* XXX we could get rid of this switch entirely with a little
- * work in arbprogparse.c's parse_state_single_item().
- */
- /* state[2] is the material attribute */
- switch (state[2]) {
- case STATE_AMBIENT:
- COPY_4V(value, mat->Attrib[MAT_ATTRIB_FRONT_AMBIENT + face]);
- return;
- case STATE_DIFFUSE:
- COPY_4V(value, mat->Attrib[MAT_ATTRIB_FRONT_DIFFUSE + face]);
- return;
- case STATE_SPECULAR:
- COPY_4V(value, mat->Attrib[MAT_ATTRIB_FRONT_SPECULAR + face]);
- return;
- case STATE_EMISSION:
- COPY_4V(value, mat->Attrib[MAT_ATTRIB_FRONT_EMISSION + face]);
- return;
- case STATE_SHININESS:
- value[0] = mat->Attrib[MAT_ATTRIB_FRONT_SHININESS + face][0];
- value[1] = 0.0F;
- value[2] = 0.0F;
- value[3] = 1.0F;
- return;
- default:
- _mesa_problem(ctx, "Invalid material state in fetch_state");
- return;
- }
- }
- case STATE_LIGHT:
- {
- /* state[1] is the light number */
- const GLuint ln = (GLuint) state[1];
- /* state[2] is the light attribute */
- switch (state[2]) {
- case STATE_AMBIENT:
- COPY_4V(value, ctx->Light.Light[ln].Ambient);
- return;
- case STATE_DIFFUSE:
- COPY_4V(value, ctx->Light.Light[ln].Diffuse);
- return;
- case STATE_SPECULAR:
- COPY_4V(value, ctx->Light.Light[ln].Specular);
- return;
- case STATE_POSITION:
- COPY_4V(value, ctx->Light.Light[ln].EyePosition);
- return;
- case STATE_ATTENUATION:
- value[0] = ctx->Light.Light[ln].ConstantAttenuation;
- value[1] = ctx->Light.Light[ln].LinearAttenuation;
- value[2] = ctx->Light.Light[ln].QuadraticAttenuation;
- value[3] = ctx->Light.Light[ln].SpotExponent;
- return;
- case STATE_SPOT_DIRECTION:
- COPY_3V(value, ctx->Light.Light[ln].SpotDirection);
- value[3] = ctx->Light.Light[ln]._CosCutoff;
- return;
- case STATE_SPOT_CUTOFF:
- value[0] = ctx->Light.Light[ln].SpotCutoff;
- return;
- case STATE_HALF_VECTOR:
- {
- static const GLfloat eye_z[] = {0, 0, 1};
- GLfloat p[3];
- /* Compute infinite half angle vector:
- * halfVector = normalize(normalize(lightPos) + (0, 0, 1))
- * light.EyePosition.w should be 0 for infinite lights.
- */
- COPY_3V(p, ctx->Light.Light[ln].EyePosition);
- NORMALIZE_3FV(p);
- ADD_3V(value, p, eye_z);
- NORMALIZE_3FV(value);
- value[3] = 1.0;
- }
- return;
- default:
- _mesa_problem(ctx, "Invalid light state in fetch_state");
- return;
- }
- }
- case STATE_LIGHTMODEL_AMBIENT:
- COPY_4V(value, ctx->Light.Model.Ambient);
- return;
- case STATE_LIGHTMODEL_SCENECOLOR:
- if (state[1] == 0) {
- /* front */
- GLint i;
- for (i = 0; i < 3; i++) {
- value[i] = ctx->Light.Model.Ambient[i]
- * ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT][i]
- + ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_EMISSION][i];
- }
- value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
- }
- else {
- /* back */
- GLint i;
- for (i = 0; i < 3; i++) {
- value[i] = ctx->Light.Model.Ambient[i]
- * ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_AMBIENT][i]
- + ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_EMISSION][i];
- }
- value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
- }
- return;
- case STATE_LIGHTPROD:
- {
- const GLuint ln = (GLuint) state[1];
- const GLuint face = (GLuint) state[2];
- GLint i;
- ASSERT(face == 0 || face == 1);
- switch (state[3]) {
- case STATE_AMBIENT:
- for (i = 0; i < 3; i++) {
- value[i] = ctx->Light.Light[ln].Ambient[i] *
- ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT+face][i];
- }
- /* [3] = material alpha */
- value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT+face][3];
- return;
- case STATE_DIFFUSE:
- for (i = 0; i < 3; i++) {
- value[i] = ctx->Light.Light[ln].Diffuse[i] *
- ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][i];
- }
- /* [3] = material alpha */
- value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][3];
- return;
- case STATE_SPECULAR:
- for (i = 0; i < 3; i++) {
- value[i] = ctx->Light.Light[ln].Specular[i] *
- ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SPECULAR+face][i];
- }
- /* [3] = material alpha */
- value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SPECULAR+face][3];
- return;
- default:
- _mesa_problem(ctx, "Invalid lightprod state in fetch_state");
- return;
- }
- }
- case STATE_TEXGEN:
- {
- /* state[1] is the texture unit */
- const GLuint unit = (GLuint) state[1];
- /* state[2] is the texgen attribute */
- switch (state[2]) {
- case STATE_TEXGEN_EYE_S:
- COPY_4V(value, ctx->Texture.Unit[unit].GenS.EyePlane);
- return;
- case STATE_TEXGEN_EYE_T:
- COPY_4V(value, ctx->Texture.Unit[unit].GenT.EyePlane);
- return;
- case STATE_TEXGEN_EYE_R:
- COPY_4V(value, ctx->Texture.Unit[unit].GenR.EyePlane);
- return;
- case STATE_TEXGEN_EYE_Q:
- COPY_4V(value, ctx->Texture.Unit[unit].GenQ.EyePlane);
- return;
- case STATE_TEXGEN_OBJECT_S:
- COPY_4V(value, ctx->Texture.Unit[unit].GenS.ObjectPlane);
- return;
- case STATE_TEXGEN_OBJECT_T:
- COPY_4V(value, ctx->Texture.Unit[unit].GenT.ObjectPlane);
- return;
- case STATE_TEXGEN_OBJECT_R:
- COPY_4V(value, ctx->Texture.Unit[unit].GenR.ObjectPlane);
- return;
- case STATE_TEXGEN_OBJECT_Q:
- COPY_4V(value, ctx->Texture.Unit[unit].GenQ.ObjectPlane);
- return;
- default:
- _mesa_problem(ctx, "Invalid texgen state in fetch_state");
- return;
- }
- }
- case STATE_TEXENV_COLOR:
- {
- /* state[1] is the texture unit */
- const GLuint unit = (GLuint) state[1];
- COPY_4V(value, ctx->Texture.Unit[unit].EnvColor);
- }
- return;
- case STATE_FOG_COLOR:
- COPY_4V(value, ctx->Fog.Color);
- return;
- case STATE_FOG_PARAMS:
- value[0] = ctx->Fog.Density;
- value[1] = ctx->Fog.Start;
- value[2] = ctx->Fog.End;
- value[3] = (ctx->Fog.End == ctx->Fog.Start)
- ? 1.0f : (GLfloat)(1.0 / (ctx->Fog.End - ctx->Fog.Start));
- return;
- case STATE_CLIPPLANE:
- {
- const GLuint plane = (GLuint) state[1];
- COPY_4V(value, ctx->Transform.EyeUserPlane[plane]);
- }
- return;
- case STATE_POINT_SIZE:
- value[0] = ctx->Point.Size;
- value[1] = ctx->Point.MinSize;
- value[2] = ctx->Point.MaxSize;
- value[3] = ctx->Point.Threshold;
- return;
- case STATE_POINT_ATTENUATION:
- value[0] = ctx->Point.Params[0];
- value[1] = ctx->Point.Params[1];
- value[2] = ctx->Point.Params[2];
- value[3] = 1.0F;
- return;
- case STATE_MODELVIEW_MATRIX:
- case STATE_PROJECTION_MATRIX:
- case STATE_MVP_MATRIX:
- case STATE_TEXTURE_MATRIX:
- case STATE_PROGRAM_MATRIX:
- {
- /* state[0] = modelview, projection, texture, etc. */
- /* state[1] = which texture matrix or program matrix */
- /* state[2] = first row to fetch */
- /* state[3] = last row to fetch */
- /* state[4] = transpose, inverse or invtrans */
- const GLmatrix *matrix;
- const gl_state_index mat = state[0];
- const GLuint index = (GLuint) state[1];
- const GLuint firstRow = (GLuint) state[2];
- const GLuint lastRow = (GLuint) state[3];
- const gl_state_index modifier = state[4];
- const GLfloat *m;
- GLuint row, i;
- ASSERT(firstRow >= 0);
- ASSERT(firstRow < 4);
- ASSERT(lastRow >= 0);
- ASSERT(lastRow < 4);
- if (mat == STATE_MODELVIEW_MATRIX) {
- matrix = ctx->ModelviewMatrixStack.Top;
- }
- else if (mat == STATE_PROJECTION_MATRIX) {
- matrix = ctx->ProjectionMatrixStack.Top;
- }
- else if (mat == STATE_MVP_MATRIX) {
- matrix = &ctx->_ModelProjectMatrix;
- }
- else if (mat == STATE_TEXTURE_MATRIX) {
- ASSERT(index < Elements(ctx->TextureMatrixStack));
- matrix = ctx->TextureMatrixStack[index].Top;
- }
- else if (mat == STATE_PROGRAM_MATRIX) {
- ASSERT(index < Elements(ctx->ProgramMatrixStack));
- matrix = ctx->ProgramMatrixStack[index].Top;
- }
- else {
- _mesa_problem(ctx, "Bad matrix name in _mesa_fetch_state()");
- return;
- }
- if (modifier == STATE_MATRIX_INVERSE ||
- modifier == STATE_MATRIX_INVTRANS) {
- /* Be sure inverse is up to date:
- */
- _math_matrix_alloc_inv( (GLmatrix *) matrix );
- _math_matrix_analyse( (GLmatrix*) matrix );
- m = matrix->inv;
- }
- else {
- m = matrix->m;
- }
- if (modifier == STATE_MATRIX_TRANSPOSE ||
- modifier == STATE_MATRIX_INVTRANS) {
- for (i = 0, row = firstRow; row <= lastRow; row++) {
- value[i++] = m[row * 4 + 0];
- value[i++] = m[row * 4 + 1];
- value[i++] = m[row * 4 + 2];
- value[i++] = m[row * 4 + 3];
- }
- }
- else {
- for (i = 0, row = firstRow; row <= lastRow; row++) {
- value[i++] = m[row + 0];
- value[i++] = m[row + 4];
- value[i++] = m[row + 8];
- value[i++] = m[row + 12];
- }
- }
- }
- return;
- case STATE_DEPTH_RANGE:
- value[0] = ctx->Viewport.Near; /* near */
- value[1] = ctx->Viewport.Far; /* far */
- value[2] = ctx->Viewport.Far - ctx->Viewport.Near; /* far - near */
- value[3] = 1.0;
- return;
- case STATE_FRAGMENT_PROGRAM:
- {
- /* state[1] = {STATE_ENV, STATE_LOCAL} */
- /* state[2] = parameter index */
- const int idx = (int) state[2];
- switch (state[1]) {
- case STATE_ENV:
- COPY_4V(value, ctx->FragmentProgram.Parameters[idx]);
- return;
- case STATE_LOCAL:
- COPY_4V(value, ctx->FragmentProgram.Current->Base.LocalParams[idx]);
- return;
- default:
- _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
- return;
- }
- }
- return;
-
- case STATE_VERTEX_PROGRAM:
- {
- /* state[1] = {STATE_ENV, STATE_LOCAL} */
- /* state[2] = parameter index */
- const int idx = (int) state[2];
- switch (state[1]) {
- case STATE_ENV:
- COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
- return;
- case STATE_LOCAL:
- COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]);
- return;
- default:
- _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
- return;
- }
- }
- return;
-
- case STATE_NORMAL_SCALE:
- ASSIGN_4V(value, ctx->_ModelViewInvScale, 0, 0, 1);
- return;
-
- case STATE_INTERNAL:
- switch (state[1]) {
- case STATE_CURRENT_ATTRIB:
- {
- const GLuint idx = (GLuint) state[2];
- COPY_4V(value, ctx->Current.Attrib[idx]);
- }
- return;
-
- case STATE_NORMAL_SCALE:
- ASSIGN_4V(value,
- ctx->_ModelViewInvScale,
- ctx->_ModelViewInvScale,
- ctx->_ModelViewInvScale,
- 1);
- return;
-
- case STATE_TEXRECT_SCALE:
- /* Value = { 1/texWidth, 1/texHeight, 0, 1 }.
- * Used to convert unnormalized texcoords to normalized texcoords.
- */
- {
- const int unit = (int) state[2];
- const struct gl_texture_object *texObj
- = ctx->Texture.Unit[unit]._Current;
- if (texObj) {
- struct gl_texture_image *texImage = texObj->Image[0][0];
- ASSIGN_4V(value,
- (GLfloat) (1.0 / texImage->Width),
- (GLfloat) (1.0 / texImage->Height),
- 0.0f, 1.0f);
- }
- }
- return;
-
- case STATE_FOG_PARAMS_OPTIMIZED:
- /* for simpler per-vertex/pixel fog calcs. POW (for EXP/EXP2 fog)
- * might be more expensive than EX2 on some hw, plus it needs
- * another constant (e) anyway. Linear fog can now be done with a
- * single MAD.
- * linear: fogcoord * -1/(end-start) + end/(end-start)
- * exp: 2^-(density/ln(2) * fogcoord)
- * exp2: 2^-((density/(ln(2)^2) * fogcoord)^2)
- */
- value[0] = (ctx->Fog.End == ctx->Fog.Start)
- ? 1.0f : (GLfloat)(-1.0F / (ctx->Fog.End - ctx->Fog.Start));
- value[1] = ctx->Fog.End * -value[0];
- value[2] = (GLfloat)(ctx->Fog.Density * ONE_DIV_LN2);
- value[3] = (GLfloat)(ctx->Fog.Density * ONE_DIV_SQRT_LN2);
- return;
-
- case STATE_POINT_SIZE_CLAMPED:
- {
- /* this includes implementation dependent limits, to avoid
- * another potentially necessary clamp.
- * Note: for sprites, point smooth (point AA) is ignored
- * and we'll clamp to MinPointSizeAA and MaxPointSize, because we
- * expect drivers will want to say their minimum for AA size is 0.0
- * but for non-AA it's 1.0 (because normal points with size below 1.0
- * need to get rounded up to 1.0, hence never disappear). GL does
- * not specify max clamp size for sprites, other than it needs to be
- * at least as large as max AA size, hence use non-AA size there.
- */
- GLfloat minImplSize;
- GLfloat maxImplSize;
- if (ctx->Point.PointSprite) {
- minImplSize = ctx->Const.MinPointSizeAA;
- maxImplSize = ctx->Const.MaxPointSize;
- }
- else if (ctx->Point.SmoothFlag || ctx->Multisample._Enabled) {
- minImplSize = ctx->Const.MinPointSizeAA;
- maxImplSize = ctx->Const.MaxPointSizeAA;
- }
- else {
- minImplSize = ctx->Const.MinPointSize;
- maxImplSize = ctx->Const.MaxPointSize;
- }
- value[0] = ctx->Point.Size;
- value[1] = ctx->Point.MinSize >= minImplSize ? ctx->Point.MinSize : minImplSize;
- value[2] = ctx->Point.MaxSize <= maxImplSize ? ctx->Point.MaxSize : maxImplSize;
- value[3] = ctx->Point.Threshold;
- }
- return;
- case STATE_POINT_SIZE_IMPL_CLAMP:
- {
- /* for implementation clamp only in vs */
- GLfloat minImplSize;
- GLfloat maxImplSize;
- if (ctx->Point.PointSprite) {
- minImplSize = ctx->Const.MinPointSizeAA;
- maxImplSize = ctx->Const.MaxPointSize;
- }
- else if (ctx->Point.SmoothFlag || ctx->Multisample._Enabled) {
- minImplSize = ctx->Const.MinPointSizeAA;
- maxImplSize = ctx->Const.MaxPointSizeAA;
- }
- else {
- minImplSize = ctx->Const.MinPointSize;
- maxImplSize = ctx->Const.MaxPointSize;
- }
- value[0] = ctx->Point.Size;
- value[1] = minImplSize;
- value[2] = maxImplSize;
- value[3] = ctx->Point.Threshold;
- }
- return;
- case STATE_LIGHT_SPOT_DIR_NORMALIZED:
- {
- /* here, state[2] is the light number */
- /* pre-normalize spot dir */
- const GLuint ln = (GLuint) state[2];
- COPY_3V(value, ctx->Light.Light[ln]._NormSpotDirection);
- value[3] = ctx->Light.Light[ln]._CosCutoff;
- }
- return;
-
- case STATE_LIGHT_POSITION:
- {
- const GLuint ln = (GLuint) state[2];
- COPY_4V(value, ctx->Light.Light[ln]._Position);
- }
- return;
-
- case STATE_LIGHT_POSITION_NORMALIZED:
- {
- const GLuint ln = (GLuint) state[2];
- COPY_4V(value, ctx->Light.Light[ln]._Position);
- NORMALIZE_3FV( value );
- }
- return;
-
- case STATE_LIGHT_HALF_VECTOR:
- {
- const GLuint ln = (GLuint) state[2];
- GLfloat p[3];
- /* Compute infinite half angle vector:
- * halfVector = normalize(normalize(lightPos) + (0, 0, 1))
- * light.EyePosition.w should be 0 for infinite lights.
- */
- COPY_3V(p, ctx->Light.Light[ln]._Position);
- NORMALIZE_3FV(p);
- ADD_3V(value, p, ctx->_EyeZDir);
- NORMALIZE_3FV(value);
- value[3] = 1.0;
- }
- return;
-
- case STATE_PT_SCALE:
- value[0] = ctx->Pixel.RedScale;
- value[1] = ctx->Pixel.GreenScale;
- value[2] = ctx->Pixel.BlueScale;
- value[3] = ctx->Pixel.AlphaScale;
- return;
-
- case STATE_PT_BIAS:
- value[0] = ctx->Pixel.RedBias;
- value[1] = ctx->Pixel.GreenBias;
- value[2] = ctx->Pixel.BlueBias;
- value[3] = ctx->Pixel.AlphaBias;
- return;
-
- case STATE_SHADOW_AMBIENT:
- {
- const int unit = (int) state[2];
- const struct gl_texture_object *texObj
- = ctx->Texture.Unit[unit]._Current;
- if (texObj) {
- value[0] =
- value[1] =
- value[2] =
- value[3] = texObj->CompareFailValue;
- }
- }
- return;
-
- case STATE_FB_SIZE:
- value[0] = (GLfloat) (ctx->DrawBuffer->Width - 1);
- value[1] = (GLfloat) (ctx->DrawBuffer->Height - 1);
- value[2] = 0.0F;
- value[3] = 0.0F;
- return;
-
- case STATE_FB_WPOS_Y_TRANSFORM:
- /* A driver may negate this conditional by using ZW swizzle
- * instead of XY (based on e.g. some other state). */
- if (ctx->DrawBuffer->Name != 0) {
- /* Identity (XY) followed by flipping Y upside down (ZW). */
- value[0] = 1.0F;
- value[1] = 0.0F;
- value[2] = -1.0F;
- value[3] = (GLfloat) (ctx->DrawBuffer->Height - 1);
- } else {
- /* Flipping Y upside down (XY) followed by identity (ZW). */
- value[0] = -1.0F;
- value[1] = (GLfloat) (ctx->DrawBuffer->Height - 1);
- value[2] = 1.0F;
- value[3] = 0.0F;
- }
- return;
-
- case STATE_ROT_MATRIX_0:
- {
- const int unit = (int) state[2];
- GLfloat *rotMat22 = ctx->Texture.Unit[unit].RotMatrix;
- value[0] = rotMat22[0];
- value[1] = rotMat22[2];
- value[2] = 0.0;
- value[3] = 0.0;
- }
- return;
-
- case STATE_ROT_MATRIX_1:
- {
- const int unit = (int) state[2];
- GLfloat *rotMat22 = ctx->Texture.Unit[unit].RotMatrix;
- value[0] = rotMat22[1];
- value[1] = rotMat22[3];
- value[2] = 0.0;
- value[3] = 0.0;
- }
- return;
-
- /* XXX: make sure new tokens added here are also handled in the
- * _mesa_program_state_flags() switch, below.
- */
- default:
- /* Unknown state indexes are silently ignored here.
- * Drivers may do something special.
- */
- return;
- }
- return;
-
- default:
- _mesa_problem(ctx, "Invalid state in _mesa_fetch_state");
- return;
- }
-}
-
-
-/**
- * Return a bitmask of the Mesa state flags (_NEW_* values) which would
- * indicate that the given context state may have changed.
- * The bitmask is used during validation to determine if we need to update
- * vertex/fragment program parameters (like "state.material.color") when
- * some GL state has changed.
- */
-GLbitfield
-_mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
-{
- switch (state[0]) {
- case STATE_MATERIAL:
- case STATE_LIGHT:
- case STATE_LIGHTMODEL_AMBIENT:
- case STATE_LIGHTMODEL_SCENECOLOR:
- case STATE_LIGHTPROD:
- return _NEW_LIGHT;
-
- case STATE_TEXGEN:
- case STATE_TEXENV_COLOR:
- return _NEW_TEXTURE;
-
- case STATE_FOG_COLOR:
- case STATE_FOG_PARAMS:
- return _NEW_FOG;
-
- case STATE_CLIPPLANE:
- return _NEW_TRANSFORM;
-
- case STATE_POINT_SIZE:
- case STATE_POINT_ATTENUATION:
- return _NEW_POINT;
-
- case STATE_MODELVIEW_MATRIX:
- return _NEW_MODELVIEW;
- case STATE_PROJECTION_MATRIX:
- return _NEW_PROJECTION;
- case STATE_MVP_MATRIX:
- return _NEW_MODELVIEW | _NEW_PROJECTION;
- case STATE_TEXTURE_MATRIX:
- return _NEW_TEXTURE_MATRIX;
- case STATE_PROGRAM_MATRIX:
- return _NEW_TRACK_MATRIX;
-
- case STATE_DEPTH_RANGE:
- return _NEW_VIEWPORT;
-
- case STATE_FRAGMENT_PROGRAM:
- case STATE_VERTEX_PROGRAM:
- return _NEW_PROGRAM;
-
- case STATE_NORMAL_SCALE:
- return _NEW_MODELVIEW;
-
- case STATE_INTERNAL:
- switch (state[1]) {
- case STATE_CURRENT_ATTRIB:
- return _NEW_CURRENT_ATTRIB;
-
- case STATE_NORMAL_SCALE:
- return _NEW_MODELVIEW;
-
- case STATE_TEXRECT_SCALE:
- case STATE_SHADOW_AMBIENT:
- case STATE_ROT_MATRIX_0:
- case STATE_ROT_MATRIX_1:
- return _NEW_TEXTURE;
- case STATE_FOG_PARAMS_OPTIMIZED:
- return _NEW_FOG;
- case STATE_POINT_SIZE_CLAMPED:
- case STATE_POINT_SIZE_IMPL_CLAMP:
- return _NEW_POINT | _NEW_MULTISAMPLE;
- case STATE_LIGHT_SPOT_DIR_NORMALIZED:
- case STATE_LIGHT_POSITION:
- case STATE_LIGHT_POSITION_NORMALIZED:
- case STATE_LIGHT_HALF_VECTOR:
- return _NEW_LIGHT;
-
- case STATE_PT_SCALE:
- case STATE_PT_BIAS:
- return _NEW_PIXEL;
-
- case STATE_FB_SIZE:
- case STATE_FB_WPOS_Y_TRANSFORM:
- return _NEW_BUFFERS;
-
- default:
- /* unknown state indexes are silently ignored and
- * no flag set, since it is handled by the driver.
- */
- return 0;
- }
-
- default:
- _mesa_problem(NULL, "unexpected state[0] in make_state_flags()");
- return 0;
- }
-}
-
-
-static void
-append(char *dst, const char *src)
-{
- while (*dst)
- dst++;
- while (*src)
- *dst++ = *src++;
- *dst = 0;
-}
-
-
-/**
- * Convert token 'k' to a string, append it onto 'dst' string.
- */
-static void
-append_token(char *dst, gl_state_index k)
-{
- switch (k) {
- case STATE_MATERIAL:
- append(dst, "material");
- break;
- case STATE_LIGHT:
- append(dst, "light");
- break;
- case STATE_LIGHTMODEL_AMBIENT:
- append(dst, "lightmodel.ambient");
- break;
- case STATE_LIGHTMODEL_SCENECOLOR:
- break;
- case STATE_LIGHTPROD:
- append(dst, "lightprod");
- break;
- case STATE_TEXGEN:
- append(dst, "texgen");
- break;
- case STATE_FOG_COLOR:
- append(dst, "fog.color");
- break;
- case STATE_FOG_PARAMS:
- append(dst, "fog.params");
- break;
- case STATE_CLIPPLANE:
- append(dst, "clip");
- break;
- case STATE_POINT_SIZE:
- append(dst, "point.size");
- break;
- case STATE_POINT_ATTENUATION:
- append(dst, "point.attenuation");
- break;
- case STATE_MODELVIEW_MATRIX:
- append(dst, "matrix.modelview");
- break;
- case STATE_PROJECTION_MATRIX:
- append(dst, "matrix.projection");
- break;
- case STATE_MVP_MATRIX:
- append(dst, "matrix.mvp");
- break;
- case STATE_TEXTURE_MATRIX:
- append(dst, "matrix.texture");
- break;
- case STATE_PROGRAM_MATRIX:
- append(dst, "matrix.program");
- break;
- case STATE_MATRIX_INVERSE:
- append(dst, ".inverse");
- break;
- case STATE_MATRIX_TRANSPOSE:
- append(dst, ".transpose");
- break;
- case STATE_MATRIX_INVTRANS:
- append(dst, ".invtrans");
- break;
- case STATE_AMBIENT:
- append(dst, ".ambient");
- break;
- case STATE_DIFFUSE:
- append(dst, ".diffuse");
- break;
- case STATE_SPECULAR:
- append(dst, ".specular");
- break;
- case STATE_EMISSION:
- append(dst, ".emission");
- break;
- case STATE_SHININESS:
- append(dst, "lshininess");
- break;
- case STATE_HALF_VECTOR:
- append(dst, ".half");
- break;
- case STATE_POSITION:
- append(dst, ".position");
- break;
- case STATE_ATTENUATION:
- append(dst, ".attenuation");
- break;
- case STATE_SPOT_DIRECTION:
- append(dst, ".spot.direction");
- break;
- case STATE_SPOT_CUTOFF:
- append(dst, ".spot.cutoff");
- break;
- case STATE_TEXGEN_EYE_S:
- append(dst, ".eye.s");
- break;
- case STATE_TEXGEN_EYE_T:
- append(dst, ".eye.t");
- break;
- case STATE_TEXGEN_EYE_R:
- append(dst, ".eye.r");
- break;
- case STATE_TEXGEN_EYE_Q:
- append(dst, ".eye.q");
- break;
- case STATE_TEXGEN_OBJECT_S:
- append(dst, ".object.s");
- break;
- case STATE_TEXGEN_OBJECT_T:
- append(dst, ".object.t");
- break;
- case STATE_TEXGEN_OBJECT_R:
- append(dst, ".object.r");
- break;
- case STATE_TEXGEN_OBJECT_Q:
- append(dst, ".object.q");
- break;
- case STATE_TEXENV_COLOR:
- append(dst, "texenv");
- break;
- case STATE_DEPTH_RANGE:
- append(dst, "depth.range");
- break;
- case STATE_VERTEX_PROGRAM:
- case STATE_FRAGMENT_PROGRAM:
- break;
- case STATE_ENV:
- append(dst, "env");
- break;
- case STATE_LOCAL:
- append(dst, "local");
- break;
- /* BEGIN internal state vars */
- case STATE_INTERNAL:
- append(dst, ".internal.");
- break;
- case STATE_CURRENT_ATTRIB:
- append(dst, "current");
- break;
- case STATE_NORMAL_SCALE:
- append(dst, "normalScale");
- break;
- case STATE_TEXRECT_SCALE:
- append(dst, "texrectScale");
- break;
- case STATE_FOG_PARAMS_OPTIMIZED:
- append(dst, "fogParamsOptimized");
- break;
- case STATE_POINT_SIZE_CLAMPED:
- append(dst, "pointSizeClamped");
- break;
- case STATE_POINT_SIZE_IMPL_CLAMP:
- append(dst, "pointSizeImplClamp");
- break;
- case STATE_LIGHT_SPOT_DIR_NORMALIZED:
- append(dst, "lightSpotDirNormalized");
- break;
- case STATE_LIGHT_POSITION:
- append(dst, "lightPosition");
- break;
- case STATE_LIGHT_POSITION_NORMALIZED:
- append(dst, "light.position.normalized");
- break;
- case STATE_LIGHT_HALF_VECTOR:
- append(dst, "lightHalfVector");
- break;
- case STATE_PT_SCALE:
- append(dst, "PTscale");
- break;
- case STATE_PT_BIAS:
- append(dst, "PTbias");
- break;
- case STATE_SHADOW_AMBIENT:
- append(dst, "CompareFailValue");
- break;
- case STATE_FB_SIZE:
- append(dst, "FbSize");
- break;
- case STATE_FB_WPOS_Y_TRANSFORM:
- append(dst, "FbWposYTransform");
- break;
- case STATE_ROT_MATRIX_0:
- append(dst, "rotMatrixRow0");
- break;
- case STATE_ROT_MATRIX_1:
- append(dst, "rotMatrixRow1");
- break;
- default:
- /* probably STATE_INTERNAL_DRIVER+i (driver private state) */
- append(dst, "driverState");
- }
-}
-
-static void
-append_face(char *dst, GLint face)
-{
- if (face == 0)
- append(dst, "front.");
- else
- append(dst, "back.");
-}
-
-static void
-append_index(char *dst, GLint index)
-{
- char s[20];
- sprintf(s, "[%d]", index);
- append(dst, s);
-}
-
-/**
- * Make a string from the given state vector.
- * For example, return "state.matrix.texture[2].inverse".
- * Use free() to deallocate the string.
- */
-char *
-_mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
-{
- char str[1000] = "";
- char tmp[30];
-
- append(str, "state.");
- append_token(str, state[0]);
-
- switch (state[0]) {
- case STATE_MATERIAL:
- append_face(str, state[1]);
- append_token(str, state[2]);
- break;
- case STATE_LIGHT:
- append_index(str, state[1]); /* light number [i]. */
- append_token(str, state[2]); /* coefficients */
- break;
- case STATE_LIGHTMODEL_AMBIENT:
- append(str, "lightmodel.ambient");
- break;
- case STATE_LIGHTMODEL_SCENECOLOR:
- if (state[1] == 0) {
- append(str, "lightmodel.front.scenecolor");
- }
- else {
- append(str, "lightmodel.back.scenecolor");
- }
- break;
- case STATE_LIGHTPROD:
- append_index(str, state[1]); /* light number [i]. */
- append_face(str, state[2]);
- append_token(str, state[3]);
- break;
- case STATE_TEXGEN:
- append_index(str, state[1]); /* tex unit [i] */
- append_token(str, state[2]); /* plane coef */
- break;
- case STATE_TEXENV_COLOR:
- append_index(str, state[1]); /* tex unit [i] */
- append(str, "color");
- break;
- case STATE_CLIPPLANE:
- append_index(str, state[1]); /* plane [i] */
- append(str, ".plane");
- break;
- case STATE_MODELVIEW_MATRIX:
- case STATE_PROJECTION_MATRIX:
- case STATE_MVP_MATRIX:
- case STATE_TEXTURE_MATRIX:
- case STATE_PROGRAM_MATRIX:
- {
- /* state[0] = modelview, projection, texture, etc. */
- /* state[1] = which texture matrix or program matrix */
- /* state[2] = first row to fetch */
- /* state[3] = last row to fetch */
- /* state[4] = transpose, inverse or invtrans */
- const gl_state_index mat = state[0];
- const GLuint index = (GLuint) state[1];
- const GLuint firstRow = (GLuint) state[2];
- const GLuint lastRow = (GLuint) state[3];
- const gl_state_index modifier = state[4];
- if (index ||
- mat == STATE_TEXTURE_MATRIX ||
- mat == STATE_PROGRAM_MATRIX)
- append_index(str, index);
- if (modifier)
- append_token(str, modifier);
- if (firstRow == lastRow)
- sprintf(tmp, ".row[%d]", firstRow);
- else
- sprintf(tmp, ".row[%d..%d]", firstRow, lastRow);
- append(str, tmp);
- }
- break;
- case STATE_POINT_SIZE:
- break;
- case STATE_POINT_ATTENUATION:
- break;
- case STATE_FOG_PARAMS:
- break;
- case STATE_FOG_COLOR:
- break;
- case STATE_DEPTH_RANGE:
- break;
- case STATE_FRAGMENT_PROGRAM:
- case STATE_VERTEX_PROGRAM:
- /* state[1] = {STATE_ENV, STATE_LOCAL} */
- /* state[2] = parameter index */
- 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)
- append_index(str, state[2]);
- break;
- default:
- _mesa_problem(NULL, "Invalid state in _mesa_program_state_string");
- break;
- }
-
- return _mesa_strdup(str);
-}
-
-
-/**
- * Loop over all the parameters in a parameter list. If the parameter
- * is a GL state reference, look up the current value of that state
- * variable and put it into the parameter's Value[4] array.
- * Other parameter types never change or are explicitly set by the user
- * with glUniform() or glProgramParameter(), etc.
- * This would be called at glBegin time.
- */
-void
-_mesa_load_state_parameters(struct gl_context *ctx,
- struct gl_program_parameter_list *paramList)
-{
- GLuint i;
-
- if (!paramList)
- return;
-
- for (i = 0; i < paramList->NumParameters; i++) {
- if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) {
- _mesa_fetch_state(ctx,
- paramList->Parameters[i].StateIndexes,
- paramList->ParameterValues[i]);
- }
- }
-}
-
-
-/**
- * Copy the 16 elements of a matrix into four consecutive program
- * registers starting at 'pos'.
- */
-static void
-load_matrix(GLfloat registers[][4], GLuint pos, const GLfloat mat[16])
-{
- GLuint i;
- for (i = 0; i < 4; i++) {
- registers[pos + i][0] = mat[0 + i];
- registers[pos + i][1] = mat[4 + i];
- registers[pos + i][2] = mat[8 + i];
- registers[pos + i][3] = mat[12 + i];
- }
-}
-
-
-/**
- * As above, but transpose the matrix.
- */
-static void
-load_transpose_matrix(GLfloat registers[][4], GLuint pos,
- const GLfloat mat[16])
-{
- memcpy(registers[pos], mat, 16 * sizeof(GLfloat));
-}
-
-
-/**
- * Load current vertex program's parameter registers with tracked
- * matrices (if NV program). This only needs to be done per
- * glBegin/glEnd, not per-vertex.
- */
-void
-_mesa_load_tracked_matrices(struct gl_context *ctx)
-{
- GLuint i;
-
- for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
- /* point 'mat' at source matrix */
- GLmatrix *mat;
- if (ctx->VertexProgram.TrackMatrix[i] == GL_MODELVIEW) {
- mat = ctx->ModelviewMatrixStack.Top;
- }
- else if (ctx->VertexProgram.TrackMatrix[i] == GL_PROJECTION) {
- mat = ctx->ProjectionMatrixStack.Top;
- }
- else if (ctx->VertexProgram.TrackMatrix[i] == GL_TEXTURE) {
- GLuint unit = MIN2(ctx->Texture.CurrentUnit,
- Elements(ctx->TextureMatrixStack) - 1);
- mat = ctx->TextureMatrixStack[unit].Top;
- }
- else if (ctx->VertexProgram.TrackMatrix[i]==GL_MODELVIEW_PROJECTION_NV) {
- /* XXX verify the combined matrix is up to date */
- mat = &ctx->_ModelProjectMatrix;
- }
- else if (ctx->VertexProgram.TrackMatrix[i] >= GL_MATRIX0_NV &&
- ctx->VertexProgram.TrackMatrix[i] <= GL_MATRIX7_NV) {
- GLuint n = ctx->VertexProgram.TrackMatrix[i] - GL_MATRIX0_NV;
- ASSERT(n < Elements(ctx->ProgramMatrixStack));
- mat = ctx->ProgramMatrixStack[n].Top;
- }
- else {
- /* no matrix is tracked, but we leave the register values as-is */
- assert(ctx->VertexProgram.TrackMatrix[i] == GL_NONE);
- continue;
- }
-
- /* load the matrix values into sequential registers */
- if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_IDENTITY_NV) {
- load_matrix(ctx->VertexProgram.Parameters, i*4, mat->m);
- }
- else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_INVERSE_NV) {
- _math_matrix_analyse(mat); /* update the inverse */
- ASSERT(!_math_matrix_is_dirty(mat));
- load_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv);
- }
- else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_TRANSPOSE_NV) {
- load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->m);
- }
- else {
- assert(ctx->VertexProgram.TrackMatrixTransform[i]
- == GL_INVERSE_TRANSPOSE_NV);
- _math_matrix_analyse(mat); /* update the inverse */
- ASSERT(!_math_matrix_is_dirty(mat));
- load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv);
- }
- }
-}
diff --git a/src/mesa/program/prog_uniform.c b/src/mesa/program/prog_uniform.c
deleted file mode 100644
index 28acb88..0000000
--- a/src/mesa/program/prog_uniform.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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 prog_uniform.c
- * Shader uniform functions.
- * \author Brian Paul
- */
-
-#include "main/imports.h"
-#include "main/mtypes.h"
-#include "prog_uniform.h"
-
-
-struct gl_uniform_list *
-_mesa_new_uniform_list(void)
-{
- return CALLOC_STRUCT(gl_uniform_list);
-}
-
-
-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);
- }
- free(list->Uniforms);
- free(list);
-}
-
-
-struct gl_uniform *
-_mesa_append_uniform(struct gl_uniform_list *list,
- const char *name, GLenum target, GLuint progPos)
-{
- const GLuint oldNum = list->NumUniforms;
- struct gl_uniform *uniform;
- GLint index;
-
- assert(target == GL_VERTEX_PROGRAM_ARB ||
- target == GL_FRAGMENT_PROGRAM_ARB ||
- target == MESA_GEOMETRY_PROGRAM);
-
- index = _mesa_lookup_uniform(list, name);
- if (index < 0) {
- /* not found - append to list */
-
- if (oldNum + 1 > list->Size) {
- /* Need to grow the list array (alloc some extra) */
- list->Size += 4;
-
- /* realloc arrays */
- list->Uniforms = (struct gl_uniform *)
- _mesa_realloc(list->Uniforms,
- oldNum * sizeof(struct gl_uniform),
- list->Size * sizeof(struct gl_uniform));
- }
-
- if (!list->Uniforms) {
- /* out of memory */
- list->NumUniforms = 0;
- list->Size = 0;
- return GL_FALSE;
- }
-
- uniform = list->Uniforms + oldNum;
-
- uniform->Name = _mesa_strdup(name);
- uniform->VertPos = -1;
- uniform->FragPos = -1;
- uniform->GeomPos = -1;
- uniform->Initialized = GL_FALSE;
-
- list->NumUniforms++;
- }
- else {
- /* found */
- uniform = list->Uniforms + index;
- }
-
- /* update position for the vertex or fragment program */
- if (target == GL_VERTEX_PROGRAM_ARB) {
- if (uniform->VertPos != -1) {
- /* this uniform is already in the list - that shouldn't happen */
- return GL_FALSE;
- }
- uniform->VertPos = progPos;
- } 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;
-}
-
-
-/**
- * Return the location/index of the named uniform in the uniform list,
- * or -1 if not found.
- */
-GLint
-_mesa_lookup_uniform(const struct gl_uniform_list *list, const char *name)
-{
- GLuint i;
- for (i = 0; list && i < list->NumUniforms; i++) {
- if (!strcmp(list->Uniforms[i].Name, name)) {
- return i;
- }
- }
- return -1;
-}
-
-
-GLint
-_mesa_longest_uniform_name(const struct gl_uniform_list *list)
-{
- GLint max = 0;
- GLuint i;
- for (i = 0; list && i < list->NumUniforms; i++) {
- GLint len = (GLint) strlen(list->Uniforms[i].Name);
- if (len > max)
- max = len;
- }
- return max;
-}
-
-
-void
-_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 %d\n",
- i,
- list->Uniforms[i].Name,
- list->Uniforms[i].VertPos,
- list->Uniforms[i].FragPos,
- list->Uniforms[i].GeomPos);
- }
-}
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
deleted file mode 100644
index 9ffa49b..0000000
--- a/src/mesa/program/program.c
+++ /dev/null
@@ -1,1073 +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.
- */
-
-/**
- * \file program.c
- * Vertex and fragment program support functions.
- * \author Brian Paul
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/hash.h"
-#include "program.h"
-#include "prog_cache.h"
-#include "prog_parameter.h"
-#include "prog_instruction.h"
-
-
-/**
- * A pointer to this dummy program is put into the hash table when
- * glGenPrograms is called.
- */
-struct gl_program _mesa_DummyProgram;
-
-
-/**
- * Init context's vertex/fragment program state
- */
-void
-_mesa_init_program(struct gl_context *ctx)
-{
- GLuint i;
-
- /*
- * If this assertion fails, we need to increase the field
- * 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));
-
- /* If this fails, increase prog_instruction::TexSrcTarget size */
- ASSERT(NUM_TEXTURE_TARGETS < (1 << 3));
-
- ctx->Program.ErrorPos = -1;
- ctx->Program.ErrorString = _mesa_strdup("");
-
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
- ctx->VertexProgram.Enabled = GL_FALSE;
-#if FEATURE_es2_glsl
- ctx->VertexProgram.PointSizeEnabled =
- (ctx->API == API_OPENGLES2) ? GL_TRUE : GL_FALSE;
-#else
- ctx->VertexProgram.PointSizeEnabled = GL_FALSE;
-#endif
- ctx->VertexProgram.TwoSideEnabled = GL_FALSE;
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
- ctx->Shared->DefaultVertexProgram);
- assert(ctx->VertexProgram.Current);
- for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
- ctx->VertexProgram.TrackMatrix[i] = GL_NONE;
- ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV;
- }
- ctx->VertexProgram.Cache = _mesa_new_program_cache();
-#endif
-
-#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
- ctx->FragmentProgram.Enabled = GL_FALSE;
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
- ctx->Shared->DefaultFragmentProgram);
- assert(ctx->FragmentProgram.Current);
- 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
- ctx->ATIFragmentShader.Enabled = GL_FALSE;
- ctx->ATIFragmentShader.Current = ctx->Shared->DefaultFragmentShader;
- assert(ctx->ATIFragmentShader.Current);
- ctx->ATIFragmentShader.Current->RefCount++;
-#endif
-}
-
-
-/**
- * Free a context's vertex/fragment program state
- */
-void
-_mesa_free_program_data(struct gl_context *ctx)
-{
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
- _mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache);
-#endif
-#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
- _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) {
- ctx->ATIFragmentShader.Current->RefCount--;
- if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
- free(ctx->ATIFragmentShader.Current);
- }
- }
-#endif
- free((void *) ctx->Program.ErrorString);
-}
-
-
-/**
- * Update the default program objects in the given context to reference those
- * specified in the shared state and release those referencing the old
- * shared state.
- */
-void
-_mesa_update_default_objects_program(struct gl_context *ctx)
-{
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
- (struct gl_vertex_program *)
- ctx->Shared->DefaultVertexProgram);
- assert(ctx->VertexProgram.Current);
-#endif
-
-#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
- (struct gl_fragment_program *)
- ctx->Shared->DefaultFragmentProgram);
- 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) {
- ctx->ATIFragmentShader.Current->RefCount--;
- if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
- free(ctx->ATIFragmentShader.Current);
- }
- }
- ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader;
- assert(ctx->ATIFragmentShader.Current);
- ctx->ATIFragmentShader.Current->RefCount++;
-#endif
-}
-
-
-/**
- * Set the vertex/fragment program error state (position and error string).
- * This is generally called from within the parsers.
- */
-void
-_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string)
-{
- ctx->Program.ErrorPos = pos;
- free((void *) ctx->Program.ErrorString);
- if (!string)
- string = "";
- ctx->Program.ErrorString = _mesa_strdup(string);
-}
-
-
-/**
- * Find the line number and column for 'pos' within 'string'.
- * Return a copy of the line which contains 'pos'. Free the line with
- * free().
- * \param string the program string
- * \param pos the position within the string
- * \param line returns the line number corresponding to 'pos'.
- * \param col returns the column number corresponding to 'pos'.
- * \return copy of the line containing 'pos'.
- */
-const GLubyte *
-_mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
- GLint *line, GLint *col)
-{
- const GLubyte *lineStart = string;
- const GLubyte *p = string;
- GLubyte *s;
- int len;
-
- *line = 1;
-
- while (p != pos) {
- if (*p == (GLubyte) '\n') {
- (*line)++;
- lineStart = p + 1;
- }
- p++;
- }
-
- *col = (pos - lineStart) + 1;
-
- /* return copy of this line */
- while (*p != 0 && *p != '\n')
- p++;
- len = p - lineStart;
- s = (GLubyte *) malloc(len + 1);
- memcpy(s, lineStart, len);
- s[len] = 0;
-
- return s;
-}
-
-
-/**
- * Initialize a new vertex/fragment program object.
- */
-static struct gl_program *
-_mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog,
- GLenum target, GLuint id)
-{
- (void) ctx;
- if (prog) {
- GLuint i;
- memset(prog, 0, sizeof(*prog));
- prog->Id = id;
- prog->Target = target;
- prog->Resident = GL_TRUE;
- prog->RefCount = 1;
- prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
-
- /* default mapping from samplers to texture units */
- for (i = 0; i < MAX_SAMPLERS; i++)
- prog->SamplerUnits[i] = i;
- }
-
- return prog;
-}
-
-
-/**
- * Initialize a new fragment program object.
- */
-struct gl_program *
-_mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program *prog,
- GLenum target, GLuint id)
-{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
-}
-
-
-/**
- * Initialize a new vertex program object.
- */
-struct gl_program *
-_mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *prog,
- GLenum target, GLuint id)
-{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
-}
-
-
-/**
- * Initialize a new geometry program object.
- */
-struct gl_program *
-_mesa_init_geometry_program( struct gl_context *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
- * device driver function to implement OO deriviation with additional
- * types not understood by this function.
- *
- * \param ctx context
- * \param id program id/number
- * \param target program target/type
- * \return pointer to new program object
- */
-struct gl_program *
-_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
-{
- struct gl_program *prog;
- switch (target) {
- case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
- case GL_VERTEX_STATE_PROGRAM_NV:
- prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program),
- target, id );
- break;
- case GL_FRAGMENT_PROGRAM_NV:
- case GL_FRAGMENT_PROGRAM_ARB:
- prog =_mesa_init_fragment_program(ctx,
- 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;
- }
- return prog;
-}
-
-
-/**
- * Delete a program and remove it from the hash table, ignoring the
- * reference count.
- * Called via ctx->Driver.DeleteProgram. May be wrapped (OO deriviation)
- * by a device driver function.
- */
-void
-_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
-{
- (void) ctx;
- ASSERT(prog);
- ASSERT(prog->RefCount==0);
-
- if (prog == &_mesa_DummyProgram)
- return;
-
- if (prog->String)
- free(prog->String);
-
- _mesa_free_instructions(prog->Instructions, prog->NumInstructions);
-
- if (prog->Parameters) {
- _mesa_free_parameter_list(prog->Parameters);
- }
- if (prog->Varying) {
- _mesa_free_parameter_list(prog->Varying);
- }
- if (prog->Attributes) {
- _mesa_free_parameter_list(prog->Attributes);
- }
-
- free(prog);
-}
-
-
-/**
- * Return the gl_program object for a given ID.
- * Basically just a wrapper for _mesa_HashLookup() to avoid a lot of
- * casts elsewhere.
- */
-struct gl_program *
-_mesa_lookup_program(struct gl_context *ctx, GLuint id)
-{
- if (id)
- return (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id);
- else
- return NULL;
-}
-
-
-/**
- * Reference counting for vertex/fragment programs
- */
-void
-_mesa_reference_program(struct gl_context *ctx,
- struct gl_program **ptr,
- struct gl_program *prog)
-{
- assert(ptr);
- if (*ptr && prog) {
- /* sanity check */
- if ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB)
- ASSERT(prog->Target == GL_VERTEX_PROGRAM_ARB);
- 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 */
- }
- if (*ptr) {
- GLboolean deleteFlag;
-
- /*_glthread_LOCK_MUTEX((*ptr)->Mutex);*/
-#if 0
- printf("Program %p ID=%u Target=%s Refcount-- to %d\n",
- *ptr, (*ptr)->Id,
- ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB ? "VP" :
- ((*ptr)->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
- (*ptr)->RefCount - 1);
-#endif
- ASSERT((*ptr)->RefCount > 0);
- (*ptr)->RefCount--;
-
- deleteFlag = ((*ptr)->RefCount == 0);
- /*_glthread_UNLOCK_MUTEX((*ptr)->Mutex);*/
-
- if (deleteFlag) {
- ASSERT(ctx);
- ctx->Driver.DeleteProgram(ctx, *ptr);
- }
-
- *ptr = NULL;
- }
-
- assert(!*ptr);
- if (prog) {
- /*_glthread_LOCK_MUTEX(prog->Mutex);*/
- prog->RefCount++;
-#if 0
- printf("Program %p ID=%u Target=%s Refcount++ to %d\n",
- prog, prog->Id,
- (prog->Target == GL_VERTEX_PROGRAM_ARB ? "VP" :
- (prog->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
- prog->RefCount);
-#endif
- /*_glthread_UNLOCK_MUTEX(prog->Mutex);*/
- }
-
- *ptr = prog;
-}
-
-
-/**
- * Return a copy of a program.
- * XXX Problem here if the program object is actually OO-derivation
- * made by a device driver.
- */
-struct gl_program *
-_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
-{
- struct gl_program *clone;
-
- clone = ctx->Driver.NewProgram(ctx, prog->Target, prog->Id);
- if (!clone)
- return NULL;
-
- assert(clone->Target == prog->Target);
- assert(clone->RefCount == 1);
-
- clone->String = (GLubyte *) _mesa_strdup((char *) prog->String);
- clone->Format = prog->Format;
- clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions);
- if (!clone->Instructions) {
- _mesa_reference_program(ctx, &clone, NULL);
- return NULL;
- }
- _mesa_copy_instructions(clone->Instructions, prog->Instructions,
- prog->NumInstructions);
- clone->InputsRead = prog->InputsRead;
- clone->OutputsWritten = prog->OutputsWritten;
- clone->SamplersUsed = prog->SamplersUsed;
- clone->ShadowSamplers = prog->ShadowSamplers;
- memcpy(clone->TexturesUsed, prog->TexturesUsed, sizeof(prog->TexturesUsed));
-
- if (prog->Parameters)
- clone->Parameters = _mesa_clone_parameter_list(prog->Parameters);
- memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams));
- if (prog->Varying)
- clone->Varying = _mesa_clone_parameter_list(prog->Varying);
- 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;
- clone->NumAttributes = prog->NumAttributes;
- clone->NumAddressRegs = prog->NumAddressRegs;
- clone->NumNativeInstructions = prog->NumNativeInstructions;
- clone->NumNativeTemporaries = prog->NumNativeTemporaries;
- clone->NumNativeParameters = prog->NumNativeParameters;
- clone->NumNativeAttributes = prog->NumNativeAttributes;
- clone->NumNativeAddressRegs = prog->NumNativeAddressRegs;
- clone->NumAluInstructions = prog->NumAluInstructions;
- clone->NumTexInstructions = prog->NumTexInstructions;
- clone->NumTexIndirections = prog->NumTexIndirections;
- clone->NumNativeAluInstructions = prog->NumNativeAluInstructions;
- clone->NumNativeTexInstructions = prog->NumNativeTexInstructions;
- clone->NumNativeTexIndirections = prog->NumNativeTexIndirections;
-
- switch (prog->Target) {
- case GL_VERTEX_PROGRAM_ARB:
- {
- const struct gl_vertex_program *vp
- = (const struct gl_vertex_program *) prog;
- struct gl_vertex_program *vpc = (struct gl_vertex_program *) clone;
- vpc->IsPositionInvariant = vp->IsPositionInvariant;
- vpc->IsNVProgram = vp->IsNVProgram;
- }
- break;
- case GL_FRAGMENT_PROGRAM_ARB:
- {
- const struct gl_fragment_program *fp
- = (const struct gl_fragment_program *) prog;
- struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone;
- fpc->FogOption = fp->FogOption;
- fpc->UsesKill = fp->UsesKill;
- fpc->OriginUpperLeft = fp->OriginUpperLeft;
- 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");
- }
-
- return clone;
-}
-
-
-/**
- * Insert 'count' NOP instructions at 'start' in the given program.
- * Adjust branch targets accordingly.
- */
-GLboolean
-_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count)
-{
- const GLuint origLen = prog->NumInstructions;
- const GLuint newLen = origLen + count;
- struct prog_instruction *newInst;
- GLuint i;
-
- /* adjust branches */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
- if (inst->BranchTarget > 0) {
- if ((GLuint)inst->BranchTarget >= start) {
- inst->BranchTarget += count;
- }
- }
- }
-
- /* Alloc storage for new instructions */
- newInst = _mesa_alloc_instructions(newLen);
- if (!newInst) {
- return GL_FALSE;
- }
-
- /* Copy 'start' instructions into new instruction buffer */
- _mesa_copy_instructions(newInst, prog->Instructions, start);
-
- /* init the new instructions */
- _mesa_init_instructions(newInst + start, count);
-
- /* Copy the remaining/tail instructions to new inst buffer */
- _mesa_copy_instructions(newInst + start + count,
- prog->Instructions + start,
- origLen - start);
-
- /* free old instructions */
- _mesa_free_instructions(prog->Instructions, origLen);
-
- /* install new instructions */
- prog->Instructions = newInst;
- prog->NumInstructions = newLen;
-
- return GL_TRUE;
-}
-
-/**
- * Delete 'count' instructions at 'start' in the given program.
- * Adjust branch targets accordingly.
- */
-GLboolean
-_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count)
-{
- const GLuint origLen = prog->NumInstructions;
- const GLuint newLen = origLen - count;
- struct prog_instruction *newInst;
- GLuint i;
-
- /* adjust branches */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
- if (inst->BranchTarget > 0) {
- if (inst->BranchTarget > (GLint) start) {
- inst->BranchTarget -= count;
- }
- }
- }
-
- /* Alloc storage for new instructions */
- newInst = _mesa_alloc_instructions(newLen);
- if (!newInst) {
- return GL_FALSE;
- }
-
- /* Copy 'start' instructions into new instruction buffer */
- _mesa_copy_instructions(newInst, prog->Instructions, start);
-
- /* Copy the remaining/tail instructions to new inst buffer */
- _mesa_copy_instructions(newInst + start,
- prog->Instructions + start + count,
- newLen - start);
-
- /* free old instructions */
- _mesa_free_instructions(prog->Instructions, origLen);
-
- /* install new instructions */
- prog->Instructions = newInst;
- prog->NumInstructions = newLen;
-
- return GL_TRUE;
-}
-
-
-/**
- * Search instructions for registers that match (oldFile, oldIndex),
- * replacing them with (newFile, newIndex).
- */
-static void
-replace_registers(struct prog_instruction *inst, GLuint numInst,
- GLuint oldFile, GLuint oldIndex,
- GLuint newFile, GLuint newIndex)
-{
- GLuint i, j;
- for (i = 0; i < numInst; i++) {
- /* src regs */
- for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) {
- if (inst[i].SrcReg[j].File == oldFile &&
- inst[i].SrcReg[j].Index == oldIndex) {
- inst[i].SrcReg[j].File = newFile;
- inst[i].SrcReg[j].Index = newIndex;
- }
- }
- /* dst reg */
- if (inst[i].DstReg.File == oldFile && inst[i].DstReg.Index == oldIndex) {
- inst[i].DstReg.File = newFile;
- inst[i].DstReg.Index = newIndex;
- }
- }
-}
-
-
-/**
- * Search instructions for references to program parameters. When found,
- * increment the parameter index by 'offset'.
- * Used when combining programs.
- */
-static void
-adjust_param_indexes(struct prog_instruction *inst, GLuint numInst,
- GLuint offset)
-{
- GLuint i, j;
- for (i = 0; i < numInst; i++) {
- for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) {
- GLuint f = inst[i].SrcReg[j].File;
- if (f == PROGRAM_CONSTANT ||
- f == PROGRAM_UNIFORM ||
- f == PROGRAM_STATE_VAR) {
- inst[i].SrcReg[j].Index += offset;
- }
- }
- }
-}
-
-
-/**
- * Combine two programs into one. Fix instructions so the outputs of
- * the first program go to the inputs of the second program.
- */
-struct gl_program *
-_mesa_combine_programs(struct gl_context *ctx,
- const struct gl_program *progA,
- const struct gl_program *progB)
-{
- struct prog_instruction *newInst;
- struct gl_program *newProg;
- const GLuint lenA = progA->NumInstructions - 1; /* omit END instr */
- const GLuint lenB = progB->NumInstructions;
- const GLuint numParamsA = _mesa_num_parameters(progA->Parameters);
- const GLuint newLength = lenA + lenB;
- GLboolean usedTemps[MAX_PROGRAM_TEMPS];
- GLuint firstTemp = 0;
- GLbitfield inputsB;
- GLuint i;
-
- ASSERT(progA->Target == progB->Target);
-
- newInst = _mesa_alloc_instructions(newLength);
- if (!newInst)
- return GL_FALSE;
-
- _mesa_copy_instructions(newInst, progA->Instructions, lenA);
- _mesa_copy_instructions(newInst + lenA, progB->Instructions, lenB);
-
- /* adjust branch / instruction addresses for B's instructions */
- for (i = 0; i < lenB; i++) {
- newInst[lenA + i].BranchTarget += lenA;
- }
-
- newProg = ctx->Driver.NewProgram(ctx, progA->Target, 0);
- newProg->Instructions = newInst;
- newProg->NumInstructions = newLength;
-
- /* find used temp regs (we may need new temps below) */
- _mesa_find_used_registers(newProg, PROGRAM_TEMPORARY,
- usedTemps, MAX_PROGRAM_TEMPS);
-
- if (newProg->Target == GL_FRAGMENT_PROGRAM_ARB) {
- struct gl_fragment_program *fprogA, *fprogB, *newFprog;
- GLbitfield progB_inputsRead = progB->InputsRead;
- GLint progB_colorFile, progB_colorIndex;
-
- fprogA = (struct gl_fragment_program *) progA;
- fprogB = (struct gl_fragment_program *) progB;
- newFprog = (struct gl_fragment_program *) newProg;
-
- newFprog->UsesKill = fprogA->UsesKill || fprogB->UsesKill;
-
- /* We'll do a search and replace for instances
- * of progB_colorFile/progB_colorIndex below...
- */
- progB_colorFile = PROGRAM_INPUT;
- progB_colorIndex = FRAG_ATTRIB_COL0;
-
- /*
- * The fragment program may get color from a state var rather than
- * a fragment input (vertex output) if it's constant.
- * See the texenvprogram.c code.
- * So, search the program's parameter list now to see if the program
- * gets color from a state var instead of a conventional fragment
- * input register.
- */
- for (i = 0; i < progB->Parameters->NumParameters; i++) {
- struct gl_program_parameter *p = &progB->Parameters->Parameters[i];
- if (p->Type == PROGRAM_STATE_VAR &&
- p->StateIndexes[0] == STATE_INTERNAL &&
- p->StateIndexes[1] == STATE_CURRENT_ATTRIB &&
- (int) p->StateIndexes[2] == (int) VERT_ATTRIB_COLOR0) {
- progB_inputsRead |= FRAG_BIT_COL0;
- progB_colorFile = PROGRAM_STATE_VAR;
- progB_colorIndex = i;
- break;
- }
- }
-
- /* Connect color outputs of fprogA to color inputs of fprogB, via a
- * new temporary register.
- */
- if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) &&
- (progB_inputsRead & FRAG_BIT_COL0)) {
- GLint tempReg = _mesa_find_free_register(usedTemps, MAX_PROGRAM_TEMPS,
- firstTemp);
- if (tempReg < 0) {
- _mesa_problem(ctx, "No free temp regs found in "
- "_mesa_combine_programs(), using 31");
- tempReg = 31;
- }
- firstTemp = tempReg + 1;
-
- /* replace writes to result.color[0] with tempReg */
- replace_registers(newInst, lenA,
- PROGRAM_OUTPUT, FRAG_RESULT_COLOR,
- PROGRAM_TEMPORARY, tempReg);
- /* replace reads from the input color with tempReg */
- replace_registers(newInst + lenA, lenB,
- progB_colorFile, progB_colorIndex, /* search for */
- PROGRAM_TEMPORARY, tempReg /* replace with */ );
- }
-
- /* compute combined program's InputsRead */
- inputsB = progB_inputsRead;
- if (progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
- inputsB &= ~(1 << FRAG_ATTRIB_COL0);
- }
- newProg->InputsRead = progA->InputsRead | inputsB;
- newProg->OutputsWritten = progB->OutputsWritten;
- newProg->SamplersUsed = progA->SamplersUsed | progB->SamplersUsed;
- }
- else {
- /* vertex program */
- assert(0); /* XXX todo */
- }
-
- /*
- * Merge parameters (uniforms, constants, etc)
- */
- newProg->Parameters = _mesa_combine_parameter_lists(progA->Parameters,
- progB->Parameters);
-
- adjust_param_indexes(newInst + lenA, lenB, numParamsA);
-
-
- return newProg;
-}
-
-
-/**
- * Populate the 'used' array with flags indicating which registers (TEMPs,
- * INPUTs, OUTPUTs, etc, are used by the given program.
- * \param file type of register to scan for
- * \param used returns true/false flags for in use / free
- * \param usedSize size of the 'used' array
- */
-void
-_mesa_find_used_registers(const struct gl_program *prog,
- gl_register_file file,
- GLboolean used[], GLuint usedSize)
-{
- GLuint i, j;
-
- memset(used, 0, usedSize);
-
- for (i = 0; i < prog->NumInstructions; i++) {
- const struct prog_instruction *inst = prog->Instructions + i;
- const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
-
- if (inst->DstReg.File == file) {
- 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) {
- ASSERT(inst->SrcReg[j].Index < usedSize);
- if(inst->SrcReg[j].Index < usedSize)
- used[inst->SrcReg[j].Index] = GL_TRUE;
- }
- }
- }
-}
-
-
-/**
- * Scan the given 'used' register flag array for the first entry
- * that's >= firstReg.
- * \param used vector of flags indicating registers in use (as returned
- * by _mesa_find_used_registers())
- * \param usedSize size of the 'used' array
- * \param firstReg first register to start searching at
- * \return index of unused register, or -1 if none.
- */
-GLint
-_mesa_find_free_register(const GLboolean used[],
- GLuint usedSize, GLuint firstReg)
-{
- GLuint i;
-
- assert(firstReg < usedSize);
-
- for (i = firstReg; i < usedSize; i++)
- if (!used[i])
- return i;
-
- return -1;
-}
-
-
-
-/**
- * Check if the given register index is valid (doesn't exceed implementation-
- * dependent limits).
- * \return GL_TRUE if OK, GL_FALSE if bad index
- */
-GLboolean
-_mesa_valid_register_index(const struct gl_context *ctx,
- gl_shader_type shaderType,
- gl_register_file file, GLint index)
-{
- const struct gl_program_constants *c;
-
- switch (shaderType) {
- case MESA_SHADER_VERTEX:
- c = &ctx->Const.VertexProgram;
- break;
- case MESA_SHADER_FRAGMENT:
- c = &ctx->Const.FragmentProgram;
- break;
- case MESA_SHADER_GEOMETRY:
- c = &ctx->Const.GeometryProgram;
- break;
- default:
- _mesa_problem(ctx,
- "unexpected shader type in _mesa_valid_register_index()");
- return GL_FALSE;
- }
-
- switch (file) {
- case PROGRAM_UNDEFINED:
- return GL_TRUE; /* XXX or maybe false? */
-
- case PROGRAM_TEMPORARY:
- return index >= 0 && index < c->MaxTemps;
-
- case PROGRAM_ENV_PARAM:
- return index >= 0 && index < c->MaxEnvParams;
-
- case PROGRAM_LOCAL_PARAM:
- return index >= 0 && index < c->MaxLocalParams;
-
- case PROGRAM_NAMED_PARAM:
- return index >= 0 && index < c->MaxParameters;
-
- case PROGRAM_UNIFORM:
- case PROGRAM_STATE_VAR:
- /* aka constant buffer */
- return index >= 0 && index < c->MaxUniformComponents / 4;
-
- case PROGRAM_CONSTANT:
- /* constant buffer w/ possible relative negative addressing */
- return (index > (int) c->MaxUniformComponents / -4 &&
- index < c->MaxUniformComponents / 4);
-
- case PROGRAM_INPUT:
- if (index < 0)
- return GL_FALSE;
-
- switch (shaderType) {
- case MESA_SHADER_VERTEX:
- return index < VERT_ATTRIB_GENERIC0 + c->MaxAttribs;
- case MESA_SHADER_FRAGMENT:
- return index < FRAG_ATTRIB_VAR0 + ctx->Const.MaxVarying;
- case MESA_SHADER_GEOMETRY:
- return index < GEOM_ATTRIB_VAR0 + ctx->Const.MaxVarying;
- default:
- return GL_FALSE;
- }
-
- case PROGRAM_OUTPUT:
- if (index < 0)
- return GL_FALSE;
-
- switch (shaderType) {
- case MESA_SHADER_VERTEX:
- return index < VERT_RESULT_VAR0 + ctx->Const.MaxVarying;
- case MESA_SHADER_FRAGMENT:
- return index < FRAG_RESULT_DATA0 + ctx->Const.MaxDrawBuffers;
- case MESA_SHADER_GEOMETRY:
- return index < GEOM_RESULT_VAR0 + ctx->Const.MaxVarying;
- default:
- return GL_FALSE;
- }
-
- case PROGRAM_ADDRESS:
- return index >= 0 && index < c->MaxAddressRegs;
-
- default:
- _mesa_problem(ctx,
- "unexpected register file in _mesa_valid_register_index()");
- return GL_FALSE;
- }
-}
-
-
-
-/**
- * "Post-process" a GPU program. This is intended to be used for debugging.
- * Example actions include no-op'ing instructions or changing instruction
- * behaviour.
- */
-void
-_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog)
-{
- static const GLfloat white[4] = { 0.5, 0.5, 0.5, 0.5 };
- GLuint i;
- GLuint whiteSwizzle;
- GLint whiteIndex = _mesa_add_unnamed_constant(prog->Parameters,
- white, 4, &whiteSwizzle);
-
- (void) whiteIndex;
-
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
- const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
-
- (void) n;
-
- if (_mesa_is_tex_instruction(inst->Opcode)) {
-#if 0
- /* replace TEX/TXP/TXB with MOV */
- inst->Opcode = OPCODE_MOV;
- inst->DstReg.WriteMask = WRITEMASK_XYZW;
- inst->SrcReg[0].Swizzle = SWIZZLE_XYZW;
- inst->SrcReg[0].Negate = NEGATE_NONE;
-#endif
-
-#if 0
- /* disable shadow texture mode */
- inst->TexShadow = 0;
-#endif
- }
-
- if (inst->Opcode == OPCODE_TXP) {
-#if 0
- inst->Opcode = OPCODE_MOV;
- inst->DstReg.WriteMask = WRITEMASK_XYZW;
- inst->SrcReg[0].File = PROGRAM_CONSTANT;
- inst->SrcReg[0].Index = whiteIndex;
- inst->SrcReg[0].Swizzle = SWIZZLE_XYZW;
- inst->SrcReg[0].Negate = NEGATE_NONE;
-#endif
-#if 0
- inst->TexShadow = 0;
-#endif
-#if 0
- inst->Opcode = OPCODE_TEX;
- inst->TexShadow = 0;
-#endif
- }
-
- }
-}
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
deleted file mode 100644
index ce37b95..0000000
--- a/src/mesa/program/program.h
+++ /dev/null
@@ -1,210 +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.
- */
-
-/**
- * \file program.c
- * Vertex and fragment program support functions.
- * \author Brian Paul
- */
-
-
-/**
- * \mainpage Mesa vertex and fragment program module
- *
- * This module or directory contains most of the code for vertex and
- * fragment programs and shaders, including state management, parsers,
- * and (some) software routines for executing programs
- */
-
-#ifndef PROGRAM_H
-#define PROGRAM_H
-
-#include "main/compiler.h"
-#include "main/mtypes.h"
-
-
-extern struct gl_program _mesa_DummyProgram;
-
-
-extern void
-_mesa_init_program(struct gl_context *ctx);
-
-extern void
-_mesa_free_program_data(struct gl_context *ctx);
-
-extern void
-_mesa_update_default_objects_program(struct gl_context *ctx);
-
-extern void
-_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string);
-
-extern const GLubyte *
-_mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
- GLint *line, GLint *col);
-
-
-extern struct gl_program *
-_mesa_init_vertex_program(struct gl_context *ctx,
- struct gl_vertex_program *prog,
- GLenum target, GLuint id);
-
-extern struct gl_program *
-_mesa_init_fragment_program(struct gl_context *ctx,
- struct gl_fragment_program *prog,
- GLenum target, GLuint id);
-
-extern struct gl_program *
-_mesa_init_geometry_program(struct gl_context *ctx,
- struct gl_geometry_program *prog,
- GLenum target, GLuint id);
-
-extern struct gl_program *
-_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id);
-
-extern void
-_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog);
-
-extern struct gl_program *
-_mesa_lookup_program(struct gl_context *ctx, GLuint id);
-
-extern void
-_mesa_reference_program(struct gl_context *ctx,
- struct gl_program **ptr,
- struct gl_program *prog);
-
-static INLINE void
-_mesa_reference_vertprog(struct gl_context *ctx,
- struct gl_vertex_program **ptr,
- struct gl_vertex_program *prog)
-{
- _mesa_reference_program(ctx, (struct gl_program **) ptr,
- (struct gl_program *) prog);
-}
-
-static INLINE void
-_mesa_reference_fragprog(struct gl_context *ctx,
- struct gl_fragment_program **ptr,
- struct gl_fragment_program *prog)
-{
- _mesa_reference_program(ctx, (struct gl_program **) ptr,
- (struct gl_program *) prog);
-}
-
-static INLINE void
-_mesa_reference_geomprog(struct gl_context *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(struct gl_context *ctx, const struct gl_program *prog);
-
-static INLINE struct gl_vertex_program *
-_mesa_clone_vertex_program(struct gl_context *ctx,
- const struct gl_vertex_program *prog)
-{
- return (struct gl_vertex_program *) _mesa_clone_program(ctx, &prog->Base);
-}
-
-static INLINE struct gl_geometry_program *
-_mesa_clone_geometry_program(struct gl_context *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(struct gl_context *ctx,
- const struct gl_fragment_program *prog)
-{
- return (struct gl_fragment_program *) _mesa_clone_program(ctx, &prog->Base);
-}
-
-
-extern GLboolean
-_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count);
-
-extern GLboolean
-_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count);
-
-extern struct gl_program *
-_mesa_combine_programs(struct gl_context *ctx,
- const struct gl_program *progA,
- const struct gl_program *progB);
-
-extern void
-_mesa_find_used_registers(const struct gl_program *prog,
- gl_register_file file,
- GLboolean used[], GLuint usedSize);
-
-extern GLint
-_mesa_find_free_register(const GLboolean used[],
- GLuint maxRegs, GLuint firstReg);
-
-
-extern GLboolean
-_mesa_valid_register_index(const struct gl_context *ctx,
- gl_shader_type shaderType,
- gl_register_file file, GLint index);
-
-extern void
-_mesa_postprocess_program(struct gl_context *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/src/mesa/program/program_lexer.l b/src/mesa/program/program_lexer.l
deleted file mode 100644
index 0a50dab..0000000
--- a/src/mesa/program/program_lexer.l
+++ /dev/null
@@ -1,507 +0,0 @@
-%{
-/*
- * 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 "main/glheader.h"
-#include "main/imports.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)
-#define require_NV_fp (yyextra->option.NV_fragment)
-#define require_shadow (yyextra->option.Shadow)
-#define require_rect (yyextra->option.TexRect)
-#define require_texarray (yyextra->option.TexArray)
-
-#ifndef HAVE_UNISTD_H
-#define YY_NO_UNISTD_H
-#endif
-
-#define return_token_or_IDENTIFIER(condition, token) \
- do { \
- if (condition) { \
- return token; \
- } else { \
- return handle_ident(yyextra, yytext, yylval); \
- } \
- } while (0)
-
-#define return_token_or_DOT(condition, token) \
- do { \
- if (condition) { \
- return token; \
- } else { \
- yyless(1); \
- return DOT; \
- } \
- } while (0)
-
-
-#define return_opcode(condition, token, opcode, len) \
- do { \
- if (condition && \
- _mesa_parse_instruction_suffix(yyextra, \
- yytext + len, \
- & yylval->temp_inst)) { \
- yylval->temp_inst.Opcode = OPCODE_ ## opcode; \
- return token; \
- } else { \
- return handle_ident(yyextra, yytext, yylval); \
- } \
- } while (0)
-
-#define SWIZZLE_INVAL MAKE_SWIZZLE4(SWIZZLE_NIL, SWIZZLE_NIL, \
- SWIZZLE_NIL, SWIZZLE_NIL)
-
-static unsigned
-mask_from_char(char c)
-{
- switch (c) {
- case 'x':
- case 'r':
- return WRITEMASK_X;
- case 'y':
- case 'g':
- return WRITEMASK_Y;
- case 'z':
- case 'b':
- return WRITEMASK_Z;
- case 'w':
- case 'a':
- return WRITEMASK_W;
- }
-
- return 0;
-}
-
-static unsigned
-swiz_from_char(char c)
-{
- switch (c) {
- case 'x':
- case 'r':
- return SWIZZLE_X;
- case 'y':
- case 'g':
- return SWIZZLE_Y;
- case 'z':
- case 'b':
- return SWIZZLE_Z;
- case 'w':
- case 'a':
- return SWIZZLE_W;
- }
-
- return 0;
-}
-
-static int
-handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval)
-{
- lval->string = strdup(text);
-
- return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL)
- ? IDENTIFIER : USED_IDENTIFIER;
-}
-
-#define YY_USER_ACTION \
- do { \
- yylloc->first_column = yylloc->last_column; \
- yylloc->last_column += yyleng; \
- if ((yylloc->first_line == 1) \
- && (yylloc->first_column == 1)) { \
- yylloc->position = 1; \
- } else { \
- yylloc->position += yylloc->last_column - yylloc->first_column; \
- } \
- } 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]+
-exp [Ee][-+]?[0-9]+
-frac "."[0-9]+
-dot "."[ \t]*
-
-sz [HRX]?
-szf [HR]?
-cc C?
-sat (_SAT)?
-
-%option bison-bridge bison-locations reentrant noyywrap
-%%
-
-"!!ARBvp1.0" { return ARBvp_10; }
-"!!ARBfp1.0" { return ARBfp_10; }
-ADDRESS {
- yylval->integer = at_address;
- return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS);
-}
-ALIAS { return ALIAS; }
-ATTRIB { return ATTRIB; }
-END { return END; }
-OPTION { return OPTION; }
-OUTPUT { return OUTPUT; }
-PARAM { return PARAM; }
-TEMP { yylval->integer = at_temp; return TEMP; }
-
-ABS{sz}{cc}{sat} { return_opcode( 1, VECTOR_OP, ABS, 3); }
-ADD{sz}{cc}{sat} { return_opcode( 1, BIN_OP, ADD, 3); }
-ARL { return_opcode(require_ARB_vp, ARL, ARL, 3); }
-
-CMP{sat} { return_opcode(require_ARB_fp, TRI_OP, CMP, 3); }
-COS{szf}{cc}{sat} { return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); }
-
-DDX{szf}{cc}{sat} { return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); }
-DDY{szf}{cc}{sat} { return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); }
-DP3{sz}{cc}{sat} { return_opcode( 1, BIN_OP, DP3, 3); }
-DP4{sz}{cc}{sat} { return_opcode( 1, BIN_OP, DP4, 3); }
-DPH{sz}{cc}{sat} { return_opcode( 1, BIN_OP, DPH, 3); }
-DST{szf}{cc}{sat} { return_opcode( 1, BIN_OP, DST, 3); }
-
-EX2{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, EX2, 3); }
-EXP { return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); }
-
-FLR{sz}{cc}{sat} { return_opcode( 1, VECTOR_OP, FLR, 3); }
-FRC{sz}{cc}{sat} { return_opcode( 1, VECTOR_OP, FRC, 3); }
-
-KIL { return_opcode(require_ARB_fp, KIL, KIL, 3); }
-
-LIT{szf}{cc}{sat} { return_opcode( 1, VECTOR_OP, LIT, 3); }
-LG2{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, LG2, 3); }
-LOG { return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); }
-LRP{sz}{cc}{sat} { return_opcode(require_ARB_fp, TRI_OP, LRP, 3); }
-
-MAD{sz}{cc}{sat} { return_opcode( 1, TRI_OP, MAD, 3); }
-MAX{sz}{cc}{sat} { return_opcode( 1, BIN_OP, MAX, 3); }
-MIN{sz}{cc}{sat} { return_opcode( 1, BIN_OP, MIN, 3); }
-MOV{sz}{cc}{sat} { return_opcode( 1, VECTOR_OP, MOV, 3); }
-MUL{sz}{cc}{sat} { return_opcode( 1, BIN_OP, MUL, 3); }
-
-PK2H { return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); }
-PK2US { return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); }
-PK4B { return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); }
-PK4UB { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); }
-POW{szf}{cc}{sat} { return_opcode( 1, BINSC_OP, POW, 3); }
-
-RCP{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, RCP, 3); }
-RFL{szf}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, RFL, 3); }
-RSQ{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, RSQ, 3); }
-
-SCS{sat} { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); }
-SEQ{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SEQ, 3); }
-SFL{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SFL, 3); }
-SGE{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SGE, 3); }
-SGT{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SGT, 3); }
-SIN{szf}{cc}{sat} { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); }
-SLE{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SLE, 3); }
-SLT{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SLT, 3); }
-SNE{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SNE, 3); }
-STR{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, STR, 3); }
-SUB{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SUB, 3); }
-SWZ{sat} { return_opcode( 1, SWZ, SWZ, 3); }
-
-TEX{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); }
-TXB{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); }
-TXD{cc}{sat} { return_opcode(require_NV_fp, TXD_OP, TXD, 3); }
-TXP{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); }
-
-UP2H{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); }
-UP2US{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); }
-UP4B{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); }
-UP4UB{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); }
-
-X2D{szf}{cc}{sat} { return_opcode(require_NV_fp, TRI_OP, X2D, 3); }
-XPD{sat} { return_opcode( 1, BIN_OP, XPD, 3); }
-
-vertex { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); }
-fragment { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); }
-program { return PROGRAM; }
-state { return STATE; }
-result { return RESULT; }
-
-{dot}ambient { return AMBIENT; }
-{dot}attenuation { return ATTENUATION; }
-{dot}back { return BACK; }
-{dot}clip { return_token_or_DOT(require_ARB_vp, CLIP); }
-{dot}color { return COLOR; }
-{dot}depth { return_token_or_DOT(require_ARB_fp, DEPTH); }
-{dot}diffuse { return DIFFUSE; }
-{dot}direction { return DIRECTION; }
-{dot}emission { return EMISSION; }
-{dot}env { return ENV; }
-{dot}eye { return EYE; }
-{dot}fogcoord { return FOGCOORD; }
-{dot}fog { return FOG; }
-{dot}front { return FRONT; }
-{dot}half { return HALF; }
-{dot}inverse { return INVERSE; }
-{dot}invtrans { return INVTRANS; }
-{dot}light { return LIGHT; }
-{dot}lightmodel { return LIGHTMODEL; }
-{dot}lightprod { return LIGHTPROD; }
-{dot}local { return LOCAL; }
-{dot}material { return MATERIAL; }
-{dot}program { return MAT_PROGRAM; }
-{dot}matrix { return MATRIX; }
-{dot}matrixindex { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); }
-{dot}modelview { return MODELVIEW; }
-{dot}mvp { return MVP; }
-{dot}normal { return_token_or_DOT(require_ARB_vp, NORMAL); }
-{dot}object { return OBJECT; }
-{dot}palette { return PALETTE; }
-{dot}params { return PARAMS; }
-{dot}plane { return PLANE; }
-{dot}point { return_token_or_DOT(require_ARB_vp, POINT_TOK); }
-{dot}pointsize { return_token_or_DOT(require_ARB_vp, POINTSIZE); }
-{dot}position { return POSITION; }
-{dot}primary { return PRIMARY; }
-{dot}projection { return PROJECTION; }
-{dot}range { return_token_or_DOT(require_ARB_fp, RANGE); }
-{dot}row { return ROW; }
-{dot}scenecolor { return SCENECOLOR; }
-{dot}secondary { return SECONDARY; }
-{dot}shininess { return SHININESS; }
-{dot}size { return_token_or_DOT(require_ARB_vp, SIZE_TOK); }
-{dot}specular { return SPECULAR; }
-{dot}spot { return SPOT; }
-{dot}texcoord { return TEXCOORD; }
-{dot}texenv { return_token_or_DOT(require_ARB_fp, TEXENV); }
-{dot}texgen { return_token_or_DOT(require_ARB_vp, TEXGEN); }
-{dot}q { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); }
-{dot}s { return_token_or_DOT(require_ARB_vp, TEXGEN_S); }
-{dot}t { return_token_or_DOT(require_ARB_vp, TEXGEN_T); }
-{dot}texture { return TEXTURE; }
-{dot}transpose { return TRANSPOSE; }
-{dot}attrib { return_token_or_DOT(require_ARB_vp, VTXATTRIB); }
-{dot}weight { return_token_or_DOT(require_ARB_vp, WEIGHT); }
-
-texture { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); }
-1D { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); }
-2D { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); }
-3D { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); }
-CUBE { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); }
-RECT { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); }
-SHADOW1D { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); }
-SHADOW2D { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); }
-SHADOWRECT { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); }
-ARRAY1D { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); }
-ARRAY2D { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); }
-ARRAYSHADOW1D { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); }
-ARRAYSHADOW2D { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); }
-
-[_a-zA-Z$][_a-zA-Z0-9$]* { return handle_ident(yyextra, yytext, yylval); }
-
-".." { return DOT_DOT; }
-
-{num} {
- yylval->integer = strtol(yytext, NULL, 10);
- return INTEGER;
-}
-{num}?{frac}{exp}? {
- yylval->real = _mesa_strtof(yytext, NULL);
- return REAL;
-}
-{num}"."/[^.] {
- yylval->real = _mesa_strtof(yytext, NULL);
- return REAL;
-}
-{num}{exp} {
- yylval->real = _mesa_strtof(yytext, NULL);
- return REAL;
-}
-{num}"."{exp} {
- yylval->real = _mesa_strtof(yytext, NULL);
- return REAL;
-}
-
-".xyzw" {
- yylval->swiz_mask.swizzle = SWIZZLE_NOOP;
- yylval->swiz_mask.mask = WRITEMASK_XYZW;
- return MASK4;
-}
-
-".xy"[zw] {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_XY
- | mask_from_char(yytext[3]);
- return MASK3;
-}
-".xzw" {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_XZW;
- return MASK3;
-}
-".yzw" {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_YZW;
- return MASK3;
-}
-
-".x"[yzw] {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_X
- | mask_from_char(yytext[2]);
- return MASK2;
-}
-".y"[zw] {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_Y
- | mask_from_char(yytext[2]);
- return MASK2;
-}
-".zw" {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_ZW;
- return MASK2;
-}
-
-"."[xyzw] {
- const unsigned s = swiz_from_char(yytext[1]);
- yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s);
- yylval->swiz_mask.mask = mask_from_char(yytext[1]);
- return MASK1;
-}
-
-"."[xyzw]{4} {
- yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]),
- swiz_from_char(yytext[2]),
- swiz_from_char(yytext[3]),
- swiz_from_char(yytext[4]));
- yylval->swiz_mask.mask = 0;
- return SWIZZLE;
-}
-
-".rgba" {
- yylval->swiz_mask.swizzle = SWIZZLE_NOOP;
- yylval->swiz_mask.mask = WRITEMASK_XYZW;
- return_token_or_DOT(require_ARB_fp, MASK4);
-}
-
-".rg"[ba] {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_XY
- | mask_from_char(yytext[3]);
- return_token_or_DOT(require_ARB_fp, MASK3);
-}
-".rba" {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_XZW;
- return_token_or_DOT(require_ARB_fp, MASK3);
-}
-".gba" {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_YZW;
- return_token_or_DOT(require_ARB_fp, MASK3);
-}
-
-".r"[gba] {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_X
- | mask_from_char(yytext[2]);
- return_token_or_DOT(require_ARB_fp, MASK2);
-}
-".g"[ba] {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_Y
- | mask_from_char(yytext[2]);
- return_token_or_DOT(require_ARB_fp, MASK2);
-}
-".ba" {
- yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
- yylval->swiz_mask.mask = WRITEMASK_ZW;
- return_token_or_DOT(require_ARB_fp, MASK2);
-}
-
-"."[gba] {
- const unsigned s = swiz_from_char(yytext[1]);
- yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s);
- yylval->swiz_mask.mask = mask_from_char(yytext[1]);
- return_token_or_DOT(require_ARB_fp, MASK1);
-}
-
-
-".r" {
- if (require_ARB_vp) {
- return TEXGEN_R;
- } else {
- yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X,
- SWIZZLE_X, SWIZZLE_X);
- yylval->swiz_mask.mask = WRITEMASK_X;
- return MASK1;
- }
-}
-
-"."[rgba]{4} {
- yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]),
- swiz_from_char(yytext[2]),
- swiz_from_char(yytext[3]),
- swiz_from_char(yytext[4]));
- yylval->swiz_mask.mask = 0;
- return_token_or_DOT(require_ARB_fp, SWIZZLE);
-}
-
-"." { return DOT; }
-
-\n {
- yylloc->first_line++;
- yylloc->first_column = 1;
- yylloc->last_line++;
- yylloc->last_column = 1;
- yylloc->position++;
-}
-[ \t\r]+ /* eat whitespace */ ;
-#.*$ /* eat comments */ ;
-. { return yytext[0]; }
-%%
-
-void
-_mesa_program_lexer_ctor(void **scanner, struct asm_parser_state *state,
- const char *string, size_t len)
-{
- yylex_init_extra(state, scanner);
- yy_scan_bytes(string, len, *scanner);
-}
-
-void
-_mesa_program_lexer_dtor(void *scanner)
-{
- yylex_destroy(scanner);
-}
diff --git a/src/mesa/program/program_parse.tab.c b/src/mesa/program/program_parse.tab.c
deleted file mode 100644
index baef311..0000000
--- a/src/mesa/program/program_parse.tab.c
+++ /dev/null
@@ -1,5730 +0,0 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1. */
-
-/* Skeleton implementation for Bison's Yacc-like parsers in C
-
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- 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.1"
-
-/* 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 "program_parse.y"
-
-/*
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "main/mtypes.h"
-#include "main/imports.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 "program/symbol_table.h"
-#include "program/program_parser.h"
-
-extern void *yy_scan_string(char *);
-extern void yy_delete_buffer(void *);
-
-static struct asm_symbol *declare_variable(struct asm_parser_state *state,
- char *name, enum asm_type t, struct YYLTYPE *locp);
-
-static int add_state_reference(struct gl_program_parameter_list *param_list,
- const gl_state_index tokens[STATE_LENGTH]);
-
-static int initialize_symbol_from_state(struct gl_program *prog,
- struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
-
-static int initialize_symbol_from_param(struct gl_program *prog,
- struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
-
-static int initialize_symbol_from_const(struct gl_program *prog,
- struct asm_symbol *param_var, const struct asm_vector *vec,
- GLboolean allowSwizzle);
-
-static int yyparse(struct asm_parser_state *state);
-
-static char *make_error_string(const char *fmt, ...);
-
-static void yyerror(struct YYLTYPE *locp, struct asm_parser_state *state,
- const char *s);
-
-static int validate_inputs(struct YYLTYPE *locp,
- struct asm_parser_state *state);
-
-static void init_dst_reg(struct prog_dst_register *r);
-
-static void set_dst_reg(struct prog_dst_register *r,
- gl_register_file file, GLint index);
-
-static void init_src_reg(struct asm_src_register *r);
-
-static void set_src_reg(struct asm_src_register *r,
- gl_register_file file, GLint index);
-
-static void set_src_reg_swz(struct asm_src_register *r,
- gl_register_file file, GLint index, GLuint swizzle);
-
-static void asm_instruction_set_operands(struct asm_instruction *inst,
- const struct prog_dst_register *dst, const struct asm_src_register *src0,
- const struct asm_src_register *src1, const struct asm_src_register *src2);
-
-static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
- const struct prog_dst_register *dst, const struct asm_src_register *src0,
- const struct asm_src_register *src1, const struct asm_src_register *src2);
-
-static struct asm_instruction *asm_instruction_copy_ctor(
- const struct prog_instruction *base, const struct prog_dst_register *dst,
- const struct asm_src_register *src0, const struct asm_src_register *src1,
- const struct asm_src_register *src2);
-
-#ifndef FALSE
-#define FALSE 0
-#define TRUE (!FALSE)
-#endif
-
-#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).position = YYRHSLOC(Rhs, 1).position; \
- (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC(Rhs, N).last_column; \
- } else { \
- (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
- (Current).last_line = (Current).first_line; \
- (Current).first_column = YYRHSLOC(Rhs, 0).last_column; \
- (Current).last_column = (Current).first_column; \
- (Current).position = YYRHSLOC(Rhs, 0).position \
- + (Current).first_column; \
- } \
- } while(YYID(0))
-
-#define YYLEX_PARAM state->scanner
-
-
-/* Line 189 of yacc.c */
-#line 193 "program_parse.tab.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 {
- ARBvp_10 = 258,
- ARBfp_10 = 259,
- ADDRESS = 260,
- ALIAS = 261,
- ATTRIB = 262,
- OPTION = 263,
- OUTPUT = 264,
- PARAM = 265,
- TEMP = 266,
- END = 267,
- BIN_OP = 268,
- BINSC_OP = 269,
- SAMPLE_OP = 270,
- SCALAR_OP = 271,
- TRI_OP = 272,
- VECTOR_OP = 273,
- ARL = 274,
- KIL = 275,
- SWZ = 276,
- TXD_OP = 277,
- INTEGER = 278,
- REAL = 279,
- AMBIENT = 280,
- ATTENUATION = 281,
- BACK = 282,
- CLIP = 283,
- COLOR = 284,
- DEPTH = 285,
- DIFFUSE = 286,
- DIRECTION = 287,
- EMISSION = 288,
- ENV = 289,
- EYE = 290,
- FOG = 291,
- FOGCOORD = 292,
- FRAGMENT = 293,
- FRONT = 294,
- HALF = 295,
- INVERSE = 296,
- INVTRANS = 297,
- LIGHT = 298,
- LIGHTMODEL = 299,
- LIGHTPROD = 300,
- LOCAL = 301,
- MATERIAL = 302,
- MAT_PROGRAM = 303,
- MATRIX = 304,
- MATRIXINDEX = 305,
- MODELVIEW = 306,
- MVP = 307,
- NORMAL = 308,
- OBJECT = 309,
- PALETTE = 310,
- PARAMS = 311,
- PLANE = 312,
- POINT_TOK = 313,
- POINTSIZE = 314,
- POSITION = 315,
- PRIMARY = 316,
- PROGRAM = 317,
- PROJECTION = 318,
- RANGE = 319,
- RESULT = 320,
- ROW = 321,
- SCENECOLOR = 322,
- SECONDARY = 323,
- SHININESS = 324,
- SIZE_TOK = 325,
- SPECULAR = 326,
- SPOT = 327,
- STATE = 328,
- TEXCOORD = 329,
- TEXENV = 330,
- TEXGEN = 331,
- TEXGEN_Q = 332,
- TEXGEN_R = 333,
- TEXGEN_S = 334,
- TEXGEN_T = 335,
- TEXTURE = 336,
- TRANSPOSE = 337,
- TEXTURE_UNIT = 338,
- TEX_1D = 339,
- TEX_2D = 340,
- TEX_3D = 341,
- TEX_CUBE = 342,
- TEX_RECT = 343,
- TEX_SHADOW1D = 344,
- TEX_SHADOW2D = 345,
- TEX_SHADOWRECT = 346,
- TEX_ARRAY1D = 347,
- TEX_ARRAY2D = 348,
- TEX_ARRAYSHADOW1D = 349,
- TEX_ARRAYSHADOW2D = 350,
- VERTEX = 351,
- VTXATTRIB = 352,
- WEIGHT = 353,
- IDENTIFIER = 354,
- USED_IDENTIFIER = 355,
- MASK4 = 356,
- MASK3 = 357,
- MASK2 = 358,
- MASK1 = 359,
- SWIZZLE = 360,
- DOT_DOT = 361,
- DOT = 362
- };
-#endif
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
-
-/* Line 214 of yacc.c */
-#line 126 "program_parse.y"
-
- struct asm_instruction *inst;
- struct asm_symbol *sym;
- struct asm_symbol temp_sym;
- struct asm_swizzle_mask swiz_mask;
- struct asm_src_register src_reg;
- struct prog_dst_register dst_reg;
- struct prog_instruction temp_inst;
- char *string;
- unsigned result;
- unsigned attrib;
- int integer;
- float real;
- gl_state_index state[STATE_LENGTH];
- int negate;
- struct asm_vector vector;
- gl_inst_opcode opcode;
-
- struct {
- unsigned swz;
- unsigned rgba_valid:1;
- unsigned xyzw_valid:1;
- unsigned negate:1;
- } ext_swizzle;
-
-
-
-/* Line 214 of yacc.c */
-#line 364 "program_parse.tab.c"
-} 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 271 "program_parse.y"
-
-extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
- void *yyscanner);
-
-
-/* Line 264 of yacc.c */
-#line 395 "program_parse.tab.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 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 396
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 120
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 143
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 282
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 475
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 362
-
-#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, 2, 2, 2, 2, 2, 2, 2,
- 115, 116, 2, 113, 109, 114, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 108,
- 2, 117, 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, 111, 2, 112, 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, 118, 110, 119, 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, 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
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint16 yyprhs[] =
-{
- 0, 0, 3, 8, 10, 12, 15, 16, 20, 23,
- 24, 27, 30, 32, 34, 36, 38, 40, 42, 44,
- 46, 48, 50, 52, 54, 59, 64, 69, 76, 83,
- 92, 101, 104, 107, 120, 123, 125, 127, 129, 131,
- 133, 135, 137, 139, 141, 143, 145, 147, 154, 157,
- 162, 165, 167, 171, 177, 181, 184, 192, 195, 197,
- 199, 201, 203, 208, 210, 212, 214, 216, 218, 220,
- 222, 226, 227, 230, 233, 235, 237, 239, 241, 243,
- 245, 247, 249, 251, 252, 254, 256, 258, 260, 261,
- 265, 269, 270, 273, 276, 278, 280, 282, 284, 286,
- 288, 290, 292, 297, 300, 303, 305, 308, 310, 313,
- 315, 318, 323, 328, 330, 331, 335, 337, 339, 342,
- 344, 347, 349, 351, 355, 362, 363, 365, 368, 373,
- 375, 379, 381, 383, 385, 387, 389, 391, 393, 395,
- 397, 399, 402, 405, 408, 411, 414, 417, 420, 423,
- 426, 429, 432, 435, 439, 441, 443, 445, 451, 453,
- 455, 457, 460, 462, 464, 467, 469, 472, 479, 481,
- 485, 487, 489, 491, 493, 495, 500, 502, 504, 506,
- 508, 510, 512, 515, 517, 519, 525, 527, 530, 532,
- 534, 540, 543, 544, 551, 555, 556, 558, 560, 562,
- 564, 566, 569, 571, 573, 576, 581, 586, 587, 591,
- 593, 595, 597, 600, 602, 604, 606, 608, 614, 616,
- 620, 626, 632, 634, 638, 644, 646, 648, 650, 652,
- 654, 656, 658, 660, 662, 666, 672, 680, 690, 693,
- 696, 698, 700, 701, 702, 707, 709, 710, 711, 715,
- 719, 721, 727, 730, 733, 736, 739, 743, 746, 750,
- 751, 753, 755, 756, 758, 760, 761, 763, 765, 766,
- 768, 770, 771, 775, 776, 780, 781, 785, 787, 789,
- 791, 796, 798
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int16 yyrhs[] =
-{
- 121, 0, -1, 122, 123, 125, 12, -1, 3, -1,
- 4, -1, 123, 124, -1, -1, 8, 262, 108, -1,
- 125, 126, -1, -1, 127, 108, -1, 170, 108, -1,
- 128, -1, 129, -1, 130, -1, 131, -1, 132, -1,
- 133, -1, 134, -1, 135, -1, 141, -1, 136, -1,
- 137, -1, 138, -1, 19, 146, 109, 142, -1, 18,
- 145, 109, 144, -1, 16, 145, 109, 142, -1, 14,
- 145, 109, 142, 109, 142, -1, 13, 145, 109, 144,
- 109, 144, -1, 17, 145, 109, 144, 109, 144, 109,
- 144, -1, 15, 145, 109, 144, 109, 139, 109, 140,
- -1, 20, 144, -1, 20, 166, -1, 22, 145, 109,
- 144, 109, 144, 109, 144, 109, 139, 109, 140, -1,
- 83, 256, -1, 84, -1, 85, -1, 86, -1, 87,
- -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
- -1, 93, -1, 94, -1, 95, -1, 21, 145, 109,
- 150, 109, 147, -1, 241, 143, -1, 241, 110, 143,
- 110, -1, 150, 162, -1, 238, -1, 241, 150, 163,
- -1, 241, 110, 150, 163, 110, -1, 151, 164, 165,
- -1, 159, 161, -1, 148, 109, 148, 109, 148, 109,
- 148, -1, 241, 149, -1, 23, -1, 262, -1, 100,
- -1, 172, -1, 152, 111, 153, 112, -1, 186, -1,
- 249, -1, 100, -1, 100, -1, 154, -1, 155, -1,
- 23, -1, 159, 160, 156, -1, -1, 113, 157, -1,
- 114, 158, -1, 23, -1, 23, -1, 100, -1, 104,
- -1, 104, -1, 104, -1, 104, -1, 101, -1, 105,
- -1, -1, 101, -1, 102, -1, 103, -1, 104, -1,
- -1, 115, 166, 116, -1, 115, 167, 116, -1, -1,
- 168, 163, -1, 169, 163, -1, 99, -1, 100, -1,
- 171, -1, 178, -1, 242, -1, 245, -1, 248, -1,
- 261, -1, 7, 99, 117, 172, -1, 96, 173, -1,
- 38, 177, -1, 60, -1, 98, 175, -1, 53, -1,
- 29, 254, -1, 37, -1, 74, 255, -1, 50, 111,
- 176, 112, -1, 97, 111, 174, 112, -1, 23, -1,
- -1, 111, 176, 112, -1, 23, -1, 60, -1, 29,
- 254, -1, 37, -1, 74, 255, -1, 179, -1, 180,
- -1, 10, 99, 182, -1, 10, 99, 111, 181, 112,
- 183, -1, -1, 23, -1, 117, 185, -1, 117, 118,
- 184, 119, -1, 187, -1, 184, 109, 187, -1, 189,
- -1, 225, -1, 235, -1, 189, -1, 225, -1, 236,
- -1, 188, -1, 226, -1, 235, -1, 189, -1, 73,
- 213, -1, 73, 190, -1, 73, 192, -1, 73, 195,
- -1, 73, 197, -1, 73, 203, -1, 73, 199, -1,
- 73, 206, -1, 73, 208, -1, 73, 210, -1, 73,
- 212, -1, 73, 224, -1, 47, 253, 191, -1, 201,
- -1, 33, -1, 69, -1, 43, 111, 202, 112, 193,
- -1, 201, -1, 60, -1, 26, -1, 72, 194, -1,
- 40, -1, 32, -1, 44, 196, -1, 25, -1, 253,
- 67, -1, 45, 111, 202, 112, 253, 198, -1, 201,
- -1, 75, 257, 200, -1, 29, -1, 25, -1, 31,
- -1, 71, -1, 23, -1, 76, 255, 204, 205, -1,
- 35, -1, 54, -1, 79, -1, 80, -1, 78, -1,
- 77, -1, 36, 207, -1, 29, -1, 56, -1, 28,
- 111, 209, 112, 57, -1, 23, -1, 58, 211, -1,
- 70, -1, 26, -1, 215, 66, 111, 218, 112, -1,
- 215, 214, -1, -1, 66, 111, 218, 106, 218, 112,
- -1, 49, 219, 216, -1, -1, 217, -1, 41, -1,
- 82, -1, 42, -1, 23, -1, 51, 220, -1, 63,
- -1, 52, -1, 81, 255, -1, 55, 111, 222, 112,
- -1, 48, 111, 223, 112, -1, -1, 111, 221, 112,
- -1, 23, -1, 23, -1, 23, -1, 30, 64, -1,
- 229, -1, 232, -1, 227, -1, 230, -1, 62, 34,
- 111, 228, 112, -1, 233, -1, 233, 106, 233, -1,
- 62, 34, 111, 233, 112, -1, 62, 46, 111, 231,
- 112, -1, 234, -1, 234, 106, 234, -1, 62, 46,
- 111, 234, 112, -1, 23, -1, 23, -1, 237, -1,
- 239, -1, 238, -1, 239, -1, 240, -1, 24, -1,
- 23, -1, 118, 240, 119, -1, 118, 240, 109, 240,
- 119, -1, 118, 240, 109, 240, 109, 240, 119, -1,
- 118, 240, 109, 240, 109, 240, 109, 240, 119, -1,
- 241, 24, -1, 241, 23, -1, 113, -1, 114, -1,
- -1, -1, 244, 11, 243, 247, -1, 262, -1, -1,
- -1, 5, 246, 247, -1, 247, 109, 99, -1, 99,
- -1, 244, 9, 99, 117, 249, -1, 65, 60, -1,
- 65, 37, -1, 65, 250, -1, 65, 59, -1, 65,
- 74, 255, -1, 65, 30, -1, 29, 251, 252, -1,
- -1, 39, -1, 27, -1, -1, 61, -1, 68, -1,
- -1, 39, -1, 27, -1, -1, 61, -1, 68, -1,
- -1, 111, 258, 112, -1, -1, 111, 259, 112, -1,
- -1, 111, 260, 112, -1, 23, -1, 23, -1, 23,
- -1, 6, 99, 117, 100, -1, 99, -1, 100, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
-{
- 0, 278, 278, 281, 289, 301, 302, 305, 329, 330,
- 333, 348, 351, 356, 363, 364, 365, 366, 367, 368,
- 369, 372, 373, 374, 377, 383, 389, 395, 402, 408,
- 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, 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
-
-#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", "ARBvp_10", "ARBfp_10", "ADDRESS",
- "ALIAS", "ATTRIB", "OPTION", "OUTPUT", "PARAM", "TEMP", "END", "BIN_OP",
- "BINSC_OP", "SAMPLE_OP", "SCALAR_OP", "TRI_OP", "VECTOR_OP", "ARL",
- "KIL", "SWZ", "TXD_OP", "INTEGER", "REAL", "AMBIENT", "ATTENUATION",
- "BACK", "CLIP", "COLOR", "DEPTH", "DIFFUSE", "DIRECTION", "EMISSION",
- "ENV", "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE",
- "INVTRANS", "LIGHT", "LIGHTMODEL", "LIGHTPROD", "LOCAL", "MATERIAL",
- "MAT_PROGRAM", "MATRIX", "MATRIXINDEX", "MODELVIEW", "MVP", "NORMAL",
- "OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT_TOK", "POINTSIZE",
- "POSITION", "PRIMARY", "PROGRAM", "PROJECTION", "RANGE", "RESULT", "ROW",
- "SCENECOLOR", "SECONDARY", "SHININESS", "SIZE_TOK", "SPECULAR", "SPOT",
- "STATE", "TEXCOORD", "TEXENV", "TEXGEN", "TEXGEN_Q", "TEXGEN_R",
- "TEXGEN_S", "TEXGEN_T", "TEXTURE", "TRANSPOSE", "TEXTURE_UNIT", "TEX_1D",
- "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "TEX_SHADOW1D",
- "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D",
- "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB",
- "WEIGHT", "IDENTIFIER", "USED_IDENTIFIER", "MASK4", "MASK3", "MASK2",
- "MASK1", "SWIZZLE", "DOT_DOT", "DOT", "';'", "','", "'|'", "'['", "']'",
- "'+'", "'-'", "'('", "')'", "'='", "'{'", "'}'", "$accept", "program",
- "language", "optionSequence", "option", "statementSequence", "statement",
- "instruction", "ALU_instruction", "TexInstruction", "ARL_instruction",
- "VECTORop_instruction", "SCALARop_instruction", "BINSCop_instruction",
- "BINop_instruction", "TRIop_instruction", "SAMPLE_instruction",
- "KIL_instruction", "TXD_instruction", "texImageUnit", "texTarget",
- "SWZ_instruction", "scalarSrcReg", "scalarUse", "swizzleSrcReg",
- "maskedDstReg", "maskedAddrReg", "extendedSwizzle", "extSwizComp",
- "extSwizSel", "srcReg", "dstReg", "progParamArray", "progParamArrayMem",
- "progParamArrayAbs", "progParamArrayRel", "addrRegRelOffset",
- "addrRegPosOffset", "addrRegNegOffset", "addrReg", "addrComponent",
- "addrWriteMask", "scalarSuffix", "swizzleSuffix", "optionalMask",
- "optionalCcMask", "ccTest", "ccTest2", "ccMaskRule", "ccMaskRule2",
- "namingStatement", "ATTRIB_statement", "attribBinding", "vtxAttribItem",
- "vtxAttribNum", "vtxOptWeightNum", "vtxWeightNum", "fragAttribItem",
- "PARAM_statement", "PARAM_singleStmt", "PARAM_multipleStmt",
- "optArraySize", "paramSingleInit", "paramMultipleInit",
- "paramMultInitList", "paramSingleItemDecl", "paramSingleItemUse",
- "paramMultipleItem", "stateMultipleItem", "stateSingleItem",
- "stateMaterialItem", "stateMatProperty", "stateLightItem",
- "stateLightProperty", "stateSpotProperty", "stateLightModelItem",
- "stateLModProperty", "stateLightProdItem", "stateLProdProperty",
- "stateTexEnvItem", "stateTexEnvProperty", "ambDiffSpecProperty",
- "stateLightNumber", "stateTexGenItem", "stateTexGenType",
- "stateTexGenCoord", "stateFogItem", "stateFogProperty",
- "stateClipPlaneItem", "stateClipPlaneNum", "statePointItem",
- "statePointProperty", "stateMatrixRow", "stateMatrixRows",
- "optMatrixRows", "stateMatrixItem", "stateOptMatModifier",
- "stateMatModifier", "stateMatrixRowNum", "stateMatrixName",
- "stateOptModMatNum", "stateModMatNum", "statePaletteMatNum",
- "stateProgramMatNum", "stateDepthItem", "programSingleItem",
- "programMultipleItem", "progEnvParams", "progEnvParamNums",
- "progEnvParam", "progLocalParams", "progLocalParamNums",
- "progLocalParam", "progEnvParamNum", "progLocalParamNum",
- "paramConstDecl", "paramConstUse", "paramConstScalarDecl",
- "paramConstScalarUse", "paramConstVector", "signedFloatConstant",
- "optionalSign", "TEMP_statement", "@1", "optVarSize",
- "ADDRESS_statement", "@2", "varNameList", "OUTPUT_statement",
- "resultBinding", "resultColBinding", "optResultFaceType",
- "optResultColorType", "optFaceType", "optColorType",
- "optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum",
- "texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum",
- "ALIAS_statement", "string", 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, 59, 44,
- 124, 91, 93, 43, 45, 40, 41, 61, 123, 125
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint16 yyr1[] =
-{
- 0, 120, 121, 122, 122, 123, 123, 124, 125, 125,
- 126, 126, 127, 127, 128, 128, 128, 128, 128, 128,
- 128, 129, 129, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 137, 138, 139, 140, 140, 140, 140, 140,
- 140, 140, 140, 140, 140, 140, 140, 141, 142, 142,
- 143, 143, 144, 144, 145, 146, 147, 148, 149, 149,
- 150, 150, 150, 150, 151, 151, 152, 153, 153, 154,
- 155, 156, 156, 156, 157, 158, 159, 160, 161, 162,
- 163, 163, 163, 163, 164, 164, 164, 164, 164, 165,
- 165, 165, 166, 167, 168, 169, 170, 170, 170, 170,
- 170, 170, 171, 172, 172, 173, 173, 173, 173, 173,
- 173, 173, 173, 174, 175, 175, 176, 177, 177, 177,
- 177, 178, 178, 179, 180, 181, 181, 182, 183, 184,
- 184, 185, 185, 185, 186, 186, 186, 187, 187, 187,
- 188, 188, 189, 189, 189, 189, 189, 189, 189, 189,
- 189, 189, 189, 190, 191, 191, 191, 192, 193, 193,
- 193, 193, 193, 194, 195, 196, 196, 197, 198, 199,
- 200, 201, 201, 201, 202, 203, 204, 204, 205, 205,
- 205, 205, 206, 207, 207, 208, 209, 210, 211, 211,
- 212, 213, 214, 214, 215, 216, 216, 217, 217, 217,
- 218, 219, 219, 219, 219, 219, 219, 220, 220, 221,
- 222, 223, 224, 225, 225, 226, 226, 227, 228, 228,
- 229, 230, 231, 231, 232, 233, 234, 235, 235, 236,
- 236, 237, 238, 238, 239, 239, 239, 239, 240, 240,
- 241, 241, 241, 243, 242, 244, 244, 246, 245, 247,
- 247, 248, 249, 249, 249, 249, 249, 249, 250, 251,
- 251, 251, 252, 252, 252, 253, 253, 253, 254, 254,
- 254, 255, 255, 256, 256, 257, 257, 258, 259, 260,
- 261, 262, 262
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 4, 1, 1, 2, 0, 3, 2, 0,
- 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 4, 4, 4, 6, 6, 8,
- 8, 2, 2, 12, 2, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 6, 2, 4,
- 2, 1, 3, 5, 3, 2, 7, 2, 1, 1,
- 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
- 3, 0, 2, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 0, 1, 1, 1, 1, 0, 3,
- 3, 0, 2, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 4, 2, 2, 1, 2, 1, 2, 1,
- 2, 4, 4, 1, 0, 3, 1, 1, 2, 1,
- 2, 1, 1, 3, 6, 0, 1, 2, 4, 1,
- 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 3, 1, 1, 1, 5, 1, 1,
- 1, 2, 1, 1, 2, 1, 2, 6, 1, 3,
- 1, 1, 1, 1, 1, 4, 1, 1, 1, 1,
- 1, 1, 2, 1, 1, 5, 1, 2, 1, 1,
- 5, 2, 0, 6, 3, 0, 1, 1, 1, 1,
- 1, 2, 1, 1, 2, 4, 4, 0, 3, 1,
- 1, 1, 2, 1, 1, 1, 1, 5, 1, 3,
- 5, 5, 1, 3, 5, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 3, 5, 7, 9, 2, 2,
- 1, 1, 0, 0, 4, 1, 0, 0, 3, 3,
- 1, 5, 2, 2, 2, 2, 3, 2, 3, 0,
- 1, 1, 0, 1, 1, 0, 1, 1, 0, 1,
- 1, 0, 3, 0, 3, 0, 3, 1, 1, 1,
- 4, 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_uint16 yydefact[] =
-{
- 0, 3, 4, 0, 6, 1, 9, 0, 5, 246,
- 281, 282, 0, 247, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 242, 0, 0, 8, 0,
- 12, 13, 14, 15, 16, 17, 18, 19, 21, 22,
- 23, 20, 0, 96, 97, 121, 122, 98, 0, 99,
- 100, 101, 245, 7, 0, 0, 0, 0, 0, 65,
- 0, 88, 64, 0, 0, 0, 0, 0, 76, 0,
- 0, 94, 240, 241, 31, 32, 83, 0, 0, 0,
- 10, 11, 0, 243, 250, 248, 0, 0, 125, 242,
- 123, 259, 257, 253, 255, 252, 271, 254, 242, 84,
- 85, 86, 87, 91, 242, 242, 242, 242, 242, 242,
- 78, 55, 81, 80, 82, 92, 233, 232, 0, 0,
- 0, 0, 60, 0, 242, 83, 0, 61, 63, 134,
- 135, 213, 214, 136, 229, 230, 0, 242, 0, 0,
- 0, 280, 102, 126, 0, 127, 131, 132, 133, 227,
- 228, 231, 0, 261, 260, 262, 0, 256, 0, 0,
- 54, 0, 0, 0, 26, 0, 25, 24, 268, 119,
- 117, 271, 104, 0, 0, 0, 0, 0, 0, 265,
- 0, 265, 0, 0, 275, 271, 142, 143, 144, 145,
- 147, 146, 148, 149, 150, 151, 0, 152, 268, 109,
- 0, 107, 105, 271, 0, 114, 103, 83, 0, 52,
- 0, 0, 0, 0, 244, 249, 0, 239, 238, 263,
- 264, 258, 277, 0, 242, 95, 0, 0, 83, 242,
- 0, 48, 0, 51, 0, 242, 269, 270, 118, 120,
- 0, 0, 0, 212, 183, 184, 182, 0, 165, 267,
- 266, 164, 0, 0, 0, 0, 207, 203, 0, 202,
- 271, 195, 189, 188, 187, 0, 0, 0, 0, 108,
- 0, 110, 0, 0, 106, 0, 242, 234, 69, 0,
- 67, 68, 0, 242, 242, 251, 0, 124, 272, 28,
- 89, 90, 93, 27, 0, 79, 50, 273, 0, 0,
- 225, 0, 226, 0, 186, 0, 174, 0, 166, 0,
- 171, 172, 155, 156, 173, 153, 154, 0, 0, 201,
- 0, 204, 197, 199, 198, 194, 196, 279, 0, 170,
- 169, 176, 177, 0, 0, 116, 0, 113, 0, 0,
- 53, 0, 62, 77, 71, 47, 0, 0, 0, 242,
- 49, 0, 34, 0, 242, 220, 224, 0, 0, 265,
- 211, 0, 209, 0, 210, 0, 276, 181, 180, 178,
- 179, 175, 200, 0, 111, 112, 115, 242, 235, 0,
- 0, 70, 242, 58, 57, 59, 242, 0, 0, 0,
- 129, 137, 140, 138, 215, 216, 139, 278, 0, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 30, 29, 185, 160, 162, 159, 0, 157, 158,
- 0, 206, 208, 205, 190, 0, 74, 72, 75, 73,
- 0, 0, 0, 0, 141, 192, 242, 128, 274, 163,
- 161, 167, 168, 242, 236, 242, 0, 0, 0, 0,
- 191, 130, 0, 0, 0, 0, 218, 0, 222, 0,
- 237, 242, 0, 217, 0, 221, 0, 0, 56, 33,
- 219, 223, 0, 0, 193
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int16 yydefgoto[] =
-{
- -1, 3, 4, 6, 8, 9, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 298,
- 411, 41, 161, 231, 74, 60, 69, 345, 346, 384,
- 232, 61, 126, 279, 280, 281, 381, 427, 429, 70,
- 344, 111, 296, 115, 103, 160, 75, 227, 76, 228,
- 42, 43, 127, 206, 338, 274, 336, 172, 44, 45,
- 46, 144, 90, 287, 389, 145, 128, 390, 391, 129,
- 186, 315, 187, 418, 440, 188, 251, 189, 441, 190,
- 330, 316, 307, 191, 333, 371, 192, 246, 193, 305,
- 194, 264, 195, 434, 450, 196, 325, 326, 373, 261,
- 319, 363, 365, 361, 197, 130, 393, 394, 455, 131,
- 395, 457, 132, 301, 303, 396, 133, 149, 134, 135,
- 151, 77, 47, 139, 48, 49, 54, 85, 50, 62,
- 97, 155, 221, 252, 238, 157, 352, 266, 223, 398,
- 328, 51, 12
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -401
-static const yytype_int16 yypact[] =
-{
- 193, -401, -401, 27, -401, -401, 62, 143, -401, 24,
- -401, -401, -30, -401, -18, 12, 83, -401, 15, 15,
- 15, 15, 15, 15, 67, 61, 15, 15, -401, 127,
- -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,
- -401, -401, 144, -401, -401, -401, -401, -401, 204, -401,
- -401, -401, -401, -401, 155, 136, 138, 34, 140, -401,
- 147, 108, -401, 150, 156, 157, 158, 160, -401, 162,
- 159, -401, -401, -401, -401, -401, 102, -13, 163, 164,
- -401, -401, 165, -401, -401, 166, 170, 10, 235, 0,
- -401, 141, -401, -401, -401, -401, 167, -401, 131, -401,
- -401, -401, -401, 168, 131, 131, 131, 131, 131, 131,
- -401, -401, -401, -401, -401, -401, -401, -401, 104, 97,
- 114, 38, 169, 30, 131, 102, 171, -401, -401, -401,
- -401, -401, -401, -401, -401, -401, 30, 131, 172, 155,
- 175, -401, -401, -401, 173, -401, -401, -401, -401, -401,
- -401, -401, 223, -401, -401, 123, 253, -401, 177, 149,
- -401, 178, -10, 181, -401, 182, -401, -401, 134, -401,
- -401, 167, -401, 183, 184, 185, 213, 99, 186, 154,
- 187, 146, 153, 7, 188, 167, -401, -401, -401, -401,
- -401, -401, -401, -401, -401, -401, 215, -401, 134, -401,
- 190, -401, -401, 167, 191, 192, -401, 102, -48, -401,
- 1, 195, 196, 214, 166, -401, 189, -401, -401, -401,
- -401, -401, -401, 180, 131, -401, 194, 197, 102, 131,
- 30, -401, 203, 205, 201, 131, -401, -401, -401, -401,
- 285, 288, 289, -401, -401, -401, -401, 291, -401, -401,
- -401, -401, 248, 291, 33, 206, 207, -401, 208, -401,
- 167, 14, -401, -401, -401, 293, 292, 92, 209, -401,
- 299, -401, 301, 299, -401, 216, 131, -401, -401, 217,
- -401, -401, 221, 131, 131, -401, 212, -401, -401, -401,
- -401, -401, -401, -401, 218, -401, -401, 220, 224, 225,
- -401, 226, -401, 227, -401, 228, -401, 230, -401, 231,
- -401, -401, -401, -401, -401, -401, -401, 304, 309, -401,
- 312, -401, -401, -401, -401, -401, -401, -401, 232, -401,
- -401, -401, -401, 161, 313, -401, 233, -401, 234, 238,
- -401, 13, -401, -401, 137, -401, 242, -15, 243, 3,
- -401, 314, -401, 133, 131, -401, -401, 296, 94, 146,
- -401, 245, -401, 246, -401, 247, -401, -401, -401, -401,
- -401, -401, -401, 249, -401, -401, -401, 131, -401, 332,
- 337, -401, 131, -401, -401, -401, 131, 142, 114, 28,
- -401, -401, -401, -401, -401, -401, -401, -401, 250, -401,
- -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,
- -401, -401, -401, -401, -401, -401, -401, 331, -401, -401,
- 68, -401, -401, -401, -401, 43, -401, -401, -401, -401,
- 255, 256, 257, 258, -401, 300, 3, -401, -401, -401,
- -401, -401, -401, 131, -401, 131, 201, 285, 288, 259,
- -401, -401, 252, 264, 265, 263, 261, 266, 270, 313,
- -401, 131, 133, -401, 285, -401, 288, 80, -401, -401,
- -401, -401, 313, 267, -401
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
-{
- -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,
- -401, -401, -401, -401, -401, -401, -401, -401, -401, -69,
- -82, -401, -100, 151, -86, 210, -401, -401, -366, -401,
- -54, -401, -401, -401, -401, -401, -401, -401, -401, 174,
- -401, -401, -401, -118, -401, -401, 229, -401, -401, -401,
- -401, -401, 295, -401, -401, -401, 110, -401, -401, -401,
- -401, -401, -401, -401, -401, -401, -401, -51, -401, -88,
- -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,
- -401, -311, 139, -401, -401, -401, -401, -401, -401, -401,
- -401, -401, -401, -401, -401, -2, -401, -401, -400, -401,
- -401, -401, -401, -401, -401, 298, -401, -401, -401, -401,
- -401, -401, -401, -390, -295, 302, -401, -401, -136, -87,
- -120, -89, -401, -401, -401, -401, -401, 251, -401, 176,
- -401, -401, -401, -176, 198, -153, -401, -401, -401, -401,
- -401, -401, -6
-};
-
-/* 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 -230
-static const yytype_int16 yytable[] =
-{
- 152, 146, 150, 52, 208, 254, 164, 209, 383, 167,
- 116, 117, 158, 116, 117, 162, 430, 162, 239, 163,
- 162, 165, 166, 125, 278, 118, 233, 5, 118, 13,
- 14, 15, 267, 262, 16, 152, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 419, 118, 119,
- 271, 212, 119, 116, 117, 322, 323, 456, 310, 467,
- 120, 276, 119, 120, 311, 387, 312, 198, 118, 207,
- 7, 277, 473, 120, 470, 199, 388, 263, 53, 453,
- 58, 55, 211, 121, 10, 11, 121, 122, 200, 275,
- 122, 201, 119, 310, 233, 468, 324, 123, 202, 311,
- 230, 68, 313, 120, 314, 124, 121, 321, 124, 442,
- 292, 56, 203, 72, 73, 59, 72, 73, 124, 310,
- 414, 124, 377, 10, 11, 311, 121, 331, 244, 293,
- 122, 173, 378, 168, 415, 204, 205, 436, 289, 314,
- 162, 169, 175, 174, 176, 88, 332, 437, 124, 299,
- 177, 89, 443, 458, 416, 245, 341, 178, 179, 180,
- 71, 181, 444, 182, 170, 314, 417, 68, 153, 91,
- 92, 471, 183, 249, 72, 73, 432, 93, 171, 248,
- 154, 249, 57, 420, 219, 250, 472, 152, 433, 184,
- 185, 220, 424, 250, 347, 236, 1, 2, 348, 94,
- 95, 255, 237, 112, 256, 257, 113, 114, 258, 99,
- 100, 101, 102, 82, 96, 83, 259, 399, 400, 401,
- 402, 403, 404, 405, 406, 407, 408, 409, 410, 63,
- 64, 65, 66, 67, 260, 80, 78, 79, 367, 368,
- 369, 370, 10, 11, 72, 73, 217, 218, 71, 225,
- 379, 380, 81, 86, 84, 87, 98, 425, 143, 104,
- 152, 392, 150, 110, 138, 105, 106, 107, 412, 108,
- 141, 109, 136, 137, 215, 140, 222, 243, 156, 58,
- -66, 268, 210, 159, 297, 216, 224, 229, 152, 213,
- 234, 235, 288, 347, 240, 241, 242, 247, 253, 265,
- 431, 270, 272, 273, 283, 284, 286, 295, 300, -229,
- 290, 302, 304, 291, 306, 308, 327, 317, 318, 320,
- 334, 329, 335, 452, 337, 343, 340, 360, 350, 342,
- 349, 351, 362, 353, 354, 364, 372, 397, 355, 356,
- 357, 385, 358, 359, 366, 374, 375, 152, 392, 150,
- 376, 382, 386, 413, 152, 426, 347, 421, 422, 423,
- 428, 424, 438, 439, 445, 446, 449, 464, 447, 448,
- 459, 460, 347, 461, 462, 463, 466, 454, 465, 474,
- 469, 294, 142, 339, 282, 451, 435, 147, 226, 285,
- 214, 148, 309, 0, 0, 0, 269
-};
-
-static const yytype_int16 yycheck[] =
-{
- 89, 89, 89, 9, 124, 181, 106, 125, 23, 109,
- 23, 24, 98, 23, 24, 104, 382, 106, 171, 105,
- 109, 107, 108, 77, 23, 38, 162, 0, 38, 5,
- 6, 7, 185, 26, 10, 124, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 358, 38, 62,
- 203, 137, 62, 23, 24, 41, 42, 447, 25, 459,
- 73, 109, 62, 73, 31, 62, 33, 29, 38, 123,
- 8, 119, 472, 73, 464, 37, 73, 70, 108, 445,
- 65, 99, 136, 96, 99, 100, 96, 100, 50, 207,
- 100, 53, 62, 25, 230, 461, 82, 110, 60, 31,
- 110, 100, 69, 73, 71, 118, 96, 260, 118, 420,
- 228, 99, 74, 113, 114, 100, 113, 114, 118, 25,
- 26, 118, 109, 99, 100, 31, 96, 35, 29, 229,
- 100, 34, 119, 29, 40, 97, 98, 109, 224, 71,
- 229, 37, 28, 46, 30, 111, 54, 119, 118, 235,
- 36, 117, 109, 448, 60, 56, 276, 43, 44, 45,
- 99, 47, 119, 49, 60, 71, 72, 100, 27, 29,
- 30, 466, 58, 27, 113, 114, 34, 37, 74, 25,
- 39, 27, 99, 359, 61, 39, 106, 276, 46, 75,
- 76, 68, 112, 39, 283, 61, 3, 4, 284, 59,
- 60, 48, 68, 101, 51, 52, 104, 105, 55, 101,
- 102, 103, 104, 9, 74, 11, 63, 84, 85, 86,
- 87, 88, 89, 90, 91, 92, 93, 94, 95, 19,
- 20, 21, 22, 23, 81, 108, 26, 27, 77, 78,
- 79, 80, 99, 100, 113, 114, 23, 24, 99, 100,
- 113, 114, 108, 117, 99, 117, 109, 377, 23, 109,
- 349, 349, 349, 104, 99, 109, 109, 109, 354, 109,
- 100, 109, 109, 109, 99, 109, 23, 64, 111, 65,
- 111, 66, 111, 115, 83, 112, 109, 109, 377, 117,
- 109, 109, 112, 382, 111, 111, 111, 111, 111, 111,
- 386, 111, 111, 111, 109, 109, 117, 104, 23, 104,
- 116, 23, 23, 116, 23, 67, 23, 111, 111, 111,
- 111, 29, 23, 443, 23, 104, 110, 23, 110, 112,
- 118, 111, 23, 109, 109, 23, 23, 23, 112, 112,
- 112, 347, 112, 112, 112, 112, 112, 436, 436, 436,
- 112, 109, 109, 57, 443, 23, 445, 112, 112, 112,
- 23, 112, 112, 32, 109, 109, 66, 106, 111, 111,
- 111, 119, 461, 109, 109, 112, 106, 446, 112, 112,
- 462, 230, 87, 273, 210, 436, 388, 89, 159, 213,
- 139, 89, 253, -1, -1, -1, 198
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint16 yystos[] =
-{
- 0, 3, 4, 121, 122, 0, 123, 8, 124, 125,
- 99, 100, 262, 5, 6, 7, 10, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 126, 127,
- 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
- 138, 141, 170, 171, 178, 179, 180, 242, 244, 245,
- 248, 261, 262, 108, 246, 99, 99, 99, 65, 100,
- 145, 151, 249, 145, 145, 145, 145, 145, 100, 146,
- 159, 99, 113, 114, 144, 166, 168, 241, 145, 145,
- 108, 108, 9, 11, 99, 247, 117, 117, 111, 117,
- 182, 29, 30, 37, 59, 60, 74, 250, 109, 101,
- 102, 103, 104, 164, 109, 109, 109, 109, 109, 109,
- 104, 161, 101, 104, 105, 163, 23, 24, 38, 62,
- 73, 96, 100, 110, 118, 150, 152, 172, 186, 189,
- 225, 229, 232, 236, 238, 239, 109, 109, 99, 243,
- 109, 100, 172, 23, 181, 185, 189, 225, 235, 237,
- 239, 240, 241, 27, 39, 251, 111, 255, 144, 115,
- 165, 142, 241, 144, 142, 144, 144, 142, 29, 37,
- 60, 74, 177, 34, 46, 28, 30, 36, 43, 44,
- 45, 47, 49, 58, 75, 76, 190, 192, 195, 197,
- 199, 203, 206, 208, 210, 212, 215, 224, 29, 37,
- 50, 53, 60, 74, 97, 98, 173, 150, 240, 163,
- 111, 150, 144, 117, 247, 99, 112, 23, 24, 61,
- 68, 252, 23, 258, 109, 100, 166, 167, 169, 109,
- 110, 143, 150, 238, 109, 109, 61, 68, 254, 255,
- 111, 111, 111, 64, 29, 56, 207, 111, 25, 27,
- 39, 196, 253, 111, 253, 48, 51, 52, 55, 63,
- 81, 219, 26, 70, 211, 111, 257, 255, 66, 254,
- 111, 255, 111, 111, 175, 163, 109, 119, 23, 153,
- 154, 155, 159, 109, 109, 249, 117, 183, 112, 144,
- 116, 116, 163, 142, 143, 104, 162, 83, 139, 144,
- 23, 233, 23, 234, 23, 209, 23, 202, 67, 202,
- 25, 31, 33, 69, 71, 191, 201, 111, 111, 220,
- 111, 255, 41, 42, 82, 216, 217, 23, 260, 29,
- 200, 35, 54, 204, 111, 23, 176, 23, 174, 176,
- 110, 240, 112, 104, 160, 147, 148, 241, 144, 118,
- 110, 111, 256, 109, 109, 112, 112, 112, 112, 112,
- 23, 223, 23, 221, 23, 222, 112, 77, 78, 79,
- 80, 205, 23, 218, 112, 112, 112, 109, 119, 113,
- 114, 156, 109, 23, 149, 262, 109, 62, 73, 184,
- 187, 188, 189, 226, 227, 230, 235, 23, 259, 84,
- 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- 95, 140, 144, 57, 26, 40, 60, 72, 193, 201,
- 253, 112, 112, 112, 112, 240, 23, 157, 23, 158,
- 148, 144, 34, 46, 213, 215, 109, 119, 112, 32,
- 194, 198, 201, 109, 119, 109, 109, 111, 111, 66,
- 214, 187, 240, 148, 139, 228, 233, 231, 234, 111,
- 119, 109, 109, 112, 106, 112, 106, 218, 148, 140,
- 233, 234, 106, 218, 112
-};
-
-#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. */
-
-#define YYFAIL goto yyerrlab
-
-#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 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 asm_parser_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 asm_parser_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 asm_parser_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 asm_parser_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 asm_parser_state *state)
-#else
-static void
-yy_reduce_print (yyvsp, yylsp, yyrule, state)
- YYSTYPE *yyvsp;
- YYLTYPE *yylsp;
- int yyrule;
- struct asm_parser_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 asm_parser_state *state)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, yylocationp, state)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
- YYLTYPE *yylocationp;
- struct asm_parser_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 asm_parser_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 asm_parser_state *state)
-#else
-int
-yyparse (state)
- struct asm_parser_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[2];
-
- 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 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
-
- 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 3:
-
-/* Line 1455 of yacc.c */
-#line 282 "program_parse.y"
- {
- if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid fragment program header");
-
- }
- state->mode = ARB_vertex;
- ;}
- break;
-
- case 4:
-
-/* Line 1455 of yacc.c */
-#line 290 "program_parse.y"
- {
- if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header");
- }
- state->mode = ARB_fragment;
-
- state->option.TexRect =
- (state->ctx->Extensions.NV_texture_rectangle != GL_FALSE);
- ;}
- break;
-
- case 7:
-
-/* Line 1455 of yacc.c */
-#line 306 "program_parse.y"
- {
- int valid = 0;
-
- if (state->mode == ARB_vertex) {
- valid = _mesa_ARBvp_parse_option(state, (yyvsp[(2) - (3)].string));
- } else if (state->mode == ARB_fragment) {
- valid = _mesa_ARBfp_parse_option(state, (yyvsp[(2) - (3)].string));
- }
-
-
- free((yyvsp[(2) - (3)].string));
-
- if (!valid) {
- const char *const err_str = (state->mode == ARB_vertex)
- ? "invalid ARB vertex program option"
- : "invalid ARB fragment program option";
-
- yyerror(& (yylsp[(2) - (3)]), state, err_str);
- YYERROR;
- }
- ;}
- break;
-
- case 10:
-
-/* Line 1455 of yacc.c */
-#line 334 "program_parse.y"
- {
- if ((yyvsp[(1) - (2)].inst) != NULL) {
- if (state->inst_tail == NULL) {
- state->inst_head = (yyvsp[(1) - (2)].inst);
- } else {
- state->inst_tail->next = (yyvsp[(1) - (2)].inst);
- }
-
- state->inst_tail = (yyvsp[(1) - (2)].inst);
- (yyvsp[(1) - (2)].inst)->next = NULL;
-
- state->prog->NumInstructions++;
- }
- ;}
- break;
-
- case 12:
-
-/* Line 1455 of yacc.c */
-#line 352 "program_parse.y"
- {
- (yyval.inst) = (yyvsp[(1) - (1)].inst);
- state->prog->NumAluInstructions++;
- ;}
- break;
-
- case 13:
-
-/* Line 1455 of yacc.c */
-#line 357 "program_parse.y"
- {
- (yyval.inst) = (yyvsp[(1) - (1)].inst);
- state->prog->NumTexInstructions++;
- ;}
- break;
-
- case 24:
-
-/* Line 1455 of yacc.c */
-#line 378 "program_parse.y"
- {
- (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
- ;}
- break;
-
- case 25:
-
-/* Line 1455 of yacc.c */
-#line 384 "program_parse.y"
- {
- (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
- ;}
- break;
-
- case 26:
-
-/* Line 1455 of yacc.c */
-#line 390 "program_parse.y"
- {
- (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
- ;}
- break;
-
- case 27:
-
-/* Line 1455 of yacc.c */
-#line 396 "program_parse.y"
- {
- (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL);
- ;}
- break;
-
- case 28:
-
-/* Line 1455 of yacc.c */
-#line 403 "program_parse.y"
- {
- (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL);
- ;}
- break;
-
- case 29:
-
-/* Line 1455 of yacc.c */
-#line 410 "program_parse.y"
- {
- (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg));
- ;}
- break;
-
- case 30:
-
-/* Line 1455 of yacc.c */
-#line 416 "program_parse.y"
- {
- (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL);
- if ((yyval.inst) != NULL) {
- const GLbitfield tex_mask = (1U << (yyvsp[(6) - (8)].integer));
- GLbitfield shadow_tex = 0;
- GLbitfield target_mask = 0;
-
-
- (yyval.inst)->Base.TexSrcUnit = (yyvsp[(6) - (8)].integer);
-
- if ((yyvsp[(8) - (8)].integer) < 0) {
- shadow_tex = tex_mask;
-
- (yyval.inst)->Base.TexSrcTarget = -(yyvsp[(8) - (8)].integer);
- (yyval.inst)->Base.TexShadow = 1;
- } else {
- (yyval.inst)->Base.TexSrcTarget = (yyvsp[(8) - (8)].integer);
- }
-
- target_mask = (1U << (yyval.inst)->Base.TexSrcTarget);
-
- /* If this texture unit was previously accessed and that access
- * had a different texture target, generate an error.
- *
- * If this texture unit was previously accessed and that access
- * had a different shadow mode, generate an error.
- */
- if ((state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] != 0)
- && ((state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] != target_mask)
- || ((state->prog->ShadowSamplers & tex_mask)
- != shadow_tex))) {
- yyerror(& (yylsp[(8) - (8)]), state,
- "multiple targets used on one texture image unit");
- YYERROR;
- }
-
-
- state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] |= target_mask;
- state->prog->ShadowSamplers |= shadow_tex;
- }
- ;}
- break;
-
- case 31:
-
-/* Line 1455 of yacc.c */
-#line 460 "program_parse.y"
- {
- (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL);
- state->fragment.UsesKill = 1;
- ;}
- break;
-
- case 32:
-
-/* Line 1455 of yacc.c */
-#line 465 "program_parse.y"
- {
- (yyval.inst) = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL);
- (yyval.inst)->Base.DstReg.CondMask = (yyvsp[(2) - (2)].dst_reg).CondMask;
- (yyval.inst)->Base.DstReg.CondSwizzle = (yyvsp[(2) - (2)].dst_reg).CondSwizzle;
- (yyval.inst)->Base.DstReg.CondSrc = (yyvsp[(2) - (2)].dst_reg).CondSrc;
- state->fragment.UsesKill = 1;
- ;}
- break;
-
- case 33:
-
-/* Line 1455 of yacc.c */
-#line 475 "program_parse.y"
- {
- (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (12)].temp_inst), & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg));
- if ((yyval.inst) != NULL) {
- const GLbitfield tex_mask = (1U << (yyvsp[(10) - (12)].integer));
- GLbitfield shadow_tex = 0;
- GLbitfield target_mask = 0;
-
-
- (yyval.inst)->Base.TexSrcUnit = (yyvsp[(10) - (12)].integer);
-
- if ((yyvsp[(12) - (12)].integer) < 0) {
- shadow_tex = tex_mask;
-
- (yyval.inst)->Base.TexSrcTarget = -(yyvsp[(12) - (12)].integer);
- (yyval.inst)->Base.TexShadow = 1;
- } else {
- (yyval.inst)->Base.TexSrcTarget = (yyvsp[(12) - (12)].integer);
- }
-
- target_mask = (1U << (yyval.inst)->Base.TexSrcTarget);
-
- /* If this texture unit was previously accessed and that access
- * had a different texture target, generate an error.
- *
- * If this texture unit was previously accessed and that access
- * had a different shadow mode, generate an error.
- */
- if ((state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] != 0)
- && ((state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] != target_mask)
- || ((state->prog->ShadowSamplers & tex_mask)
- != shadow_tex))) {
- yyerror(& (yylsp[(12) - (12)]), state,
- "multiple targets used on one texture image unit");
- YYERROR;
- }
-
-
- state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] |= target_mask;
- state->prog->ShadowSamplers |= shadow_tex;
- }
- ;}
- break;
-
- case 34:
-
-/* Line 1455 of yacc.c */
-#line 519 "program_parse.y"
- {
- (yyval.integer) = (yyvsp[(2) - (2)].integer);
- ;}
- break;
-
- case 35:
-
-/* Line 1455 of yacc.c */
-#line 524 "program_parse.y"
- { (yyval.integer) = TEXTURE_1D_INDEX; ;}
- break;
-
- case 36:
-
-/* Line 1455 of yacc.c */
-#line 525 "program_parse.y"
- { (yyval.integer) = TEXTURE_2D_INDEX; ;}
- break;
-
- case 37:
-
-/* Line 1455 of yacc.c */
-#line 526 "program_parse.y"
- { (yyval.integer) = TEXTURE_3D_INDEX; ;}
- break;
-
- case 38:
-
-/* Line 1455 of yacc.c */
-#line 527 "program_parse.y"
- { (yyval.integer) = TEXTURE_CUBE_INDEX; ;}
- break;
-
- case 39:
-
-/* Line 1455 of yacc.c */
-#line 528 "program_parse.y"
- { (yyval.integer) = TEXTURE_RECT_INDEX; ;}
- break;
-
- case 40:
-
-/* Line 1455 of yacc.c */
-#line 529 "program_parse.y"
- { (yyval.integer) = -TEXTURE_1D_INDEX; ;}
- break;
-
- case 41:
-
-/* Line 1455 of yacc.c */
-#line 530 "program_parse.y"
- { (yyval.integer) = -TEXTURE_2D_INDEX; ;}
- break;
-
- case 42:
-
-/* Line 1455 of yacc.c */
-#line 531 "program_parse.y"
- { (yyval.integer) = -TEXTURE_RECT_INDEX; ;}
- break;
-
- case 43:
-
-/* Line 1455 of yacc.c */
-#line 532 "program_parse.y"
- { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;}
- break;
-
- case 44:
-
-/* Line 1455 of yacc.c */
-#line 533 "program_parse.y"
- { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;}
- break;
-
- case 45:
-
-/* Line 1455 of yacc.c */
-#line 534 "program_parse.y"
- { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;}
- break;
-
- case 46:
-
-/* Line 1455 of yacc.c */
-#line 535 "program_parse.y"
- { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;}
- break;
-
- case 47:
-
-/* Line 1455 of yacc.c */
-#line 539 "program_parse.y"
- {
- /* FIXME: Is this correct? Should the extenedSwizzle be applied
- * FIXME: to the existing swizzle?
- */
- (yyvsp[(4) - (6)].src_reg).Base.Swizzle = (yyvsp[(6) - (6)].swiz_mask).swizzle;
- (yyvsp[(4) - (6)].src_reg).Base.Negate = (yyvsp[(6) - (6)].swiz_mask).mask;
-
- (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), NULL, NULL);
- ;}
- break;
-
- case 48:
-
-/* Line 1455 of yacc.c */
-#line 551 "program_parse.y"
- {
- (yyval.src_reg) = (yyvsp[(2) - (2)].src_reg);
-
- if ((yyvsp[(1) - (2)].negate)) {
- (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
- }
- ;}
- break;
-
- case 49:
-
-/* Line 1455 of yacc.c */
-#line 559 "program_parse.y"
- {
- (yyval.src_reg) = (yyvsp[(3) - (4)].src_reg);
-
- if (!state->option.NV_fragment) {
- yyerror(& (yylsp[(2) - (4)]), state, "unexpected character '|'");
- YYERROR;
- }
-
- if ((yyvsp[(1) - (4)].negate)) {
- (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
- }
-
- (yyval.src_reg).Base.Abs = 1;
- ;}
- break;
-
- case 50:
-
-/* Line 1455 of yacc.c */
-#line 576 "program_parse.y"
- {
- (yyval.src_reg) = (yyvsp[(1) - (2)].src_reg);
-
- (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
- (yyvsp[(2) - (2)].swiz_mask).swizzle);
- ;}
- break;
-
- case 51:
-
-/* Line 1455 of yacc.c */
-#line 583 "program_parse.y"
- {
- struct asm_symbol temp_sym;
-
- if (!state->option.NV_fragment) {
- yyerror(& (yylsp[(1) - (1)]), state, "expected scalar suffix");
- YYERROR;
- }
-
- memset(& temp_sym, 0, sizeof(temp_sym));
- temp_sym.param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & temp_sym, & (yyvsp[(1) - (1)].vector), GL_TRUE);
-
- set_src_reg_swz(& (yyval.src_reg), PROGRAM_CONSTANT,
- temp_sym.param_binding_begin,
- temp_sym.param_binding_swizzle);
- ;}
- break;
-
- case 52:
-
-/* Line 1455 of yacc.c */
-#line 602 "program_parse.y"
- {
- (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg);
-
- if ((yyvsp[(1) - (3)].negate)) {
- (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
- }
-
- (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
- (yyvsp[(3) - (3)].swiz_mask).swizzle);
- ;}
- break;
-
- case 53:
-
-/* Line 1455 of yacc.c */
-#line 613 "program_parse.y"
- {
- (yyval.src_reg) = (yyvsp[(3) - (5)].src_reg);
-
- if (!state->option.NV_fragment) {
- yyerror(& (yylsp[(2) - (5)]), state, "unexpected character '|'");
- YYERROR;
- }
-
- if ((yyvsp[(1) - (5)].negate)) {
- (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
- }
-
- (yyval.src_reg).Base.Abs = 1;
- (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
- (yyvsp[(4) - (5)].swiz_mask).swizzle);
- ;}
- break;
-
- case 54:
-
-/* Line 1455 of yacc.c */
-#line 633 "program_parse.y"
- {
- (yyval.dst_reg) = (yyvsp[(1) - (3)].dst_reg);
- (yyval.dst_reg).WriteMask = (yyvsp[(2) - (3)].swiz_mask).mask;
- (yyval.dst_reg).CondMask = (yyvsp[(3) - (3)].dst_reg).CondMask;
- (yyval.dst_reg).CondSwizzle = (yyvsp[(3) - (3)].dst_reg).CondSwizzle;
- (yyval.dst_reg).CondSrc = (yyvsp[(3) - (3)].dst_reg).CondSrc;
-
- if ((yyval.dst_reg).File == PROGRAM_OUTPUT) {
- /* Technically speaking, this should check that it is in
- * vertex program mode. However, PositionInvariant can never be
- * set in fragment program mode, so it is somewhat irrelevant.
- */
- if (state->option.PositionInvariant
- && ((yyval.dst_reg).Index == VERT_RESULT_HPOS)) {
- yyerror(& (yylsp[(1) - (3)]), state, "position-invariant programs cannot "
- "write position");
- YYERROR;
- }
-
- state->prog->OutputsWritten |= BITFIELD64_BIT((yyval.dst_reg).Index);
- }
- ;}
- break;
-
- case 55:
-
-/* Line 1455 of yacc.c */
-#line 658 "program_parse.y"
- {
- set_dst_reg(& (yyval.dst_reg), PROGRAM_ADDRESS, 0);
- (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask;
- ;}
- break;
-
- case 56:
-
-/* Line 1455 of yacc.c */
-#line 665 "program_parse.y"
- {
- const unsigned xyzw_valid =
- ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0)
- | ((yyvsp[(3) - (7)].ext_swizzle).xyzw_valid << 1)
- | ((yyvsp[(5) - (7)].ext_swizzle).xyzw_valid << 2)
- | ((yyvsp[(7) - (7)].ext_swizzle).xyzw_valid << 3);
- const unsigned rgba_valid =
- ((yyvsp[(1) - (7)].ext_swizzle).rgba_valid << 0)
- | ((yyvsp[(3) - (7)].ext_swizzle).rgba_valid << 1)
- | ((yyvsp[(5) - (7)].ext_swizzle).rgba_valid << 2)
- | ((yyvsp[(7) - (7)].ext_swizzle).rgba_valid << 3);
-
- /* All of the swizzle components have to be valid in either RGBA
- * or XYZW. Note that 0 and 1 are valid in both, so both masks
- * can have some bits set.
- *
- * We somewhat deviate from the spec here. It would be really hard
- * to figure out which component is the error, and there probably
- * isn't a lot of benefit.
- */
- if ((rgba_valid != 0x0f) && (xyzw_valid != 0x0f)) {
- yyerror(& (yylsp[(1) - (7)]), state, "cannot combine RGBA and XYZW swizzle "
- "components");
- YYERROR;
- }
-
- (yyval.swiz_mask).swizzle = MAKE_SWIZZLE4((yyvsp[(1) - (7)].ext_swizzle).swz, (yyvsp[(3) - (7)].ext_swizzle).swz, (yyvsp[(5) - (7)].ext_swizzle).swz, (yyvsp[(7) - (7)].ext_swizzle).swz);
- (yyval.swiz_mask).mask = ((yyvsp[(1) - (7)].ext_swizzle).negate) | ((yyvsp[(3) - (7)].ext_swizzle).negate << 1) | ((yyvsp[(5) - (7)].ext_swizzle).negate << 2)
- | ((yyvsp[(7) - (7)].ext_swizzle).negate << 3);
- ;}
- break;
-
- case 57:
-
-/* Line 1455 of yacc.c */
-#line 698 "program_parse.y"
- {
- (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle);
- (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0;
- ;}
- break;
-
- case 58:
-
-/* Line 1455 of yacc.c */
-#line 705 "program_parse.y"
- {
- if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
- YYERROR;
- }
-
- (yyval.ext_swizzle).swz = ((yyvsp[(1) - (1)].integer) == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE;
-
- /* 0 and 1 are valid for both RGBA swizzle names and XYZW
- * swizzle names.
- */
- (yyval.ext_swizzle).xyzw_valid = 1;
- (yyval.ext_swizzle).rgba_valid = 1;
- ;}
- break;
-
- case 59:
-
-/* Line 1455 of yacc.c */
-#line 720 "program_parse.y"
- {
- char s;
-
- if (strlen((yyvsp[(1) - (1)].string)) > 1) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
- YYERROR;
- }
-
- s = (yyvsp[(1) - (1)].string)[0];
- free((yyvsp[(1) - (1)].string));
-
- switch (s) {
- case 'x':
- (yyval.ext_swizzle).swz = SWIZZLE_X;
- (yyval.ext_swizzle).xyzw_valid = 1;
- break;
- case 'y':
- (yyval.ext_swizzle).swz = SWIZZLE_Y;
- (yyval.ext_swizzle).xyzw_valid = 1;
- break;
- case 'z':
- (yyval.ext_swizzle).swz = SWIZZLE_Z;
- (yyval.ext_swizzle).xyzw_valid = 1;
- break;
- case 'w':
- (yyval.ext_swizzle).swz = SWIZZLE_W;
- (yyval.ext_swizzle).xyzw_valid = 1;
- break;
-
- case 'r':
- (yyval.ext_swizzle).swz = SWIZZLE_X;
- (yyval.ext_swizzle).rgba_valid = 1;
- break;
- case 'g':
- (yyval.ext_swizzle).swz = SWIZZLE_Y;
- (yyval.ext_swizzle).rgba_valid = 1;
- break;
- case 'b':
- (yyval.ext_swizzle).swz = SWIZZLE_Z;
- (yyval.ext_swizzle).rgba_valid = 1;
- break;
- case 'a':
- (yyval.ext_swizzle).swz = SWIZZLE_W;
- (yyval.ext_swizzle).rgba_valid = 1;
- break;
-
- default:
- yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
- YYERROR;
- break;
- }
- ;}
- break;
-
- case 60:
-
-/* Line 1455 of yacc.c */
-#line 775 "program_parse.y"
- {
- struct asm_symbol *const s = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
-
- free((yyvsp[(1) - (1)].string));
-
- if (s == NULL) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
- YYERROR;
- } else if ((s->type != at_param) && (s->type != at_temp)
- && (s->type != at_attrib)) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
- YYERROR;
- } else if ((s->type == at_param) && s->param_is_array) {
- yyerror(& (yylsp[(1) - (1)]), state, "non-array access to array PARAM");
- YYERROR;
- }
-
- init_src_reg(& (yyval.src_reg));
- switch (s->type) {
- case at_temp:
- set_src_reg(& (yyval.src_reg), PROGRAM_TEMPORARY, s->temp_binding);
- break;
- case at_param:
- set_src_reg_swz(& (yyval.src_reg), s->param_binding_type,
- s->param_binding_begin,
- s->param_binding_swizzle);
- break;
- case at_attrib:
- set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, s->attrib_binding);
- state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index);
-
- if (!validate_inputs(& (yylsp[(1) - (1)]), state)) {
- YYERROR;
- }
- break;
-
- default:
- YYERROR;
- break;
- }
- ;}
- break;
-
- case 61:
-
-/* Line 1455 of yacc.c */
-#line 818 "program_parse.y"
- {
- set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, (yyvsp[(1) - (1)].attrib));
- state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index);
-
- if (!validate_inputs(& (yylsp[(1) - (1)]), state)) {
- YYERROR;
- }
- ;}
- break;
-
- case 62:
-
-/* Line 1455 of yacc.c */
-#line 827 "program_parse.y"
- {
- if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr
- && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) {
- yyerror(& (yylsp[(3) - (4)]), state, "out of bounds array access");
- YYERROR;
- }
-
- init_src_reg(& (yyval.src_reg));
- (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;
- (yyval.src_reg).Base.Index = (yyvsp[(3) - (4)].src_reg).Base.Index;
- (yyval.src_reg).Symbol = (yyvsp[(1) - (4)].sym);
- } else {
- (yyval.src_reg).Base.Index = (yyvsp[(1) - (4)].sym)->param_binding_begin + (yyvsp[(3) - (4)].src_reg).Base.Index;
- }
- ;}
- break;
-
- case 63:
-
-/* Line 1455 of yacc.c */
-#line 849 "program_parse.y"
- {
- gl_register_file file = ((yyvsp[(1) - (1)].temp_sym).name != NULL)
- ? (yyvsp[(1) - (1)].temp_sym).param_binding_type
- : PROGRAM_CONSTANT;
- set_src_reg_swz(& (yyval.src_reg), file, (yyvsp[(1) - (1)].temp_sym).param_binding_begin,
- (yyvsp[(1) - (1)].temp_sym).param_binding_swizzle);
- ;}
- break;
-
- case 64:
-
-/* Line 1455 of yacc.c */
-#line 859 "program_parse.y"
- {
- set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, (yyvsp[(1) - (1)].result));
- ;}
- break;
-
- case 65:
-
-/* Line 1455 of yacc.c */
-#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));
-
- free((yyvsp[(1) - (1)].string));
-
- if (s == NULL) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
- YYERROR;
- } else if ((s->type != at_output) && (s->type != at_temp)) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
- YYERROR;
- }
-
- switch (s->type) {
- case at_temp:
- set_dst_reg(& (yyval.dst_reg), PROGRAM_TEMPORARY, s->temp_binding);
- break;
- case at_output:
- set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, s->output_binding);
- break;
- default:
- set_dst_reg(& (yyval.dst_reg), s->param_binding_type, s->param_binding_begin);
- break;
- }
- ;}
- break;
-
- case 66:
-
-/* Line 1455 of yacc.c */
-#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));
-
- free((yyvsp[(1) - (1)].string));
-
- if (s == NULL) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
- YYERROR;
- } else if ((s->type != at_param) || !s->param_is_array) {
- yyerror(& (yylsp[(1) - (1)]), state, "array access to non-PARAM variable");
- YYERROR;
- } else {
- (yyval.sym) = s;
- }
- ;}
- break;
-
- case 69:
-
-/* Line 1455 of yacc.c */
-#line 913 "program_parse.y"
- {
- init_src_reg(& (yyval.src_reg));
- (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 70:
-
-/* Line 1455 of yacc.c */
-#line 920 "program_parse.y"
- {
- /* FINISHME: Add support for multiple address registers.
- */
- /* FINISHME: Add support for 4-component address registers.
- */
- init_src_reg(& (yyval.src_reg));
- (yyval.src_reg).Base.RelAddr = 1;
- (yyval.src_reg).Base.Index = (yyvsp[(3) - (3)].integer);
- ;}
- break;
-
- case 71:
-
-/* Line 1455 of yacc.c */
-#line 931 "program_parse.y"
- { (yyval.integer) = 0; ;}
- break;
-
- case 72:
-
-/* Line 1455 of yacc.c */
-#line 932 "program_parse.y"
- { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;}
- break;
-
- case 73:
-
-/* Line 1455 of yacc.c */
-#line 933 "program_parse.y"
- { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;}
- break;
-
- case 74:
-
-/* Line 1455 of yacc.c */
-#line 937 "program_parse.y"
- {
- 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));
- yyerror(& (yylsp[(1) - (1)]), state, s);
- YYERROR;
- } else {
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- }
- ;}
- break;
-
- case 75:
-
-/* Line 1455 of yacc.c */
-#line 951 "program_parse.y"
- {
- 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));
- yyerror(& (yylsp[(1) - (1)]), state, s);
- YYERROR;
- } else {
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- }
- ;}
- break;
-
- case 76:
-
-/* Line 1455 of yacc.c */
-#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));
-
- free((yyvsp[(1) - (1)].string));
-
- if (s == NULL) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid array member");
- YYERROR;
- } else if (s->type != at_address) {
- yyerror(& (yylsp[(1) - (1)]), state,
- "invalid variable for indexed array access");
- YYERROR;
- } else {
- (yyval.sym) = s;
- }
- ;}
- break;
-
- case 77:
-
-/* Line 1455 of yacc.c */
-#line 985 "program_parse.y"
- {
- if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector");
- YYERROR;
- } else {
- (yyval.swiz_mask) = (yyvsp[(1) - (1)].swiz_mask);
- }
- ;}
- break;
-
- case 78:
-
-/* Line 1455 of yacc.c */
-#line 996 "program_parse.y"
- {
- if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) {
- yyerror(& (yylsp[(1) - (1)]), state,
- "address register write mask must be \".x\"");
- YYERROR;
- } else {
- (yyval.swiz_mask) = (yyvsp[(1) - (1)].swiz_mask);
- }
- ;}
- break;
-
- case 83:
-
-/* Line 1455 of yacc.c */
-#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 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 1020 "program_parse.y"
- {
- (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg);
- ;}
- break;
-
- case 90:
-
-/* Line 1455 of yacc.c */
-#line 1024 "program_parse.y"
- {
- (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg);
- ;}
- break;
-
- case 91:
-
-/* Line 1455 of yacc.c */
-#line 1028 "program_parse.y"
- {
- (yyval.dst_reg).CondMask = COND_TR;
- (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
- (yyval.dst_reg).CondSrc = 0;
- ;}
- break;
-
- case 92:
-
-/* Line 1455 of yacc.c */
-#line 1036 "program_parse.y"
- {
- (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg);
- (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle;
- ;}
- break;
-
- case 93:
-
-/* Line 1455 of yacc.c */
-#line 1043 "program_parse.y"
- {
- (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg);
- (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle;
- ;}
- break;
-
- case 94:
-
-/* Line 1455 of yacc.c */
-#line 1050 "program_parse.y"
- {
- const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string));
- if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) {
- char *const err_str =
- make_error_string("invalid condition code \"%s\"", (yyvsp[(1) - (1)].string));
-
- yyerror(& (yylsp[(1) - (1)]), state, (err_str != NULL)
- ? err_str : "invalid condition code");
-
- if (err_str != NULL) {
- free(err_str);
- }
-
- YYERROR;
- }
-
- (yyval.dst_reg).CondMask = cond;
- (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
- (yyval.dst_reg).CondSrc = 0;
- ;}
- break;
-
- case 95:
-
-/* Line 1455 of yacc.c */
-#line 1073 "program_parse.y"
- {
- const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string));
- if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) {
- char *const err_str =
- make_error_string("invalid condition code \"%s\"", (yyvsp[(1) - (1)].string));
-
- yyerror(& (yylsp[(1) - (1)]), state, (err_str != NULL)
- ? err_str : "invalid condition code");
-
- if (err_str != NULL) {
- free(err_str);
- }
-
- YYERROR;
- }
-
- (yyval.dst_reg).CondMask = cond;
- (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
- (yyval.dst_reg).CondSrc = 0;
- ;}
- break;
-
- case 102:
-
-/* Line 1455 of yacc.c */
-#line 1104 "program_parse.y"
- {
- struct asm_symbol *const s =
- declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)]));
-
- if (s == NULL) {
- free((yyvsp[(2) - (4)].string));
- YYERROR;
- } else {
- s->attrib_binding = (yyvsp[(4) - (4)].attrib);
- state->InputsBound |= (1U << s->attrib_binding);
-
- if (!validate_inputs(& (yylsp[(4) - (4)]), state)) {
- YYERROR;
- }
- }
- ;}
- break;
-
- case 103:
-
-/* Line 1455 of yacc.c */
-#line 1123 "program_parse.y"
- {
- (yyval.attrib) = (yyvsp[(2) - (2)].attrib);
- ;}
- break;
-
- case 104:
-
-/* Line 1455 of yacc.c */
-#line 1127 "program_parse.y"
- {
- (yyval.attrib) = (yyvsp[(2) - (2)].attrib);
- ;}
- break;
-
- case 105:
-
-/* Line 1455 of yacc.c */
-#line 1133 "program_parse.y"
- {
- (yyval.attrib) = VERT_ATTRIB_POS;
- ;}
- break;
-
- case 106:
-
-/* Line 1455 of yacc.c */
-#line 1137 "program_parse.y"
- {
- (yyval.attrib) = VERT_ATTRIB_WEIGHT;
- ;}
- break;
-
- case 107:
-
-/* Line 1455 of yacc.c */
-#line 1141 "program_parse.y"
- {
- (yyval.attrib) = VERT_ATTRIB_NORMAL;
- ;}
- break;
-
- case 108:
-
-/* Line 1455 of yacc.c */
-#line 1145 "program_parse.y"
- {
- if (!state->ctx->Extensions.EXT_secondary_color) {
- yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported");
- YYERROR;
- }
-
- (yyval.attrib) = VERT_ATTRIB_COLOR0 + (yyvsp[(2) - (2)].integer);
- ;}
- break;
-
- case 109:
-
-/* Line 1455 of yacc.c */
-#line 1154 "program_parse.y"
- {
- if (!state->ctx->Extensions.EXT_fog_coord) {
- yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported");
- YYERROR;
- }
-
- (yyval.attrib) = VERT_ATTRIB_FOG;
- ;}
- break;
-
- case 110:
-
-/* Line 1455 of yacc.c */
-#line 1163 "program_parse.y"
- {
- (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer);
- ;}
- break;
-
- case 111:
-
-/* Line 1455 of yacc.c */
-#line 1167 "program_parse.y"
- {
- yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported");
- YYERROR;
- ;}
- break;
-
- case 112:
-
-/* Line 1455 of yacc.c */
-#line 1172 "program_parse.y"
- {
- (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer);
- ;}
- break;
-
- case 113:
-
-/* Line 1455 of yacc.c */
-#line 1178 "program_parse.y"
- {
- if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference");
- YYERROR;
- }
-
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 117:
-
-/* Line 1455 of yacc.c */
-#line 1192 "program_parse.y"
- {
- (yyval.attrib) = FRAG_ATTRIB_WPOS;
- ;}
- break;
-
- case 118:
-
-/* Line 1455 of yacc.c */
-#line 1196 "program_parse.y"
- {
- (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer);
- ;}
- break;
-
- case 119:
-
-/* Line 1455 of yacc.c */
-#line 1200 "program_parse.y"
- {
- (yyval.attrib) = FRAG_ATTRIB_FOGC;
- ;}
- break;
-
- case 120:
-
-/* Line 1455 of yacc.c */
-#line 1204 "program_parse.y"
- {
- (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer);
- ;}
- break;
-
- case 123:
-
-/* Line 1455 of yacc.c */
-#line 1212 "program_parse.y"
- {
- struct asm_symbol *const s =
- declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)]));
-
- if (s == NULL) {
- free((yyvsp[(2) - (3)].string));
- YYERROR;
- } else {
- 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 = (yyvsp[(3) - (3)].temp_sym).param_binding_swizzle;
- s->param_is_array = 0;
- }
- ;}
- break;
-
- case 124:
-
-/* Line 1455 of yacc.c */
-#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));
- yyerror(& (yylsp[(4) - (6)]), state,
- "parameter array size and number of bindings must match");
- YYERROR;
- } else {
- struct asm_symbol *const s =
- declare_variable(state, (yyvsp[(2) - (6)].string), (yyvsp[(6) - (6)].temp_sym).type, & (yylsp[(2) - (6)]));
-
- if (s == NULL) {
- free((yyvsp[(2) - (6)].string));
- YYERROR;
- } else {
- s->param_binding_type = (yyvsp[(6) - (6)].temp_sym).param_binding_type;
- s->param_binding_begin = (yyvsp[(6) - (6)].temp_sym).param_binding_begin;
- s->param_binding_length = (yyvsp[(6) - (6)].temp_sym).param_binding_length;
- s->param_binding_swizzle = SWIZZLE_XYZW;
- s->param_is_array = 1;
- }
- }
- ;}
- break;
-
- case 125:
-
-/* Line 1455 of yacc.c */
-#line 1255 "program_parse.y"
- {
- (yyval.integer) = 0;
- ;}
- break;
-
- case 126:
-
-/* Line 1455 of yacc.c */
-#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");
- YYERROR;
- } else {
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- }
- ;}
- break;
-
- case 127:
-
-/* Line 1455 of yacc.c */
-#line 1270 "program_parse.y"
- {
- (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym);
- ;}
- break;
-
- case 128:
-
-/* Line 1455 of yacc.c */
-#line 1276 "program_parse.y"
- {
- (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym);
- ;}
- break;
-
- case 130:
-
-/* Line 1455 of yacc.c */
-#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);
- ;}
- break;
-
- case 131:
-
-/* Line 1455 of yacc.c */
-#line 1290 "program_parse.y"
- {
- memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
- (yyval.temp_sym).param_binding_begin = ~0;
- initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
- ;}
- break;
-
- case 132:
-
-/* Line 1455 of yacc.c */
-#line 1296 "program_parse.y"
- {
- memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
- (yyval.temp_sym).param_binding_begin = ~0;
- initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
- ;}
- break;
-
- case 133:
-
-/* Line 1455 of yacc.c */
-#line 1302 "program_parse.y"
- {
- memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
- (yyval.temp_sym).param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[(1) - (1)].vector), GL_TRUE);
- ;}
- break;
-
- case 134:
-
-/* Line 1455 of yacc.c */
-#line 1310 "program_parse.y"
- {
- memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
- (yyval.temp_sym).param_binding_begin = ~0;
- initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
- ;}
- break;
-
- case 135:
-
-/* Line 1455 of yacc.c */
-#line 1316 "program_parse.y"
- {
- memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
- (yyval.temp_sym).param_binding_begin = ~0;
- initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
- ;}
- break;
-
- case 136:
-
-/* Line 1455 of yacc.c */
-#line 1322 "program_parse.y"
- {
- memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
- (yyval.temp_sym).param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[(1) - (1)].vector), GL_TRUE);
- ;}
- break;
-
- case 137:
-
-/* Line 1455 of yacc.c */
-#line 1330 "program_parse.y"
- {
- memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
- (yyval.temp_sym).param_binding_begin = ~0;
- initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
- ;}
- break;
-
- case 138:
-
-/* Line 1455 of yacc.c */
-#line 1336 "program_parse.y"
- {
- memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
- (yyval.temp_sym).param_binding_begin = ~0;
- initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
- ;}
- break;
-
- case 139:
-
-/* Line 1455 of yacc.c */
-#line 1342 "program_parse.y"
- {
- memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
- (yyval.temp_sym).param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[(1) - (1)].vector), GL_FALSE);
- ;}
- break;
-
- case 140:
-
-/* Line 1455 of yacc.c */
-#line 1349 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;}
- break;
-
- case 141:
-
-/* Line 1455 of yacc.c */
-#line 1350 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 142:
-
-/* Line 1455 of yacc.c */
-#line 1353 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 143:
-
-/* Line 1455 of yacc.c */
-#line 1354 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 144:
-
-/* Line 1455 of yacc.c */
-#line 1355 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 145:
-
-/* Line 1455 of yacc.c */
-#line 1356 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 146:
-
-/* Line 1455 of yacc.c */
-#line 1357 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 147:
-
-/* Line 1455 of yacc.c */
-#line 1358 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 148:
-
-/* Line 1455 of yacc.c */
-#line 1359 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 149:
-
-/* Line 1455 of yacc.c */
-#line 1360 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 150:
-
-/* Line 1455 of yacc.c */
-#line 1361 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 151:
-
-/* Line 1455 of yacc.c */
-#line 1362 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 152:
-
-/* Line 1455 of yacc.c */
-#line 1363 "program_parse.y"
- { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
- break;
-
- case 153:
-
-/* Line 1455 of yacc.c */
-#line 1367 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = STATE_MATERIAL;
- (yyval.state)[1] = (yyvsp[(2) - (3)].integer);
- (yyval.state)[2] = (yyvsp[(3) - (3)].integer);
- ;}
- break;
-
- case 154:
-
-/* Line 1455 of yacc.c */
-#line 1376 "program_parse.y"
- {
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 155:
-
-/* Line 1455 of yacc.c */
-#line 1380 "program_parse.y"
- {
- (yyval.integer) = STATE_EMISSION;
- ;}
- break;
-
- case 156:
-
-/* Line 1455 of yacc.c */
-#line 1384 "program_parse.y"
- {
- (yyval.integer) = STATE_SHININESS;
- ;}
- break;
-
- case 157:
-
-/* Line 1455 of yacc.c */
-#line 1390 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = STATE_LIGHT;
- (yyval.state)[1] = (yyvsp[(3) - (5)].integer);
- (yyval.state)[2] = (yyvsp[(5) - (5)].integer);
- ;}
- break;
-
- case 158:
-
-/* Line 1455 of yacc.c */
-#line 1399 "program_parse.y"
- {
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 159:
-
-/* Line 1455 of yacc.c */
-#line 1403 "program_parse.y"
- {
- (yyval.integer) = STATE_POSITION;
- ;}
- break;
-
- case 160:
-
-/* Line 1455 of yacc.c */
-#line 1407 "program_parse.y"
- {
- if (!state->ctx->Extensions.EXT_point_parameters) {
- yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported");
- YYERROR;
- }
-
- (yyval.integer) = STATE_ATTENUATION;
- ;}
- break;
-
- case 161:
-
-/* Line 1455 of yacc.c */
-#line 1416 "program_parse.y"
- {
- (yyval.integer) = (yyvsp[(2) - (2)].integer);
- ;}
- break;
-
- case 162:
-
-/* Line 1455 of yacc.c */
-#line 1420 "program_parse.y"
- {
- (yyval.integer) = STATE_HALF_VECTOR;
- ;}
- break;
-
- case 163:
-
-/* Line 1455 of yacc.c */
-#line 1426 "program_parse.y"
- {
- (yyval.integer) = STATE_SPOT_DIRECTION;
- ;}
- break;
-
- case 164:
-
-/* Line 1455 of yacc.c */
-#line 1432 "program_parse.y"
- {
- (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0];
- (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1];
- ;}
- break;
-
- case 165:
-
-/* Line 1455 of yacc.c */
-#line 1439 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT;
- ;}
- break;
-
- case 166:
-
-/* Line 1455 of yacc.c */
-#line 1444 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR;
- (yyval.state)[1] = (yyvsp[(1) - (2)].integer);
- ;}
- break;
-
- case 167:
-
-/* Line 1455 of yacc.c */
-#line 1452 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = STATE_LIGHTPROD;
- (yyval.state)[1] = (yyvsp[(3) - (6)].integer);
- (yyval.state)[2] = (yyvsp[(5) - (6)].integer);
- (yyval.state)[3] = (yyvsp[(6) - (6)].integer);
- ;}
- break;
-
- case 169:
-
-/* Line 1455 of yacc.c */
-#line 1464 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = (yyvsp[(3) - (3)].integer);
- (yyval.state)[1] = (yyvsp[(2) - (3)].integer);
- ;}
- break;
-
- case 170:
-
-/* Line 1455 of yacc.c */
-#line 1472 "program_parse.y"
- {
- (yyval.integer) = STATE_TEXENV_COLOR;
- ;}
- break;
-
- case 171:
-
-/* Line 1455 of yacc.c */
-#line 1478 "program_parse.y"
- {
- (yyval.integer) = STATE_AMBIENT;
- ;}
- break;
-
- case 172:
-
-/* Line 1455 of yacc.c */
-#line 1482 "program_parse.y"
- {
- (yyval.integer) = STATE_DIFFUSE;
- ;}
- break;
-
- case 173:
-
-/* Line 1455 of yacc.c */
-#line 1486 "program_parse.y"
- {
- (yyval.integer) = STATE_SPECULAR;
- ;}
- break;
-
- case 174:
-
-/* Line 1455 of yacc.c */
-#line 1492 "program_parse.y"
- {
- if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector");
- YYERROR;
- }
-
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 175:
-
-/* Line 1455 of yacc.c */
-#line 1503 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = STATE_TEXGEN;
- (yyval.state)[1] = (yyvsp[(2) - (4)].integer);
- (yyval.state)[2] = (yyvsp[(3) - (4)].integer) + (yyvsp[(4) - (4)].integer);
- ;}
- break;
-
- case 176:
-
-/* Line 1455 of yacc.c */
-#line 1512 "program_parse.y"
- {
- (yyval.integer) = STATE_TEXGEN_EYE_S;
- ;}
- break;
-
- case 177:
-
-/* Line 1455 of yacc.c */
-#line 1516 "program_parse.y"
- {
- (yyval.integer) = STATE_TEXGEN_OBJECT_S;
- ;}
- break;
-
- case 178:
-
-/* Line 1455 of yacc.c */
-#line 1521 "program_parse.y"
- {
- (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S;
- ;}
- break;
-
- case 179:
-
-/* Line 1455 of yacc.c */
-#line 1525 "program_parse.y"
- {
- (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S;
- ;}
- break;
-
- case 180:
-
-/* Line 1455 of yacc.c */
-#line 1529 "program_parse.y"
- {
- (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S;
- ;}
- break;
-
- case 181:
-
-/* Line 1455 of yacc.c */
-#line 1533 "program_parse.y"
- {
- (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S;
- ;}
- break;
-
- case 182:
-
-/* Line 1455 of yacc.c */
-#line 1539 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = (yyvsp[(2) - (2)].integer);
- ;}
- break;
-
- case 183:
-
-/* Line 1455 of yacc.c */
-#line 1546 "program_parse.y"
- {
- (yyval.integer) = STATE_FOG_COLOR;
- ;}
- break;
-
- case 184:
-
-/* Line 1455 of yacc.c */
-#line 1550 "program_parse.y"
- {
- (yyval.integer) = STATE_FOG_PARAMS;
- ;}
- break;
-
- case 185:
-
-/* Line 1455 of yacc.c */
-#line 1556 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = STATE_CLIPPLANE;
- (yyval.state)[1] = (yyvsp[(3) - (5)].integer);
- ;}
- break;
-
- case 186:
-
-/* Line 1455 of yacc.c */
-#line 1564 "program_parse.y"
- {
- if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector");
- YYERROR;
- }
-
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 187:
-
-/* Line 1455 of yacc.c */
-#line 1575 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = (yyvsp[(2) - (2)].integer);
- ;}
- break;
-
- case 188:
-
-/* Line 1455 of yacc.c */
-#line 1582 "program_parse.y"
- {
- (yyval.integer) = STATE_POINT_SIZE;
- ;}
- break;
-
- case 189:
-
-/* Line 1455 of yacc.c */
-#line 1586 "program_parse.y"
- {
- (yyval.integer) = STATE_POINT_ATTENUATION;
- ;}
- break;
-
- case 190:
-
-/* Line 1455 of yacc.c */
-#line 1592 "program_parse.y"
- {
- (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0];
- (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1];
- (yyval.state)[2] = (yyvsp[(4) - (5)].integer);
- (yyval.state)[3] = (yyvsp[(4) - (5)].integer);
- (yyval.state)[4] = (yyvsp[(1) - (5)].state)[2];
- ;}
- break;
-
- case 191:
-
-/* Line 1455 of yacc.c */
-#line 1602 "program_parse.y"
- {
- (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0];
- (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1];
- (yyval.state)[2] = (yyvsp[(2) - (2)].state)[2];
- (yyval.state)[3] = (yyvsp[(2) - (2)].state)[3];
- (yyval.state)[4] = (yyvsp[(1) - (2)].state)[2];
- ;}
- break;
-
- case 192:
-
-/* Line 1455 of yacc.c */
-#line 1612 "program_parse.y"
- {
- (yyval.state)[2] = 0;
- (yyval.state)[3] = 3;
- ;}
- break;
-
- case 193:
-
-/* Line 1455 of yacc.c */
-#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).
- * However, the ARB_vertex_program spec says "a program will fail
- * to load if <a> is greater than <b>." This means that $3 == $5
- * is valid.
- */
- if ((yyvsp[(3) - (6)].integer) > (yyvsp[(5) - (6)].integer)) {
- yyerror(& (yylsp[(3) - (6)]), state, "invalid matrix row range");
- YYERROR;
- }
-
- (yyval.state)[2] = (yyvsp[(3) - (6)].integer);
- (yyval.state)[3] = (yyvsp[(5) - (6)].integer);
- ;}
- break;
-
- case 194:
-
-/* Line 1455 of yacc.c */
-#line 1635 "program_parse.y"
- {
- (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0];
- (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1];
- (yyval.state)[2] = (yyvsp[(3) - (3)].integer);
- ;}
- break;
-
- case 195:
-
-/* Line 1455 of yacc.c */
-#line 1643 "program_parse.y"
- {
- (yyval.integer) = 0;
- ;}
- break;
-
- case 196:
-
-/* Line 1455 of yacc.c */
-#line 1647 "program_parse.y"
- {
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 197:
-
-/* Line 1455 of yacc.c */
-#line 1653 "program_parse.y"
- {
- (yyval.integer) = STATE_MATRIX_INVERSE;
- ;}
- break;
-
- case 198:
-
-/* Line 1455 of yacc.c */
-#line 1657 "program_parse.y"
- {
- (yyval.integer) = STATE_MATRIX_TRANSPOSE;
- ;}
- break;
-
- case 199:
-
-/* Line 1455 of yacc.c */
-#line 1661 "program_parse.y"
- {
- (yyval.integer) = STATE_MATRIX_INVTRANS;
- ;}
- break;
-
- case 200:
-
-/* Line 1455 of yacc.c */
-#line 1667 "program_parse.y"
- {
- if ((yyvsp[(1) - (1)].integer) > 3) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference");
- YYERROR;
- }
-
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 201:
-
-/* Line 1455 of yacc.c */
-#line 1678 "program_parse.y"
- {
- (yyval.state)[0] = STATE_MODELVIEW_MATRIX;
- (yyval.state)[1] = (yyvsp[(2) - (2)].integer);
- ;}
- break;
-
- case 202:
-
-/* Line 1455 of yacc.c */
-#line 1683 "program_parse.y"
- {
- (yyval.state)[0] = STATE_PROJECTION_MATRIX;
- (yyval.state)[1] = 0;
- ;}
- break;
-
- case 203:
-
-/* Line 1455 of yacc.c */
-#line 1688 "program_parse.y"
- {
- (yyval.state)[0] = STATE_MVP_MATRIX;
- (yyval.state)[1] = 0;
- ;}
- break;
-
- case 204:
-
-/* Line 1455 of yacc.c */
-#line 1693 "program_parse.y"
- {
- (yyval.state)[0] = STATE_TEXTURE_MATRIX;
- (yyval.state)[1] = (yyvsp[(2) - (2)].integer);
- ;}
- break;
-
- case 205:
-
-/* Line 1455 of yacc.c */
-#line 1698 "program_parse.y"
- {
- yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported");
- YYERROR;
- ;}
- break;
-
- case 206:
-
-/* Line 1455 of yacc.c */
-#line 1703 "program_parse.y"
- {
- (yyval.state)[0] = STATE_PROGRAM_MATRIX;
- (yyval.state)[1] = (yyvsp[(3) - (4)].integer);
- ;}
- break;
-
- case 207:
-
-/* Line 1455 of yacc.c */
-#line 1710 "program_parse.y"
- {
- (yyval.integer) = 0;
- ;}
- break;
-
- case 208:
-
-/* Line 1455 of yacc.c */
-#line 1714 "program_parse.y"
- {
- (yyval.integer) = (yyvsp[(2) - (3)].integer);
- ;}
- break;
-
- case 209:
-
-/* Line 1455 of yacc.c */
-#line 1719 "program_parse.y"
- {
- /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
- * zero is valid.
- */
- if ((yyvsp[(1) - (1)].integer) != 0) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid modelview matrix index");
- YYERROR;
- }
-
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 210:
-
-/* Line 1455 of yacc.c */
-#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.
- */
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 211:
-
-/* Line 1455 of yacc.c */
-#line 1740 "program_parse.y"
- {
- if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector");
- YYERROR;
- }
-
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 212:
-
-/* Line 1455 of yacc.c */
-#line 1751 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = STATE_DEPTH_RANGE;
- ;}
- break;
-
- case 217:
-
-/* Line 1455 of yacc.c */
-#line 1763 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = state->state_param_enum;
- (yyval.state)[1] = STATE_ENV;
- (yyval.state)[2] = (yyvsp[(4) - (5)].state)[0];
- (yyval.state)[3] = (yyvsp[(4) - (5)].state)[1];
- ;}
- break;
-
- case 218:
-
-/* Line 1455 of yacc.c */
-#line 1773 "program_parse.y"
- {
- (yyval.state)[0] = (yyvsp[(1) - (1)].integer);
- (yyval.state)[1] = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 219:
-
-/* Line 1455 of yacc.c */
-#line 1778 "program_parse.y"
- {
- (yyval.state)[0] = (yyvsp[(1) - (3)].integer);
- (yyval.state)[1] = (yyvsp[(3) - (3)].integer);
- ;}
- break;
-
- case 220:
-
-/* Line 1455 of yacc.c */
-#line 1785 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = state->state_param_enum;
- (yyval.state)[1] = STATE_ENV;
- (yyval.state)[2] = (yyvsp[(4) - (5)].integer);
- (yyval.state)[3] = (yyvsp[(4) - (5)].integer);
- ;}
- break;
-
- case 221:
-
-/* Line 1455 of yacc.c */
-#line 1795 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = state->state_param_enum;
- (yyval.state)[1] = STATE_LOCAL;
- (yyval.state)[2] = (yyvsp[(4) - (5)].state)[0];
- (yyval.state)[3] = (yyvsp[(4) - (5)].state)[1];
- ;}
- break;
-
- case 222:
-
-/* Line 1455 of yacc.c */
-#line 1804 "program_parse.y"
- {
- (yyval.state)[0] = (yyvsp[(1) - (1)].integer);
- (yyval.state)[1] = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 223:
-
-/* Line 1455 of yacc.c */
-#line 1809 "program_parse.y"
- {
- (yyval.state)[0] = (yyvsp[(1) - (3)].integer);
- (yyval.state)[1] = (yyvsp[(3) - (3)].integer);
- ;}
- break;
-
- case 224:
-
-/* Line 1455 of yacc.c */
-#line 1816 "program_parse.y"
- {
- memset((yyval.state), 0, sizeof((yyval.state)));
- (yyval.state)[0] = state->state_param_enum;
- (yyval.state)[1] = STATE_LOCAL;
- (yyval.state)[2] = (yyvsp[(4) - (5)].integer);
- (yyval.state)[3] = (yyvsp[(4) - (5)].integer);
- ;}
- break;
-
- case 225:
-
-/* Line 1455 of yacc.c */
-#line 1826 "program_parse.y"
- {
- if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference");
- YYERROR;
- }
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 226:
-
-/* Line 1455 of yacc.c */
-#line 1836 "program_parse.y"
- {
- if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference");
- YYERROR;
- }
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 231:
-
-/* Line 1455 of yacc.c */
-#line 1851 "program_parse.y"
- {
- (yyval.vector).count = 4;
- (yyval.vector).data[0] = (yyvsp[(1) - (1)].real);
- (yyval.vector).data[1] = (yyvsp[(1) - (1)].real);
- (yyval.vector).data[2] = (yyvsp[(1) - (1)].real);
- (yyval.vector).data[3] = (yyvsp[(1) - (1)].real);
- ;}
- break;
-
- case 232:
-
-/* Line 1455 of yacc.c */
-#line 1861 "program_parse.y"
- {
- (yyval.vector).count = 1;
- (yyval.vector).data[0] = (yyvsp[(1) - (1)].real);
- (yyval.vector).data[1] = (yyvsp[(1) - (1)].real);
- (yyval.vector).data[2] = (yyvsp[(1) - (1)].real);
- (yyval.vector).data[3] = (yyvsp[(1) - (1)].real);
- ;}
- break;
-
- case 233:
-
-/* Line 1455 of yacc.c */
-#line 1869 "program_parse.y"
- {
- (yyval.vector).count = 1;
- (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer);
- (yyval.vector).data[1] = (float) (yyvsp[(1) - (1)].integer);
- (yyval.vector).data[2] = (float) (yyvsp[(1) - (1)].integer);
- (yyval.vector).data[3] = (float) (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 234:
-
-/* Line 1455 of yacc.c */
-#line 1879 "program_parse.y"
- {
- (yyval.vector).count = 4;
- (yyval.vector).data[0] = (yyvsp[(2) - (3)].real);
- (yyval.vector).data[1] = 0.0f;
- (yyval.vector).data[2] = 0.0f;
- (yyval.vector).data[3] = 1.0f;
- ;}
- break;
-
- case 235:
-
-/* Line 1455 of yacc.c */
-#line 1887 "program_parse.y"
- {
- (yyval.vector).count = 4;
- (yyval.vector).data[0] = (yyvsp[(2) - (5)].real);
- (yyval.vector).data[1] = (yyvsp[(4) - (5)].real);
- (yyval.vector).data[2] = 0.0f;
- (yyval.vector).data[3] = 1.0f;
- ;}
- break;
-
- case 236:
-
-/* Line 1455 of yacc.c */
-#line 1896 "program_parse.y"
- {
- (yyval.vector).count = 4;
- (yyval.vector).data[0] = (yyvsp[(2) - (7)].real);
- (yyval.vector).data[1] = (yyvsp[(4) - (7)].real);
- (yyval.vector).data[2] = (yyvsp[(6) - (7)].real);
- (yyval.vector).data[3] = 1.0f;
- ;}
- break;
-
- case 237:
-
-/* Line 1455 of yacc.c */
-#line 1905 "program_parse.y"
- {
- (yyval.vector).count = 4;
- (yyval.vector).data[0] = (yyvsp[(2) - (9)].real);
- (yyval.vector).data[1] = (yyvsp[(4) - (9)].real);
- (yyval.vector).data[2] = (yyvsp[(6) - (9)].real);
- (yyval.vector).data[3] = (yyvsp[(8) - (9)].real);
- ;}
- break;
-
- case 238:
-
-/* Line 1455 of yacc.c */
-#line 1915 "program_parse.y"
- {
- (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real);
- ;}
- break;
-
- case 239:
-
-/* Line 1455 of yacc.c */
-#line 1919 "program_parse.y"
- {
- (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer));
- ;}
- break;
-
- case 240:
-
-/* Line 1455 of yacc.c */
-#line 1924 "program_parse.y"
- { (yyval.negate) = FALSE; ;}
- break;
-
- case 241:
-
-/* Line 1455 of yacc.c */
-#line 1925 "program_parse.y"
- { (yyval.negate) = TRUE; ;}
- break;
-
- case 242:
-
-/* Line 1455 of yacc.c */
-#line 1926 "program_parse.y"
- { (yyval.negate) = FALSE; ;}
- break;
-
- case 243:
-
-/* Line 1455 of yacc.c */
-#line 1929 "program_parse.y"
- { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;}
- break;
-
- case 245:
-
-/* Line 1455 of yacc.c */
-#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
- * before TEMP or OUTPUT. However, neither is a reserved word!
- * This means that we have to parse it as an identifier, then check
- * to make sure it's one of the valid values. *sigh*
- *
- * In addition, the grammar in the extension spec does *not* allow
- * the size specifier to be optional, but all known implementations
- * do.
- */
- if (!state->option.NV_fragment) {
- yyerror(& (yylsp[(1) - (1)]), state, "unexpected IDENTIFIER");
- YYERROR;
- }
-
- if (strcmp("SHORT", (yyvsp[(1) - (1)].string)) == 0) {
- } else if (strcmp("LONG", (yyvsp[(1) - (1)].string)) == 0) {
- } else {
- char *const err_str =
- make_error_string("invalid storage size specifier \"%s\"",
- (yyvsp[(1) - (1)].string));
-
- yyerror(& (yylsp[(1) - (1)]), state, (err_str != NULL)
- ? err_str : "invalid storage size specifier");
-
- if (err_str != NULL) {
- free(err_str);
- }
-
- YYERROR;
- }
- ;}
- break;
-
- case 246:
-
-/* Line 1455 of yacc.c */
-#line 1967 "program_parse.y"
- {
- ;}
- break;
-
- case 247:
-
-/* Line 1455 of yacc.c */
-#line 1971 "program_parse.y"
- { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;}
- break;
-
- case 249:
-
-/* Line 1455 of yacc.c */
-#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));
- YYERROR;
- }
- ;}
- break;
-
- case 250:
-
-/* Line 1455 of yacc.c */
-#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));
- YYERROR;
- }
- ;}
- break;
-
- case 251:
-
-/* Line 1455 of yacc.c */
-#line 1991 "program_parse.y"
- {
- struct asm_symbol *const s =
- declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)]));
-
- if (s == NULL) {
- free((yyvsp[(3) - (5)].string));
- YYERROR;
- } else {
- s->output_binding = (yyvsp[(5) - (5)].result);
- }
- ;}
- break;
-
- case 252:
-
-/* Line 1455 of yacc.c */
-#line 2005 "program_parse.y"
- {
- if (state->mode == ARB_vertex) {
- (yyval.result) = VERT_RESULT_HPOS;
- } else {
- yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
- YYERROR;
- }
- ;}
- break;
-
- case 253:
-
-/* Line 1455 of yacc.c */
-#line 2014 "program_parse.y"
- {
- if (state->mode == ARB_vertex) {
- (yyval.result) = VERT_RESULT_FOGC;
- } else {
- yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
- YYERROR;
- }
- ;}
- break;
-
- case 254:
-
-/* Line 1455 of yacc.c */
-#line 2023 "program_parse.y"
- {
- (yyval.result) = (yyvsp[(2) - (2)].result);
- ;}
- break;
-
- case 255:
-
-/* Line 1455 of yacc.c */
-#line 2027 "program_parse.y"
- {
- if (state->mode == ARB_vertex) {
- (yyval.result) = VERT_RESULT_PSIZ;
- } else {
- yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
- YYERROR;
- }
- ;}
- break;
-
- case 256:
-
-/* Line 1455 of yacc.c */
-#line 2036 "program_parse.y"
- {
- if (state->mode == ARB_vertex) {
- (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer);
- } else {
- yyerror(& (yylsp[(2) - (3)]), state, "invalid program result name");
- YYERROR;
- }
- ;}
- break;
-
- case 257:
-
-/* Line 1455 of yacc.c */
-#line 2045 "program_parse.y"
- {
- if (state->mode == ARB_fragment) {
- (yyval.result) = FRAG_RESULT_DEPTH;
- } else {
- yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
- YYERROR;
- }
- ;}
- break;
-
- case 258:
-
-/* Line 1455 of yacc.c */
-#line 2056 "program_parse.y"
- {
- (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer);
- ;}
- break;
-
- case 259:
-
-/* Line 1455 of yacc.c */
-#line 2062 "program_parse.y"
- {
- (yyval.integer) = (state->mode == ARB_vertex)
- ? VERT_RESULT_COL0
- : FRAG_RESULT_COLOR;
- ;}
- break;
-
- case 260:
-
-/* Line 1455 of yacc.c */
-#line 2068 "program_parse.y"
- {
- if (state->mode == ARB_vertex) {
- (yyval.integer) = VERT_RESULT_COL0;
- } else {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
- YYERROR;
- }
- ;}
- break;
-
- case 261:
-
-/* Line 1455 of yacc.c */
-#line 2077 "program_parse.y"
- {
- if (state->mode == ARB_vertex) {
- (yyval.integer) = VERT_RESULT_BFC0;
- } else {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
- YYERROR;
- }
- ;}
- break;
-
- case 262:
-
-/* Line 1455 of yacc.c */
-#line 2088 "program_parse.y"
- {
- (yyval.integer) = 0;
- ;}
- break;
-
- case 263:
-
-/* Line 1455 of yacc.c */
-#line 2092 "program_parse.y"
- {
- if (state->mode == ARB_vertex) {
- (yyval.integer) = 0;
- } else {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
- YYERROR;
- }
- ;}
- break;
-
- case 264:
-
-/* Line 1455 of yacc.c */
-#line 2101 "program_parse.y"
- {
- if (state->mode == ARB_vertex) {
- (yyval.integer) = 1;
- } else {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
- YYERROR;
- }
- ;}
- break;
-
- case 265:
-
-/* Line 1455 of yacc.c */
-#line 2111 "program_parse.y"
- { (yyval.integer) = 0; ;}
- break;
-
- case 266:
-
-/* Line 1455 of yacc.c */
-#line 2112 "program_parse.y"
- { (yyval.integer) = 0; ;}
- break;
-
- case 267:
-
-/* Line 1455 of yacc.c */
-#line 2113 "program_parse.y"
- { (yyval.integer) = 1; ;}
- break;
-
- case 268:
-
-/* Line 1455 of yacc.c */
-#line 2116 "program_parse.y"
- { (yyval.integer) = 0; ;}
- break;
-
- case 269:
-
-/* Line 1455 of yacc.c */
-#line 2117 "program_parse.y"
- { (yyval.integer) = 0; ;}
- break;
-
- case 270:
-
-/* Line 1455 of yacc.c */
-#line 2118 "program_parse.y"
- { (yyval.integer) = 1; ;}
- break;
-
- case 271:
-
-/* Line 1455 of yacc.c */
-#line 2121 "program_parse.y"
- { (yyval.integer) = 0; ;}
- break;
-
- case 272:
-
-/* Line 1455 of yacc.c */
-#line 2122 "program_parse.y"
- { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
- break;
-
- case 273:
-
-/* Line 1455 of yacc.c */
-#line 2125 "program_parse.y"
- { (yyval.integer) = 0; ;}
- break;
-
- case 274:
-
-/* Line 1455 of yacc.c */
-#line 2126 "program_parse.y"
- { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
- break;
-
- case 275:
-
-/* Line 1455 of yacc.c */
-#line 2129 "program_parse.y"
- { (yyval.integer) = 0; ;}
- break;
-
- case 276:
-
-/* Line 1455 of yacc.c */
-#line 2130 "program_parse.y"
- { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
- break;
-
- case 277:
-
-/* Line 1455 of yacc.c */
-#line 2134 "program_parse.y"
- {
- if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector");
- YYERROR;
- }
-
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 278:
-
-/* Line 1455 of yacc.c */
-#line 2145 "program_parse.y"
- {
- if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector");
- YYERROR;
- }
-
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 279:
-
-/* Line 1455 of yacc.c */
-#line 2156 "program_parse.y"
- {
- if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) {
- yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector");
- YYERROR;
- }
-
- (yyval.integer) = (yyvsp[(1) - (1)].integer);
- ;}
- break;
-
- case 280:
-
-/* Line 1455 of yacc.c */
-#line 2167 "program_parse.y"
- {
- struct asm_symbol *exist = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string));
- struct asm_symbol *target = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(4) - (4)].string));
-
- free((yyvsp[(4) - (4)].string));
-
- if (exist != NULL) {
- char m[1000];
- _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", (yyvsp[(2) - (4)].string));
- free((yyvsp[(2) - (4)].string));
- yyerror(& (yylsp[(2) - (4)]), state, m);
- YYERROR;
- } else if (target == NULL) {
- free((yyvsp[(2) - (4)].string));
- yyerror(& (yylsp[(4) - (4)]), state,
- "undefined variable binding in ALIAS statement");
- YYERROR;
- } else {
- _mesa_symbol_table_add_symbol(state->st, 0, (yyvsp[(2) - (4)].string), target);
- }
- ;}
- break;
-
-
-
-/* Line 1455 of yacc.c */
-#line 4938 "program_parse.tab.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, 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[0] = 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[0] = 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[0] = *yylsp;
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp, yylsp, state);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- *++yyvsp = yylval;
-
- yyerror_range[1] = yylloc;
- /* Using YYLLOC is tempting, but would change the location of
- the lookahead. YYLOC is available though. */
- YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 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);
-}
-
-
-
-/* Line 1675 of yacc.c */
-#line 2196 "program_parse.y"
-
-
-void
-asm_instruction_set_operands(struct asm_instruction *inst,
- const struct prog_dst_register *dst,
- const struct asm_src_register *src0,
- const struct asm_src_register *src1,
- const struct asm_src_register *src2)
-{
- /* In the core ARB extensions only the KIL instruction doesn't have a
- * destination register.
- */
- if (dst == NULL) {
- init_dst_reg(& inst->Base.DstReg);
- } else {
- inst->Base.DstReg = *dst;
- }
-
- /* The only instruction that doesn't have any source registers is the
- * condition-code based KIL instruction added by NV_fragment_program_option.
- */
- if (src0 != NULL) {
- inst->Base.SrcReg[0] = src0->Base;
- inst->SrcReg[0] = *src0;
- } else {
- init_src_reg(& inst->SrcReg[0]);
- }
-
- if (src1 != NULL) {
- inst->Base.SrcReg[1] = src1->Base;
- inst->SrcReg[1] = *src1;
- } else {
- init_src_reg(& inst->SrcReg[1]);
- }
-
- if (src2 != NULL) {
- inst->Base.SrcReg[2] = src2->Base;
- inst->SrcReg[2] = *src2;
- } else {
- init_src_reg(& inst->SrcReg[2]);
- }
-}
-
-
-struct asm_instruction *
-asm_instruction_ctor(gl_inst_opcode op,
- const struct prog_dst_register *dst,
- const struct asm_src_register *src0,
- const struct asm_src_register *src1,
- const struct asm_src_register *src2)
-{
- struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
-
- if (inst) {
- _mesa_init_instructions(& inst->Base, 1);
- inst->Base.Opcode = op;
-
- asm_instruction_set_operands(inst, dst, src0, src1, src2);
- }
-
- return inst;
-}
-
-
-struct asm_instruction *
-asm_instruction_copy_ctor(const struct prog_instruction *base,
- const struct prog_dst_register *dst,
- const struct asm_src_register *src0,
- const struct asm_src_register *src1,
- const struct asm_src_register *src2)
-{
- struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
-
- if (inst) {
- _mesa_init_instructions(& inst->Base, 1);
- inst->Base.Opcode = base->Opcode;
- inst->Base.CondUpdate = base->CondUpdate;
- inst->Base.CondDst = base->CondDst;
- inst->Base.SaturateMode = base->SaturateMode;
- inst->Base.Precision = base->Precision;
-
- asm_instruction_set_operands(inst, dst, src0, src1, src2);
- }
-
- return inst;
-}
-
-
-void
-init_dst_reg(struct prog_dst_register *r)
-{
- memset(r, 0, sizeof(*r));
- r->File = PROGRAM_UNDEFINED;
- r->WriteMask = WRITEMASK_XYZW;
- r->CondMask = COND_TR;
- r->CondSwizzle = SWIZZLE_NOOP;
-}
-
-
-/** Like init_dst_reg() but set the File and Index fields. */
-void
-set_dst_reg(struct prog_dst_register *r, gl_register_file file, GLint index)
-{
- const GLint maxIndex = 1 << INST_INDEX_BITS;
- const GLint minIndex = 0;
- ASSERT(index >= minIndex);
- (void) minIndex;
- ASSERT(index <= maxIndex);
- (void) maxIndex;
- ASSERT(file == PROGRAM_TEMPORARY ||
- file == PROGRAM_ADDRESS ||
- file == PROGRAM_OUTPUT);
- memset(r, 0, sizeof(*r));
- r->File = file;
- r->Index = index;
- r->WriteMask = WRITEMASK_XYZW;
- r->CondMask = COND_TR;
- r->CondSwizzle = SWIZZLE_NOOP;
-}
-
-
-void
-init_src_reg(struct asm_src_register *r)
-{
- memset(r, 0, sizeof(*r));
- r->Base.File = PROGRAM_UNDEFINED;
- r->Base.Swizzle = SWIZZLE_NOOP;
- r->Symbol = NULL;
-}
-
-
-/** Like init_src_reg() but set the File and Index fields.
- * \return GL_TRUE if a valid src register, GL_FALSE otherwise
- */
-void
-set_src_reg(struct asm_src_register *r, gl_register_file file, GLint index)
-{
- set_src_reg_swz(r, file, index, SWIZZLE_XYZW);
-}
-
-
-void
-set_src_reg_swz(struct asm_src_register *r, gl_register_file file, GLint index,
- GLuint swizzle)
-{
- const GLint maxIndex = (1 << INST_INDEX_BITS) - 1;
- const GLint minIndex = -(1 << INST_INDEX_BITS);
- ASSERT(file < PROGRAM_FILE_MAX);
- ASSERT(index >= minIndex);
- (void) minIndex;
- ASSERT(index <= maxIndex);
- (void) maxIndex;
- memset(r, 0, sizeof(*r));
- r->Base.File = file;
- r->Base.Index = index;
- r->Base.Swizzle = swizzle;
- r->Symbol = NULL;
-}
-
-
-/**
- * Validate the set of inputs used by a program
- *
- * Validates that legal sets of inputs are used by the program. In this case
- * "used" included both reading the input or binding the input to a name using
- * the \c ATTRIB command.
- *
- * \return
- * \c TRUE if the combination of inputs used is valid, \c FALSE otherwise.
- */
-int
-validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state)
-{
- const int inputs = state->prog->InputsRead | state->InputsBound;
-
- if (((inputs & 0x0ffff) & (inputs >> 16)) != 0) {
- yyerror(locp, state, "illegal use of generic attribute and name attribute");
- return 0;
- }
-
- return 1;
-}
-
-
-struct asm_symbol *
-declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
- struct YYLTYPE *locp)
-{
- struct asm_symbol *s = NULL;
- struct asm_symbol *exist = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, name);
-
-
- if (exist != NULL) {
- yyerror(locp, state, "redeclared identifier");
- } else {
- s = calloc(1, sizeof(struct asm_symbol));
- s->name = name;
- s->type = t;
-
- switch (t) {
- case at_temp:
- if (state->prog->NumTemporaries >= state->limits->MaxTemps) {
- yyerror(locp, state, "too many temporaries declared");
- free(s);
- return NULL;
- }
-
- s->temp_binding = state->prog->NumTemporaries;
- state->prog->NumTemporaries++;
- break;
-
- case at_address:
- if (state->prog->NumAddressRegs >= state->limits->MaxAddressRegs) {
- yyerror(locp, state, "too many address registers declared");
- free(s);
- return NULL;
- }
-
- /* FINISHME: Add support for multiple address registers.
- */
- state->prog->NumAddressRegs++;
- break;
-
- default:
- break;
- }
-
- _mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
- s->next = state->sym;
- state->sym = s;
- }
-
- return s;
-}
-
-
-int add_state_reference(struct gl_program_parameter_list *param_list,
- const gl_state_index tokens[STATE_LENGTH])
-{
- const GLuint size = 4; /* XXX fix */
- char *name;
- GLint index;
-
- name = _mesa_program_state_string(tokens);
- index = _mesa_add_parameter(param_list, PROGRAM_STATE_VAR, name,
- size, GL_NONE, NULL, tokens, 0x0);
- param_list->StateFlags |= _mesa_program_state_flags(tokens);
-
- /* free name string here since we duplicated it in add_parameter() */
- free(name);
-
- return index;
-}
-
-
-int
-initialize_symbol_from_state(struct gl_program *prog,
- struct asm_symbol *param_var,
- const gl_state_index tokens[STATE_LENGTH])
-{
- int idx = -1;
- gl_state_index state_tokens[STATE_LENGTH];
-
-
- memcpy(state_tokens, tokens, sizeof(state_tokens));
-
- param_var->type = at_param;
- param_var->param_binding_type = PROGRAM_STATE_VAR;
-
- /* If we are adding a STATE_MATRIX that has multiple rows, we need to
- * unroll it and call add_state_reference() for each row
- */
- if ((state_tokens[0] == STATE_MODELVIEW_MATRIX ||
- state_tokens[0] == STATE_PROJECTION_MATRIX ||
- state_tokens[0] == STATE_MVP_MATRIX ||
- state_tokens[0] == STATE_TEXTURE_MATRIX ||
- state_tokens[0] == STATE_PROGRAM_MATRIX)
- && (state_tokens[2] != state_tokens[3])) {
- int row;
- const int first_row = state_tokens[2];
- const int last_row = state_tokens[3];
-
- for (row = first_row; row <= last_row; row++) {
- state_tokens[2] = state_tokens[3] = row;
-
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
-
- param_var->param_binding_length++;
- }
- }
- else {
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
- }
-
- return idx;
-}
-
-
-int
-initialize_symbol_from_param(struct gl_program *prog,
- struct asm_symbol *param_var,
- const gl_state_index tokens[STATE_LENGTH])
-{
- int idx = -1;
- gl_state_index state_tokens[STATE_LENGTH];
-
-
- memcpy(state_tokens, tokens, sizeof(state_tokens));
-
- assert((state_tokens[0] == STATE_VERTEX_PROGRAM)
- || (state_tokens[0] == STATE_FRAGMENT_PROGRAM));
- assert((state_tokens[1] == STATE_ENV)
- || (state_tokens[1] == STATE_LOCAL));
-
- /*
- * The param type is STATE_VAR. The program parameter entry will
- * effectively be a pointer into the LOCAL or ENV parameter array.
- */
- param_var->type = at_param;
- param_var->param_binding_type = PROGRAM_STATE_VAR;
-
- /* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
- * we need to unroll it and call add_state_reference() for each row
- */
- if (state_tokens[2] != state_tokens[3]) {
- int row;
- const int first_row = state_tokens[2];
- const int last_row = state_tokens[3];
-
- for (row = first_row; row <= last_row; row++) {
- state_tokens[2] = state_tokens[3] = row;
-
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
- }
- }
- else {
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
- }
-
- return idx;
-}
-
-
-/**
- * Put a float/vector constant/literal into the parameter list.
- * \param param_var returns info about the parameter/constant's location,
- * binding, type, etc.
- * \param vec the vector/constant to add
- * \param allowSwizzle if true, try to consolidate constants which only differ
- * by a swizzle. We don't want to do this when building
- * arrays of constants that may be indexed indirectly.
- * \return index of the constant in the parameter list.
- */
-int
-initialize_symbol_from_const(struct gl_program *prog,
- struct asm_symbol *param_var,
- const struct asm_vector *vec,
- GLboolean allowSwizzle)
-{
- unsigned swizzle;
- const int idx = _mesa_add_unnamed_constant(prog->Parameters,
- vec->data, vec->count,
- allowSwizzle ? &swizzle : NULL);
-
- param_var->type = at_param;
- param_var->param_binding_type = PROGRAM_CONSTANT;
-
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = allowSwizzle ? swizzle : SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
-
- return idx;
-}
-
-
-char *
-make_error_string(const char *fmt, ...)
-{
- int length;
- char *str;
- va_list args;
-
-
- /* Call vsnprintf once to determine how large the final string is. Call it
- * 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);
- }
-
- return str;
-}
-
-
-void
-yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
-{
- char *err_str;
-
-
- err_str = make_error_string("glProgramStringARB(%s)\n", s);
- if (err_str) {
- _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str);
- free(err_str);
- }
-
- err_str = make_error_string("line %u, char %u: error: %s\n",
- locp->first_line, locp->first_column, s);
- _mesa_set_program_error(state->ctx, locp->position, err_str);
-
- if (err_str) {
- free(err_str);
- }
-}
-
-
-GLboolean
-_mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *str,
- GLsizei len, struct asm_parser_state *state)
-{
- struct asm_instruction *inst;
- unsigned i;
- GLubyte *strz;
- GLboolean result = GL_FALSE;
- void *temp;
- struct asm_symbol *sym;
-
- state->ctx = ctx;
- state->prog->Target = target;
- state->prog->Parameters = _mesa_new_parameter_list();
-
- /* Make a copy of the program string and force it to be NUL-terminated.
- */
- strz = (GLubyte *) malloc(len + 1);
- if (strz == NULL) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
- return GL_FALSE;
- }
- memcpy (strz, str, len);
- strz[len] = '\0';
-
- state->prog->String = strz;
-
- state->st = _mesa_symbol_table_ctor();
-
- state->limits = (target == GL_VERTEX_PROGRAM_ARB)
- ? & ctx->Const.VertexProgram
- : & ctx->Const.FragmentProgram;
-
- state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
- state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
- state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
- state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
- state->MaxLights = ctx->Const.MaxLights;
- state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
-
- state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
- ? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
-
- _mesa_set_program_error(ctx, -1, NULL);
-
- _mesa_program_lexer_ctor(& state->scanner, state, (const char *) str, len);
- yyparse(state);
- _mesa_program_lexer_dtor(state->scanner);
-
-
- if (ctx->Program.ErrorPos != -1) {
- goto error;
- }
-
- if (! _mesa_layout_parameters(state)) {
- struct YYLTYPE loc;
-
- loc.first_line = 0;
- loc.first_column = 0;
- loc.position = len;
-
- yyerror(& loc, state, "invalid PARAM usage");
- goto error;
- }
-
-
-
- /* Add one instruction to store the "END" instruction.
- */
- state->prog->Instructions =
- _mesa_alloc_instructions(state->prog->NumInstructions + 1);
- inst = state->inst_head;
- for (i = 0; i < state->prog->NumInstructions; i++) {
- struct asm_instruction *const temp = inst->next;
-
- state->prog->Instructions[i] = inst->Base;
- inst = temp;
- }
-
- /* Finally, tag on an OPCODE_END instruction */
- {
- const GLuint numInst = state->prog->NumInstructions;
- _mesa_init_instructions(state->prog->Instructions + numInst, 1);
- state->prog->Instructions[numInst].Opcode = OPCODE_END;
- }
- state->prog->NumInstructions++;
-
- state->prog->NumParameters = state->prog->Parameters->NumParameters;
- state->prog->NumAttributes = _mesa_bitcount(state->prog->InputsRead);
-
- /*
- * Initialize native counts to logical counts. The device driver may
- * change them if program is translated into a hardware program.
- */
- state->prog->NumNativeInstructions = state->prog->NumInstructions;
- state->prog->NumNativeTemporaries = state->prog->NumTemporaries;
- state->prog->NumNativeParameters = state->prog->NumParameters;
- state->prog->NumNativeAttributes = state->prog->NumAttributes;
- state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs;
-
- result = GL_TRUE;
-
-error:
- for (inst = state->inst_head; inst != NULL; inst = temp) {
- temp = inst->next;
- free(inst);
- }
-
- state->inst_head = NULL;
- state->inst_tail = NULL;
-
- for (sym = state->sym; sym != NULL; sym = temp) {
- temp = sym->next;
-
- free((void *) sym->name);
- free(sym);
- }
- state->sym = NULL;
-
- _mesa_symbol_table_dtor(state->st);
- state->st = NULL;
-
- return result;
-}
-
diff --git a/src/mesa/program/program_parse.tab.h b/src/mesa/program/program_parse.tab.h
deleted file mode 100644
index 045241d..0000000
--- a/src/mesa/program/program_parse.tab.h
+++ /dev/null
@@ -1,209 +0,0 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1. */
-
-/* Skeleton interface for Bison's Yacc-like parsers in C
-
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- 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 {
- ARBvp_10 = 258,
- ARBfp_10 = 259,
- ADDRESS = 260,
- ALIAS = 261,
- ATTRIB = 262,
- OPTION = 263,
- OUTPUT = 264,
- PARAM = 265,
- TEMP = 266,
- END = 267,
- BIN_OP = 268,
- BINSC_OP = 269,
- SAMPLE_OP = 270,
- SCALAR_OP = 271,
- TRI_OP = 272,
- VECTOR_OP = 273,
- ARL = 274,
- KIL = 275,
- SWZ = 276,
- TXD_OP = 277,
- INTEGER = 278,
- REAL = 279,
- AMBIENT = 280,
- ATTENUATION = 281,
- BACK = 282,
- CLIP = 283,
- COLOR = 284,
- DEPTH = 285,
- DIFFUSE = 286,
- DIRECTION = 287,
- EMISSION = 288,
- ENV = 289,
- EYE = 290,
- FOG = 291,
- FOGCOORD = 292,
- FRAGMENT = 293,
- FRONT = 294,
- HALF = 295,
- INVERSE = 296,
- INVTRANS = 297,
- LIGHT = 298,
- LIGHTMODEL = 299,
- LIGHTPROD = 300,
- LOCAL = 301,
- MATERIAL = 302,
- MAT_PROGRAM = 303,
- MATRIX = 304,
- MATRIXINDEX = 305,
- MODELVIEW = 306,
- MVP = 307,
- NORMAL = 308,
- OBJECT = 309,
- PALETTE = 310,
- PARAMS = 311,
- PLANE = 312,
- POINT_TOK = 313,
- POINTSIZE = 314,
- POSITION = 315,
- PRIMARY = 316,
- PROGRAM = 317,
- PROJECTION = 318,
- RANGE = 319,
- RESULT = 320,
- ROW = 321,
- SCENECOLOR = 322,
- SECONDARY = 323,
- SHININESS = 324,
- SIZE_TOK = 325,
- SPECULAR = 326,
- SPOT = 327,
- STATE = 328,
- TEXCOORD = 329,
- TEXENV = 330,
- TEXGEN = 331,
- TEXGEN_Q = 332,
- TEXGEN_R = 333,
- TEXGEN_S = 334,
- TEXGEN_T = 335,
- TEXTURE = 336,
- TRANSPOSE = 337,
- TEXTURE_UNIT = 338,
- TEX_1D = 339,
- TEX_2D = 340,
- TEX_3D = 341,
- TEX_CUBE = 342,
- TEX_RECT = 343,
- TEX_SHADOW1D = 344,
- TEX_SHADOW2D = 345,
- TEX_SHADOWRECT = 346,
- TEX_ARRAY1D = 347,
- TEX_ARRAY2D = 348,
- TEX_ARRAYSHADOW1D = 349,
- TEX_ARRAYSHADOW2D = 350,
- VERTEX = 351,
- VTXATTRIB = 352,
- WEIGHT = 353,
- IDENTIFIER = 354,
- USED_IDENTIFIER = 355,
- MASK4 = 356,
- MASK3 = 357,
- MASK2 = 358,
- MASK1 = 359,
- SWIZZLE = 360,
- DOT_DOT = 361,
- DOT = 362
- };
-#endif
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
-
-/* Line 1676 of yacc.c */
-#line 126 "program_parse.y"
-
- struct asm_instruction *inst;
- struct asm_symbol *sym;
- struct asm_symbol temp_sym;
- struct asm_swizzle_mask swiz_mask;
- struct asm_src_register src_reg;
- struct prog_dst_register dst_reg;
- struct prog_instruction temp_inst;
- char *string;
- unsigned result;
- unsigned attrib;
- int integer;
- float real;
- gl_state_index state[STATE_LENGTH];
- int negate;
- struct asm_vector vector;
- gl_inst_opcode opcode;
-
- struct {
- unsigned swz;
- unsigned rgba_valid:1;
- unsigned xyzw_valid:1;
- unsigned negate:1;
- } ext_swizzle;
-
-
-
-/* Line 1676 of yacc.c */
-#line 187 "program_parse.tab.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/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
deleted file mode 100644
index 784ea28..0000000
--- a/src/mesa/program/program_parse.y
+++ /dev/null
@@ -1,2768 +0,0 @@
-%{
-/*
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "main/mtypes.h"
-#include "main/imports.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 "program/symbol_table.h"
-#include "program/program_parser.h"
-
-extern void *yy_scan_string(char *);
-extern void yy_delete_buffer(void *);
-
-static struct asm_symbol *declare_variable(struct asm_parser_state *state,
- char *name, enum asm_type t, struct YYLTYPE *locp);
-
-static int add_state_reference(struct gl_program_parameter_list *param_list,
- const gl_state_index tokens[STATE_LENGTH]);
-
-static int initialize_symbol_from_state(struct gl_program *prog,
- struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
-
-static int initialize_symbol_from_param(struct gl_program *prog,
- struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
-
-static int initialize_symbol_from_const(struct gl_program *prog,
- struct asm_symbol *param_var, const struct asm_vector *vec,
- GLboolean allowSwizzle);
-
-static int yyparse(struct asm_parser_state *state);
-
-static char *make_error_string(const char *fmt, ...);
-
-static void yyerror(struct YYLTYPE *locp, struct asm_parser_state *state,
- const char *s);
-
-static int validate_inputs(struct YYLTYPE *locp,
- struct asm_parser_state *state);
-
-static void init_dst_reg(struct prog_dst_register *r);
-
-static void set_dst_reg(struct prog_dst_register *r,
- gl_register_file file, GLint index);
-
-static void init_src_reg(struct asm_src_register *r);
-
-static void set_src_reg(struct asm_src_register *r,
- gl_register_file file, GLint index);
-
-static void set_src_reg_swz(struct asm_src_register *r,
- gl_register_file file, GLint index, GLuint swizzle);
-
-static void asm_instruction_set_operands(struct asm_instruction *inst,
- const struct prog_dst_register *dst, const struct asm_src_register *src0,
- const struct asm_src_register *src1, const struct asm_src_register *src2);
-
-static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
- const struct prog_dst_register *dst, const struct asm_src_register *src0,
- const struct asm_src_register *src1, const struct asm_src_register *src2);
-
-static struct asm_instruction *asm_instruction_copy_ctor(
- const struct prog_instruction *base, const struct prog_dst_register *dst,
- const struct asm_src_register *src0, const struct asm_src_register *src1,
- const struct asm_src_register *src2);
-
-#ifndef FALSE
-#define FALSE 0
-#define TRUE (!FALSE)
-#endif
-
-#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).position = YYRHSLOC(Rhs, 1).position; \
- (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC(Rhs, N).last_column; \
- } else { \
- (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
- (Current).last_line = (Current).first_line; \
- (Current).first_column = YYRHSLOC(Rhs, 0).last_column; \
- (Current).last_column = (Current).first_column; \
- (Current).position = YYRHSLOC(Rhs, 0).position \
- + (Current).first_column; \
- } \
- } while(YYID(0))
-
-#define YYLEX_PARAM state->scanner
-%}
-
-%pure-parser
-%locations
-%parse-param { struct asm_parser_state *state }
-%error-verbose
-%lex-param { void *scanner }
-
-%union {
- struct asm_instruction *inst;
- struct asm_symbol *sym;
- struct asm_symbol temp_sym;
- struct asm_swizzle_mask swiz_mask;
- struct asm_src_register src_reg;
- struct prog_dst_register dst_reg;
- struct prog_instruction temp_inst;
- char *string;
- unsigned result;
- unsigned attrib;
- int integer;
- float real;
- gl_state_index state[STATE_LENGTH];
- int negate;
- struct asm_vector vector;
- gl_inst_opcode opcode;
-
- struct {
- unsigned swz;
- unsigned rgba_valid:1;
- unsigned xyzw_valid:1;
- unsigned negate:1;
- } ext_swizzle;
-}
-
-%token ARBvp_10 ARBfp_10
-
-/* Tokens for assembler pseudo-ops */
-%token <integer> ADDRESS
-%token ALIAS ATTRIB
-%token OPTION OUTPUT
-%token PARAM
-%token <integer> TEMP
-%token END
-
- /* Tokens for instructions */
-%token <temp_inst> BIN_OP BINSC_OP SAMPLE_OP SCALAR_OP TRI_OP VECTOR_OP
-%token <temp_inst> ARL KIL SWZ TXD_OP
-
-%token <integer> INTEGER
-%token <real> REAL
-
-%token AMBIENT ATTENUATION
-%token BACK
-%token CLIP COLOR
-%token DEPTH DIFFUSE DIRECTION
-%token EMISSION ENV EYE
-%token FOG FOGCOORD FRAGMENT FRONT
-%token HALF
-%token INVERSE INVTRANS
-%token LIGHT LIGHTMODEL LIGHTPROD LOCAL
-%token MATERIAL MAT_PROGRAM MATRIX MATRIXINDEX MODELVIEW MVP
-%token NORMAL
-%token OBJECT
-%token PALETTE PARAMS PLANE POINT_TOK POINTSIZE POSITION PRIMARY PROGRAM PROJECTION
-%token RANGE RESULT ROW
-%token SCENECOLOR SECONDARY SHININESS SIZE_TOK SPECULAR SPOT STATE
-%token TEXCOORD TEXENV TEXGEN TEXGEN_Q TEXGEN_R TEXGEN_S TEXGEN_T TEXTURE TRANSPOSE
-%token TEXTURE_UNIT TEX_1D TEX_2D TEX_3D TEX_CUBE TEX_RECT
-%token TEX_SHADOW1D TEX_SHADOW2D TEX_SHADOWRECT
-%token TEX_ARRAY1D TEX_ARRAY2D TEX_ARRAYSHADOW1D TEX_ARRAYSHADOW2D
-%token VERTEX VTXATTRIB
-%token WEIGHT
-
-%token <string> IDENTIFIER USED_IDENTIFIER
-%type <string> string
-%token <swiz_mask> MASK4 MASK3 MASK2 MASK1 SWIZZLE
-%token DOT_DOT
-%token DOT
-
-%type <inst> instruction ALU_instruction TexInstruction
-%type <inst> ARL_instruction VECTORop_instruction
-%type <inst> SCALARop_instruction BINSCop_instruction BINop_instruction
-%type <inst> TRIop_instruction TXD_instruction SWZ_instruction SAMPLE_instruction
-%type <inst> KIL_instruction
-
-%type <dst_reg> dstReg maskedDstReg maskedAddrReg
-%type <src_reg> srcReg scalarUse scalarSrcReg swizzleSrcReg
-%type <swiz_mask> scalarSuffix swizzleSuffix extendedSwizzle
-%type <ext_swizzle> extSwizComp extSwizSel
-%type <swiz_mask> optionalMask
-
-%type <sym> progParamArray
-%type <integer> addrRegRelOffset addrRegPosOffset addrRegNegOffset
-%type <src_reg> progParamArrayMem progParamArrayAbs progParamArrayRel
-%type <sym> addrReg
-%type <swiz_mask> addrComponent addrWriteMask
-
-%type <dst_reg> ccMaskRule ccTest ccMaskRule2 ccTest2 optionalCcMask
-
-%type <result> resultBinding resultColBinding
-%type <integer> optFaceType optColorType
-%type <integer> optResultFaceType optResultColorType
-
-%type <integer> optTexImageUnitNum texImageUnitNum
-%type <integer> optTexCoordUnitNum texCoordUnitNum
-%type <integer> optLegacyTexUnitNum legacyTexUnitNum
-%type <integer> texImageUnit texTarget
-%type <integer> vtxAttribNum
-
-%type <attrib> attribBinding vtxAttribItem fragAttribItem
-
-%type <temp_sym> paramSingleInit paramSingleItemDecl
-%type <integer> optArraySize
-
-%type <state> stateSingleItem stateMultipleItem
-%type <state> stateMaterialItem
-%type <state> stateLightItem stateLightModelItem stateLightProdItem
-%type <state> stateTexGenItem stateFogItem stateClipPlaneItem statePointItem
-%type <state> stateMatrixItem stateMatrixRow stateMatrixRows
-%type <state> stateTexEnvItem stateDepthItem
-
-%type <state> stateLModProperty
-%type <state> stateMatrixName optMatrixRows
-
-%type <integer> stateMatProperty
-%type <integer> stateLightProperty stateSpotProperty
-%type <integer> stateLightNumber stateLProdProperty
-%type <integer> stateTexGenType stateTexGenCoord
-%type <integer> stateTexEnvProperty
-%type <integer> stateFogProperty
-%type <integer> stateClipPlaneNum
-%type <integer> statePointProperty
-
-%type <integer> stateOptMatModifier stateMatModifier stateMatrixRowNum
-%type <integer> stateOptModMatNum stateModMatNum statePaletteMatNum
-%type <integer> stateProgramMatNum
-
-%type <integer> ambDiffSpecProperty
-
-%type <state> programSingleItem progEnvParam progLocalParam
-%type <state> programMultipleItem progEnvParams progLocalParams
-
-%type <temp_sym> paramMultipleInit paramMultInitList paramMultipleItem
-%type <temp_sym> paramSingleItemUse
-
-%type <integer> progEnvParamNum progLocalParamNum
-%type <state> progEnvParamNums progLocalParamNums
-
-%type <vector> paramConstDecl paramConstUse
-%type <vector> paramConstScalarDecl paramConstScalarUse paramConstVector
-%type <real> signedFloatConstant
-%type <negate> optionalSign
-
-%{
-extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
- void *yyscanner);
-%}
-
-%%
-
-program: language optionSequence statementSequence END
- ;
-
-language: ARBvp_10
- {
- if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) {
- yyerror(& @1, state, "invalid fragment program header");
-
- }
- state->mode = ARB_vertex;
- }
- | ARBfp_10
- {
- if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) {
- yyerror(& @1, state, "invalid vertex program header");
- }
- state->mode = ARB_fragment;
-
- state->option.TexRect =
- (state->ctx->Extensions.NV_texture_rectangle != GL_FALSE);
- }
- ;
-
-optionSequence: optionSequence option
- |
- ;
-
-option: OPTION string ';'
- {
- int valid = 0;
-
- if (state->mode == ARB_vertex) {
- valid = _mesa_ARBvp_parse_option(state, $2);
- } else if (state->mode == ARB_fragment) {
- valid = _mesa_ARBfp_parse_option(state, $2);
- }
-
-
- free($2);
-
- if (!valid) {
- const char *const err_str = (state->mode == ARB_vertex)
- ? "invalid ARB vertex program option"
- : "invalid ARB fragment program option";
-
- yyerror(& @2, state, err_str);
- YYERROR;
- }
- }
- ;
-
-statementSequence: statementSequence statement
- |
- ;
-
-statement: instruction ';'
- {
- if ($1 != NULL) {
- if (state->inst_tail == NULL) {
- state->inst_head = $1;
- } else {
- state->inst_tail->next = $1;
- }
-
- state->inst_tail = $1;
- $1->next = NULL;
-
- state->prog->NumInstructions++;
- }
- }
- | namingStatement ';'
- ;
-
-instruction: ALU_instruction
- {
- $$ = $1;
- state->prog->NumAluInstructions++;
- }
- | TexInstruction
- {
- $$ = $1;
- state->prog->NumTexInstructions++;
- }
- ;
-
-ALU_instruction: ARL_instruction
- | VECTORop_instruction
- | SCALARop_instruction
- | BINSCop_instruction
- | BINop_instruction
- | TRIop_instruction
- | SWZ_instruction
- ;
-
-TexInstruction: SAMPLE_instruction
- | KIL_instruction
- | TXD_instruction
- ;
-
-ARL_instruction: ARL maskedAddrReg ',' scalarSrcReg
- {
- $$ = asm_instruction_ctor(OPCODE_ARL, & $2, & $4, NULL, NULL);
- }
- ;
-
-VECTORop_instruction: VECTOR_OP maskedDstReg ',' swizzleSrcReg
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL);
- }
- ;
-
-SCALARop_instruction: SCALAR_OP maskedDstReg ',' scalarSrcReg
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL);
- }
- ;
-
-BINSCop_instruction: BINSC_OP maskedDstReg ',' scalarSrcReg ',' scalarSrcReg
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, NULL);
- }
- ;
-
-
-BINop_instruction: BIN_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, NULL);
- }
- ;
-
-TRIop_instruction: TRI_OP maskedDstReg ','
- swizzleSrcReg ',' swizzleSrcReg ',' swizzleSrcReg
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, & $8);
- }
- ;
-
-SAMPLE_instruction: SAMPLE_OP maskedDstReg ',' swizzleSrcReg ',' texImageUnit ',' texTarget
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL);
- if ($$ != NULL) {
- const GLbitfield tex_mask = (1U << $6);
- GLbitfield shadow_tex = 0;
- GLbitfield target_mask = 0;
-
-
- $$->Base.TexSrcUnit = $6;
-
- if ($8 < 0) {
- shadow_tex = tex_mask;
-
- $$->Base.TexSrcTarget = -$8;
- $$->Base.TexShadow = 1;
- } else {
- $$->Base.TexSrcTarget = $8;
- }
-
- target_mask = (1U << $$->Base.TexSrcTarget);
-
- /* If this texture unit was previously accessed and that access
- * had a different texture target, generate an error.
- *
- * If this texture unit was previously accessed and that access
- * had a different shadow mode, generate an error.
- */
- if ((state->prog->TexturesUsed[$6] != 0)
- && ((state->prog->TexturesUsed[$6] != target_mask)
- || ((state->prog->ShadowSamplers & tex_mask)
- != shadow_tex))) {
- yyerror(& @8, state,
- "multiple targets used on one texture image unit");
- YYERROR;
- }
-
-
- state->prog->TexturesUsed[$6] |= target_mask;
- state->prog->ShadowSamplers |= shadow_tex;
- }
- }
- ;
-
-KIL_instruction: KIL swizzleSrcReg
- {
- $$ = asm_instruction_ctor(OPCODE_KIL, NULL, & $2, NULL, NULL);
- state->fragment.UsesKill = 1;
- }
- | KIL ccTest
- {
- $$ = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL);
- $$->Base.DstReg.CondMask = $2.CondMask;
- $$->Base.DstReg.CondSwizzle = $2.CondSwizzle;
- $$->Base.DstReg.CondSrc = $2.CondSrc;
- state->fragment.UsesKill = 1;
- }
- ;
-
-TXD_instruction: TXD_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg ',' swizzleSrcReg ',' texImageUnit ',' texTarget
- {
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, & $8);
- if ($$ != NULL) {
- const GLbitfield tex_mask = (1U << $10);
- GLbitfield shadow_tex = 0;
- GLbitfield target_mask = 0;
-
-
- $$->Base.TexSrcUnit = $10;
-
- if ($12 < 0) {
- shadow_tex = tex_mask;
-
- $$->Base.TexSrcTarget = -$12;
- $$->Base.TexShadow = 1;
- } else {
- $$->Base.TexSrcTarget = $12;
- }
-
- target_mask = (1U << $$->Base.TexSrcTarget);
-
- /* If this texture unit was previously accessed and that access
- * had a different texture target, generate an error.
- *
- * If this texture unit was previously accessed and that access
- * had a different shadow mode, generate an error.
- */
- if ((state->prog->TexturesUsed[$10] != 0)
- && ((state->prog->TexturesUsed[$10] != target_mask)
- || ((state->prog->ShadowSamplers & tex_mask)
- != shadow_tex))) {
- yyerror(& @12, state,
- "multiple targets used on one texture image unit");
- YYERROR;
- }
-
-
- state->prog->TexturesUsed[$10] |= target_mask;
- state->prog->ShadowSamplers |= shadow_tex;
- }
- }
- ;
-
-texImageUnit: TEXTURE_UNIT optTexImageUnitNum
- {
- $$ = $2;
- }
- ;
-
-texTarget: TEX_1D { $$ = TEXTURE_1D_INDEX; }
- | TEX_2D { $$ = TEXTURE_2D_INDEX; }
- | TEX_3D { $$ = TEXTURE_3D_INDEX; }
- | TEX_CUBE { $$ = TEXTURE_CUBE_INDEX; }
- | TEX_RECT { $$ = TEXTURE_RECT_INDEX; }
- | TEX_SHADOW1D { $$ = -TEXTURE_1D_INDEX; }
- | TEX_SHADOW2D { $$ = -TEXTURE_2D_INDEX; }
- | TEX_SHADOWRECT { $$ = -TEXTURE_RECT_INDEX; }
- | TEX_ARRAY1D { $$ = TEXTURE_1D_ARRAY_INDEX; }
- | TEX_ARRAY2D { $$ = TEXTURE_2D_ARRAY_INDEX; }
- | TEX_ARRAYSHADOW1D { $$ = -TEXTURE_1D_ARRAY_INDEX; }
- | TEX_ARRAYSHADOW2D { $$ = -TEXTURE_2D_ARRAY_INDEX; }
- ;
-
-SWZ_instruction: SWZ maskedDstReg ',' srcReg ',' extendedSwizzle
- {
- /* FIXME: Is this correct? Should the extenedSwizzle be applied
- * FIXME: to the existing swizzle?
- */
- $4.Base.Swizzle = $6.swizzle;
- $4.Base.Negate = $6.mask;
-
- $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL);
- }
- ;
-
-scalarSrcReg: optionalSign scalarUse
- {
- $$ = $2;
-
- if ($1) {
- $$.Base.Negate = ~$$.Base.Negate;
- }
- }
- | optionalSign '|' scalarUse '|'
- {
- $$ = $3;
-
- if (!state->option.NV_fragment) {
- yyerror(& @2, state, "unexpected character '|'");
- YYERROR;
- }
-
- if ($1) {
- $$.Base.Negate = ~$$.Base.Negate;
- }
-
- $$.Base.Abs = 1;
- }
- ;
-
-scalarUse: srcReg scalarSuffix
- {
- $$ = $1;
-
- $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle,
- $2.swizzle);
- }
- | paramConstScalarUse
- {
- struct asm_symbol temp_sym;
-
- if (!state->option.NV_fragment) {
- yyerror(& @1, state, "expected scalar suffix");
- YYERROR;
- }
-
- memset(& temp_sym, 0, sizeof(temp_sym));
- temp_sym.param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & temp_sym, & $1, GL_TRUE);
-
- set_src_reg_swz(& $$, PROGRAM_CONSTANT,
- temp_sym.param_binding_begin,
- temp_sym.param_binding_swizzle);
- }
- ;
-
-swizzleSrcReg: optionalSign srcReg swizzleSuffix
- {
- $$ = $2;
-
- if ($1) {
- $$.Base.Negate = ~$$.Base.Negate;
- }
-
- $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle,
- $3.swizzle);
- }
- | optionalSign '|' srcReg swizzleSuffix '|'
- {
- $$ = $3;
-
- if (!state->option.NV_fragment) {
- yyerror(& @2, state, "unexpected character '|'");
- YYERROR;
- }
-
- if ($1) {
- $$.Base.Negate = ~$$.Base.Negate;
- }
-
- $$.Base.Abs = 1;
- $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle,
- $4.swizzle);
- }
-
- ;
-
-maskedDstReg: dstReg optionalMask optionalCcMask
- {
- $$ = $1;
- $$.WriteMask = $2.mask;
- $$.CondMask = $3.CondMask;
- $$.CondSwizzle = $3.CondSwizzle;
- $$.CondSrc = $3.CondSrc;
-
- if ($$.File == PROGRAM_OUTPUT) {
- /* Technically speaking, this should check that it is in
- * vertex program mode. However, PositionInvariant can never be
- * set in fragment program mode, so it is somewhat irrelevant.
- */
- if (state->option.PositionInvariant
- && ($$.Index == VERT_RESULT_HPOS)) {
- yyerror(& @1, state, "position-invariant programs cannot "
- "write position");
- YYERROR;
- }
-
- state->prog->OutputsWritten |= BITFIELD64_BIT($$.Index);
- }
- }
- ;
-
-maskedAddrReg: addrReg addrWriteMask
- {
- set_dst_reg(& $$, PROGRAM_ADDRESS, 0);
- $$.WriteMask = $2.mask;
- }
- ;
-
-extendedSwizzle: extSwizComp ',' extSwizComp ',' extSwizComp ',' extSwizComp
- {
- const unsigned xyzw_valid =
- ($1.xyzw_valid << 0)
- | ($3.xyzw_valid << 1)
- | ($5.xyzw_valid << 2)
- | ($7.xyzw_valid << 3);
- const unsigned rgba_valid =
- ($1.rgba_valid << 0)
- | ($3.rgba_valid << 1)
- | ($5.rgba_valid << 2)
- | ($7.rgba_valid << 3);
-
- /* All of the swizzle components have to be valid in either RGBA
- * or XYZW. Note that 0 and 1 are valid in both, so both masks
- * can have some bits set.
- *
- * We somewhat deviate from the spec here. It would be really hard
- * to figure out which component is the error, and there probably
- * isn't a lot of benefit.
- */
- if ((rgba_valid != 0x0f) && (xyzw_valid != 0x0f)) {
- yyerror(& @1, state, "cannot combine RGBA and XYZW swizzle "
- "components");
- YYERROR;
- }
-
- $$.swizzle = MAKE_SWIZZLE4($1.swz, $3.swz, $5.swz, $7.swz);
- $$.mask = ($1.negate) | ($3.negate << 1) | ($5.negate << 2)
- | ($7.negate << 3);
- }
- ;
-
-extSwizComp: optionalSign extSwizSel
- {
- $$ = $2;
- $$.negate = ($1) ? 1 : 0;
- }
- ;
-
-extSwizSel: INTEGER
- {
- if (($1 != 0) && ($1 != 1)) {
- yyerror(& @1, state, "invalid extended swizzle selector");
- YYERROR;
- }
-
- $$.swz = ($1 == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE;
-
- /* 0 and 1 are valid for both RGBA swizzle names and XYZW
- * swizzle names.
- */
- $$.xyzw_valid = 1;
- $$.rgba_valid = 1;
- }
- | string
- {
- char s;
-
- if (strlen($1) > 1) {
- yyerror(& @1, state, "invalid extended swizzle selector");
- YYERROR;
- }
-
- s = $1[0];
- free($1);
-
- switch (s) {
- case 'x':
- $$.swz = SWIZZLE_X;
- $$.xyzw_valid = 1;
- break;
- case 'y':
- $$.swz = SWIZZLE_Y;
- $$.xyzw_valid = 1;
- break;
- case 'z':
- $$.swz = SWIZZLE_Z;
- $$.xyzw_valid = 1;
- break;
- case 'w':
- $$.swz = SWIZZLE_W;
- $$.xyzw_valid = 1;
- break;
-
- case 'r':
- $$.swz = SWIZZLE_X;
- $$.rgba_valid = 1;
- break;
- case 'g':
- $$.swz = SWIZZLE_Y;
- $$.rgba_valid = 1;
- break;
- case 'b':
- $$.swz = SWIZZLE_Z;
- $$.rgba_valid = 1;
- break;
- case 'a':
- $$.swz = SWIZZLE_W;
- $$.rgba_valid = 1;
- break;
-
- default:
- yyerror(& @1, state, "invalid extended swizzle selector");
- YYERROR;
- break;
- }
- }
- ;
-
-srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */
- {
- struct asm_symbol *const s = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $1);
-
- free($1);
-
- if (s == NULL) {
- yyerror(& @1, state, "invalid operand variable");
- YYERROR;
- } else if ((s->type != at_param) && (s->type != at_temp)
- && (s->type != at_attrib)) {
- yyerror(& @1, state, "invalid operand variable");
- YYERROR;
- } else if ((s->type == at_param) && s->param_is_array) {
- yyerror(& @1, state, "non-array access to array PARAM");
- YYERROR;
- }
-
- init_src_reg(& $$);
- switch (s->type) {
- case at_temp:
- set_src_reg(& $$, PROGRAM_TEMPORARY, s->temp_binding);
- break;
- case at_param:
- set_src_reg_swz(& $$, s->param_binding_type,
- s->param_binding_begin,
- s->param_binding_swizzle);
- break;
- case at_attrib:
- set_src_reg(& $$, PROGRAM_INPUT, s->attrib_binding);
- state->prog->InputsRead |= (1U << $$.Base.Index);
-
- if (!validate_inputs(& @1, state)) {
- YYERROR;
- }
- break;
-
- default:
- YYERROR;
- break;
- }
- }
- | attribBinding
- {
- set_src_reg(& $$, PROGRAM_INPUT, $1);
- state->prog->InputsRead |= (1U << $$.Base.Index);
-
- if (!validate_inputs(& @1, state)) {
- YYERROR;
- }
- }
- | progParamArray '[' progParamArrayMem ']'
- {
- if (! $3.Base.RelAddr
- && ((unsigned) $3.Base.Index >= $1->param_binding_length)) {
- yyerror(& @3, state, "out of bounds array access");
- YYERROR;
- }
-
- init_src_reg(& $$);
- $$.Base.File = $1->param_binding_type;
-
- if ($3.Base.RelAddr) {
- state->prog->IndirectRegisterFiles |= (1 << $$.Base.File);
- $1->param_accessed_indirectly = 1;
-
- $$.Base.RelAddr = 1;
- $$.Base.Index = $3.Base.Index;
- $$.Symbol = $1;
- } else {
- $$.Base.Index = $1->param_binding_begin + $3.Base.Index;
- }
- }
- | paramSingleItemUse
- {
- gl_register_file file = ($1.name != NULL)
- ? $1.param_binding_type
- : PROGRAM_CONSTANT;
- set_src_reg_swz(& $$, file, $1.param_binding_begin,
- $1.param_binding_swizzle);
- }
- ;
-
-dstReg: resultBinding
- {
- set_dst_reg(& $$, PROGRAM_OUTPUT, $1);
- }
- | USED_IDENTIFIER /* temporaryReg | vertexResultReg */
- {
- struct asm_symbol *const s = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $1);
-
- free($1);
-
- if (s == NULL) {
- yyerror(& @1, state, "invalid operand variable");
- YYERROR;
- } else if ((s->type != at_output) && (s->type != at_temp)) {
- yyerror(& @1, state, "invalid operand variable");
- YYERROR;
- }
-
- switch (s->type) {
- case at_temp:
- set_dst_reg(& $$, PROGRAM_TEMPORARY, s->temp_binding);
- break;
- case at_output:
- set_dst_reg(& $$, PROGRAM_OUTPUT, s->output_binding);
- break;
- default:
- set_dst_reg(& $$, s->param_binding_type, s->param_binding_begin);
- break;
- }
- }
- ;
-
-progParamArray: USED_IDENTIFIER
- {
- struct asm_symbol *const s = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $1);
-
- free($1);
-
- if (s == NULL) {
- yyerror(& @1, state, "invalid operand variable");
- YYERROR;
- } else if ((s->type != at_param) || !s->param_is_array) {
- yyerror(& @1, state, "array access to non-PARAM variable");
- YYERROR;
- } else {
- $$ = s;
- }
- }
- ;
-
-progParamArrayMem: progParamArrayAbs | progParamArrayRel;
-
-progParamArrayAbs: INTEGER
- {
- init_src_reg(& $$);
- $$.Base.Index = $1;
- }
- ;
-
-progParamArrayRel: addrReg addrComponent addrRegRelOffset
- {
- /* FINISHME: Add support for multiple address registers.
- */
- /* FINISHME: Add support for 4-component address registers.
- */
- init_src_reg(& $$);
- $$.Base.RelAddr = 1;
- $$.Base.Index = $3;
- }
- ;
-
-addrRegRelOffset: { $$ = 0; }
- | '+' addrRegPosOffset { $$ = $2; }
- | '-' addrRegNegOffset { $$ = -$2; }
- ;
-
-addrRegPosOffset: INTEGER
- {
- if (($1 < 0) || ($1 > 4095)) {
- char s[100];
- _mesa_snprintf(s, sizeof(s),
- "relative address offset too large (%d)", $1);
- yyerror(& @1, state, s);
- YYERROR;
- } else {
- $$ = $1;
- }
- }
- ;
-
-addrRegNegOffset: INTEGER
- {
- if (($1 < 0) || ($1 > 4096)) {
- char s[100];
- _mesa_snprintf(s, sizeof(s),
- "relative address offset too large (%d)", $1);
- yyerror(& @1, state, s);
- YYERROR;
- } else {
- $$ = $1;
- }
- }
- ;
-
-addrReg: USED_IDENTIFIER
- {
- struct asm_symbol *const s = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $1);
-
- free($1);
-
- if (s == NULL) {
- yyerror(& @1, state, "invalid array member");
- YYERROR;
- } else if (s->type != at_address) {
- yyerror(& @1, state,
- "invalid variable for indexed array access");
- YYERROR;
- } else {
- $$ = s;
- }
- }
- ;
-
-addrComponent: MASK1
- {
- if ($1.mask != WRITEMASK_X) {
- yyerror(& @1, state, "invalid address component selector");
- YYERROR;
- } else {
- $$ = $1;
- }
- }
- ;
-
-addrWriteMask: MASK1
- {
- if ($1.mask != WRITEMASK_X) {
- yyerror(& @1, state,
- "address register write mask must be \".x\"");
- YYERROR;
- } else {
- $$ = $1;
- }
- }
- ;
-
-scalarSuffix: MASK1;
-
-swizzleSuffix: MASK1
- | MASK4
- | SWIZZLE
- | { $$.swizzle = SWIZZLE_NOOP; $$.mask = WRITEMASK_XYZW; }
- ;
-
-optionalMask: MASK4 | MASK3 | MASK2 | MASK1
- | { $$.swizzle = SWIZZLE_NOOP; $$.mask = WRITEMASK_XYZW; }
- ;
-
-optionalCcMask: '(' ccTest ')'
- {
- $$ = $2;
- }
- | '(' ccTest2 ')'
- {
- $$ = $2;
- }
- |
- {
- $$.CondMask = COND_TR;
- $$.CondSwizzle = SWIZZLE_NOOP;
- $$.CondSrc = 0;
- }
- ;
-
-ccTest: ccMaskRule swizzleSuffix
- {
- $$ = $1;
- $$.CondSwizzle = $2.swizzle;
- }
- ;
-
-ccTest2: ccMaskRule2 swizzleSuffix
- {
- $$ = $1;
- $$.CondSwizzle = $2.swizzle;
- }
- ;
-
-ccMaskRule: IDENTIFIER
- {
- const int cond = _mesa_parse_cc($1);
- if ((cond == 0) || ($1[2] != '\0')) {
- char *const err_str =
- make_error_string("invalid condition code \"%s\"", $1);
-
- yyerror(& @1, state, (err_str != NULL)
- ? err_str : "invalid condition code");
-
- if (err_str != NULL) {
- free(err_str);
- }
-
- YYERROR;
- }
-
- $$.CondMask = cond;
- $$.CondSwizzle = SWIZZLE_NOOP;
- $$.CondSrc = 0;
- }
- ;
-
-ccMaskRule2: USED_IDENTIFIER
- {
- const int cond = _mesa_parse_cc($1);
- if ((cond == 0) || ($1[2] != '\0')) {
- char *const err_str =
- make_error_string("invalid condition code \"%s\"", $1);
-
- yyerror(& @1, state, (err_str != NULL)
- ? err_str : "invalid condition code");
-
- if (err_str != NULL) {
- free(err_str);
- }
-
- YYERROR;
- }
-
- $$.CondMask = cond;
- $$.CondSwizzle = SWIZZLE_NOOP;
- $$.CondSrc = 0;
- }
- ;
-
-namingStatement: ATTRIB_statement
- | PARAM_statement
- | TEMP_statement
- | ADDRESS_statement
- | OUTPUT_statement
- | ALIAS_statement
- ;
-
-ATTRIB_statement: ATTRIB IDENTIFIER '=' attribBinding
- {
- struct asm_symbol *const s =
- declare_variable(state, $2, at_attrib, & @2);
-
- if (s == NULL) {
- free($2);
- YYERROR;
- } else {
- s->attrib_binding = $4;
- state->InputsBound |= (1U << s->attrib_binding);
-
- if (!validate_inputs(& @4, state)) {
- YYERROR;
- }
- }
- }
- ;
-
-attribBinding: VERTEX vtxAttribItem
- {
- $$ = $2;
- }
- | FRAGMENT fragAttribItem
- {
- $$ = $2;
- }
- ;
-
-vtxAttribItem: POSITION
- {
- $$ = VERT_ATTRIB_POS;
- }
- | WEIGHT vtxOptWeightNum
- {
- $$ = VERT_ATTRIB_WEIGHT;
- }
- | NORMAL
- {
- $$ = VERT_ATTRIB_NORMAL;
- }
- | COLOR optColorType
- {
- if (!state->ctx->Extensions.EXT_secondary_color) {
- yyerror(& @2, state, "GL_EXT_secondary_color not supported");
- YYERROR;
- }
-
- $$ = VERT_ATTRIB_COLOR0 + $2;
- }
- | FOGCOORD
- {
- if (!state->ctx->Extensions.EXT_fog_coord) {
- yyerror(& @1, state, "GL_EXT_fog_coord not supported");
- YYERROR;
- }
-
- $$ = VERT_ATTRIB_FOG;
- }
- | TEXCOORD optTexCoordUnitNum
- {
- $$ = VERT_ATTRIB_TEX0 + $2;
- }
- | MATRIXINDEX '[' vtxWeightNum ']'
- {
- yyerror(& @1, state, "GL_ARB_matrix_palette not supported");
- YYERROR;
- }
- | VTXATTRIB '[' vtxAttribNum ']'
- {
- $$ = VERT_ATTRIB_GENERIC0 + $3;
- }
- ;
-
-vtxAttribNum: INTEGER
- {
- if ((unsigned) $1 >= state->limits->MaxAttribs) {
- yyerror(& @1, state, "invalid vertex attribute reference");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-vtxOptWeightNum: | '[' vtxWeightNum ']';
-vtxWeightNum: INTEGER;
-
-fragAttribItem: POSITION
- {
- $$ = FRAG_ATTRIB_WPOS;
- }
- | COLOR optColorType
- {
- $$ = FRAG_ATTRIB_COL0 + $2;
- }
- | FOGCOORD
- {
- $$ = FRAG_ATTRIB_FOGC;
- }
- | TEXCOORD optTexCoordUnitNum
- {
- $$ = FRAG_ATTRIB_TEX0 + $2;
- }
- ;
-
-PARAM_statement: PARAM_singleStmt | PARAM_multipleStmt;
-
-PARAM_singleStmt: PARAM IDENTIFIER paramSingleInit
- {
- struct asm_symbol *const s =
- declare_variable(state, $2, at_param, & @2);
-
- if (s == NULL) {
- free($2);
- YYERROR;
- } else {
- 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 = $3.param_binding_swizzle;
- s->param_is_array = 0;
- }
- }
- ;
-
-PARAM_multipleStmt: PARAM IDENTIFIER '[' optArraySize ']' paramMultipleInit
- {
- if (($4 != 0) && ((unsigned) $4 != $6.param_binding_length)) {
- free($2);
- yyerror(& @4, state,
- "parameter array size and number of bindings must match");
- YYERROR;
- } else {
- struct asm_symbol *const s =
- declare_variable(state, $2, $6.type, & @2);
-
- if (s == NULL) {
- free($2);
- YYERROR;
- } else {
- s->param_binding_type = $6.param_binding_type;
- s->param_binding_begin = $6.param_binding_begin;
- s->param_binding_length = $6.param_binding_length;
- s->param_binding_swizzle = SWIZZLE_XYZW;
- s->param_is_array = 1;
- }
- }
- }
- ;
-
-optArraySize:
- {
- $$ = 0;
- }
- | INTEGER
- {
- if (($1 < 1) || ((unsigned) $1 > state->limits->MaxParameters)) {
- yyerror(& @1, state, "invalid parameter array size");
- YYERROR;
- } else {
- $$ = $1;
- }
- }
- ;
-
-paramSingleInit: '=' paramSingleItemDecl
- {
- $$ = $2;
- }
- ;
-
-paramMultipleInit: '=' '{' paramMultInitList '}'
- {
- $$ = $3;
- }
- ;
-
-paramMultInitList: paramMultipleItem
- | paramMultInitList ',' paramMultipleItem
- {
- $1.param_binding_length += $3.param_binding_length;
- $$ = $1;
- }
- ;
-
-paramSingleItemDecl: stateSingleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_state(state->prog, & $$, $1);
- }
- | programSingleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_param(state->prog, & $$, $1);
- }
- | paramConstDecl
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
- }
- ;
-
-paramSingleItemUse: stateSingleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_state(state->prog, & $$, $1);
- }
- | programSingleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_param(state->prog, & $$, $1);
- }
- | paramConstUse
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
- }
- ;
-
-paramMultipleItem: stateMultipleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_state(state->prog, & $$, $1);
- }
- | programMultipleItem
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_param(state->prog, & $$, $1);
- }
- | paramConstDecl
- {
- memset(& $$, 0, sizeof($$));
- $$.param_binding_begin = ~0;
- initialize_symbol_from_const(state->prog, & $$, & $1, GL_FALSE);
- }
- ;
-
-stateMultipleItem: stateSingleItem { memcpy($$, $1, sizeof($$)); }
- | STATE stateMatrixRows { memcpy($$, $2, sizeof($$)); }
- ;
-
-stateSingleItem: STATE stateMaterialItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateLightItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateLightModelItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateLightProdItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateTexGenItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateTexEnvItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateFogItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateClipPlaneItem { memcpy($$, $2, sizeof($$)); }
- | STATE statePointItem { memcpy($$, $2, sizeof($$)); }
- | STATE stateMatrixRow { memcpy($$, $2, sizeof($$)); }
- | STATE stateDepthItem { memcpy($$, $2, sizeof($$)); }
- ;
-
-stateMaterialItem: MATERIAL optFaceType stateMatProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_MATERIAL;
- $$[1] = $2;
- $$[2] = $3;
- }
- ;
-
-stateMatProperty: ambDiffSpecProperty
- {
- $$ = $1;
- }
- | EMISSION
- {
- $$ = STATE_EMISSION;
- }
- | SHININESS
- {
- $$ = STATE_SHININESS;
- }
- ;
-
-stateLightItem: LIGHT '[' stateLightNumber ']' stateLightProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_LIGHT;
- $$[1] = $3;
- $$[2] = $5;
- }
- ;
-
-stateLightProperty: ambDiffSpecProperty
- {
- $$ = $1;
- }
- | POSITION
- {
- $$ = STATE_POSITION;
- }
- | ATTENUATION
- {
- if (!state->ctx->Extensions.EXT_point_parameters) {
- yyerror(& @1, state, "GL_ARB_point_parameters not supported");
- YYERROR;
- }
-
- $$ = STATE_ATTENUATION;
- }
- | SPOT stateSpotProperty
- {
- $$ = $2;
- }
- | HALF
- {
- $$ = STATE_HALF_VECTOR;
- }
- ;
-
-stateSpotProperty: DIRECTION
- {
- $$ = STATE_SPOT_DIRECTION;
- }
- ;
-
-stateLightModelItem: LIGHTMODEL stateLModProperty
- {
- $$[0] = $2[0];
- $$[1] = $2[1];
- }
- ;
-
-stateLModProperty: AMBIENT
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_LIGHTMODEL_AMBIENT;
- }
- | optFaceType SCENECOLOR
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_LIGHTMODEL_SCENECOLOR;
- $$[1] = $1;
- }
- ;
-
-stateLightProdItem: LIGHTPROD '[' stateLightNumber ']' optFaceType stateLProdProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_LIGHTPROD;
- $$[1] = $3;
- $$[2] = $5;
- $$[3] = $6;
- }
- ;
-
-stateLProdProperty: ambDiffSpecProperty;
-
-stateTexEnvItem: TEXENV optLegacyTexUnitNum stateTexEnvProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = $3;
- $$[1] = $2;
- }
- ;
-
-stateTexEnvProperty: COLOR
- {
- $$ = STATE_TEXENV_COLOR;
- }
- ;
-
-ambDiffSpecProperty: AMBIENT
- {
- $$ = STATE_AMBIENT;
- }
- | DIFFUSE
- {
- $$ = STATE_DIFFUSE;
- }
- | SPECULAR
- {
- $$ = STATE_SPECULAR;
- }
- ;
-
-stateLightNumber: INTEGER
- {
- if ((unsigned) $1 >= state->MaxLights) {
- yyerror(& @1, state, "invalid light selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-stateTexGenItem: TEXGEN optTexCoordUnitNum stateTexGenType stateTexGenCoord
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_TEXGEN;
- $$[1] = $2;
- $$[2] = $3 + $4;
- }
- ;
-
-stateTexGenType: EYE
- {
- $$ = STATE_TEXGEN_EYE_S;
- }
- | OBJECT
- {
- $$ = STATE_TEXGEN_OBJECT_S;
- }
- ;
-stateTexGenCoord: TEXGEN_S
- {
- $$ = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S;
- }
- | TEXGEN_T
- {
- $$ = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S;
- }
- | TEXGEN_R
- {
- $$ = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S;
- }
- | TEXGEN_Q
- {
- $$ = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S;
- }
- ;
-
-stateFogItem: FOG stateFogProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = $2;
- }
- ;
-
-stateFogProperty: COLOR
- {
- $$ = STATE_FOG_COLOR;
- }
- | PARAMS
- {
- $$ = STATE_FOG_PARAMS;
- }
- ;
-
-stateClipPlaneItem: CLIP '[' stateClipPlaneNum ']' PLANE
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_CLIPPLANE;
- $$[1] = $3;
- }
- ;
-
-stateClipPlaneNum: INTEGER
- {
- if ((unsigned) $1 >= state->MaxClipPlanes) {
- yyerror(& @1, state, "invalid clip plane selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-statePointItem: POINT_TOK statePointProperty
- {
- memset($$, 0, sizeof($$));
- $$[0] = $2;
- }
- ;
-
-statePointProperty: SIZE_TOK
- {
- $$ = STATE_POINT_SIZE;
- }
- | ATTENUATION
- {
- $$ = STATE_POINT_ATTENUATION;
- }
- ;
-
-stateMatrixRow: stateMatrixItem ROW '[' stateMatrixRowNum ']'
- {
- $$[0] = $1[0];
- $$[1] = $1[1];
- $$[2] = $4;
- $$[3] = $4;
- $$[4] = $1[2];
- }
- ;
-
-stateMatrixRows: stateMatrixItem optMatrixRows
- {
- $$[0] = $1[0];
- $$[1] = $1[1];
- $$[2] = $2[2];
- $$[3] = $2[3];
- $$[4] = $1[2];
- }
- ;
-
-optMatrixRows:
- {
- $$[2] = 0;
- $$[3] = 3;
- }
- | ROW '[' stateMatrixRowNum DOT_DOT stateMatrixRowNum ']'
- {
- /* It seems logical that the matrix row range specifier would have
- * to specify a range or more than one row (i.e., $5 > $3).
- * However, the ARB_vertex_program spec says "a program will fail
- * to load if <a> is greater than <b>." This means that $3 == $5
- * is valid.
- */
- if ($3 > $5) {
- yyerror(& @3, state, "invalid matrix row range");
- YYERROR;
- }
-
- $$[2] = $3;
- $$[3] = $5;
- }
- ;
-
-stateMatrixItem: MATRIX stateMatrixName stateOptMatModifier
- {
- $$[0] = $2[0];
- $$[1] = $2[1];
- $$[2] = $3;
- }
- ;
-
-stateOptMatModifier:
- {
- $$ = 0;
- }
- | stateMatModifier
- {
- $$ = $1;
- }
- ;
-
-stateMatModifier: INVERSE
- {
- $$ = STATE_MATRIX_INVERSE;
- }
- | TRANSPOSE
- {
- $$ = STATE_MATRIX_TRANSPOSE;
- }
- | INVTRANS
- {
- $$ = STATE_MATRIX_INVTRANS;
- }
- ;
-
-stateMatrixRowNum: INTEGER
- {
- if ($1 > 3) {
- yyerror(& @1, state, "invalid matrix row reference");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-stateMatrixName: MODELVIEW stateOptModMatNum
- {
- $$[0] = STATE_MODELVIEW_MATRIX;
- $$[1] = $2;
- }
- | PROJECTION
- {
- $$[0] = STATE_PROJECTION_MATRIX;
- $$[1] = 0;
- }
- | MVP
- {
- $$[0] = STATE_MVP_MATRIX;
- $$[1] = 0;
- }
- | TEXTURE optTexCoordUnitNum
- {
- $$[0] = STATE_TEXTURE_MATRIX;
- $$[1] = $2;
- }
- | PALETTE '[' statePaletteMatNum ']'
- {
- yyerror(& @1, state, "GL_ARB_matrix_palette not supported");
- YYERROR;
- }
- | MAT_PROGRAM '[' stateProgramMatNum ']'
- {
- $$[0] = STATE_PROGRAM_MATRIX;
- $$[1] = $3;
- }
- ;
-
-stateOptModMatNum:
- {
- $$ = 0;
- }
- | '[' stateModMatNum ']'
- {
- $$ = $2;
- }
- ;
-stateModMatNum: INTEGER
- {
- /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
- * zero is valid.
- */
- if ($1 != 0) {
- yyerror(& @1, state, "invalid modelview matrix index");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-statePaletteMatNum: INTEGER
- {
- /* Since GL_ARB_matrix_palette isn't supported, just let any value
- * through here. The error will be generated later.
- */
- $$ = $1;
- }
- ;
-stateProgramMatNum: INTEGER
- {
- if ((unsigned) $1 >= state->MaxProgramMatrices) {
- yyerror(& @1, state, "invalid program matrix selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-stateDepthItem: DEPTH RANGE
- {
- memset($$, 0, sizeof($$));
- $$[0] = STATE_DEPTH_RANGE;
- }
- ;
-
-
-programSingleItem: progEnvParam | progLocalParam;
-
-programMultipleItem: progEnvParams | progLocalParams;
-
-progEnvParams: PROGRAM ENV '[' progEnvParamNums ']'
- {
- memset($$, 0, sizeof($$));
- $$[0] = state->state_param_enum;
- $$[1] = STATE_ENV;
- $$[2] = $4[0];
- $$[3] = $4[1];
- }
- ;
-
-progEnvParamNums: progEnvParamNum
- {
- $$[0] = $1;
- $$[1] = $1;
- }
- | progEnvParamNum DOT_DOT progEnvParamNum
- {
- $$[0] = $1;
- $$[1] = $3;
- }
- ;
-
-progEnvParam: PROGRAM ENV '[' progEnvParamNum ']'
- {
- memset($$, 0, sizeof($$));
- $$[0] = state->state_param_enum;
- $$[1] = STATE_ENV;
- $$[2] = $4;
- $$[3] = $4;
- }
- ;
-
-progLocalParams: PROGRAM LOCAL '[' progLocalParamNums ']'
- {
- memset($$, 0, sizeof($$));
- $$[0] = state->state_param_enum;
- $$[1] = STATE_LOCAL;
- $$[2] = $4[0];
- $$[3] = $4[1];
- }
-
-progLocalParamNums: progLocalParamNum
- {
- $$[0] = $1;
- $$[1] = $1;
- }
- | progLocalParamNum DOT_DOT progLocalParamNum
- {
- $$[0] = $1;
- $$[1] = $3;
- }
- ;
-
-progLocalParam: PROGRAM LOCAL '[' progLocalParamNum ']'
- {
- memset($$, 0, sizeof($$));
- $$[0] = state->state_param_enum;
- $$[1] = STATE_LOCAL;
- $$[2] = $4;
- $$[3] = $4;
- }
- ;
-
-progEnvParamNum: INTEGER
- {
- if ((unsigned) $1 >= state->limits->MaxEnvParams) {
- yyerror(& @1, state, "invalid environment parameter reference");
- YYERROR;
- }
- $$ = $1;
- }
- ;
-
-progLocalParamNum: INTEGER
- {
- if ((unsigned) $1 >= state->limits->MaxLocalParams) {
- yyerror(& @1, state, "invalid local parameter reference");
- YYERROR;
- }
- $$ = $1;
- }
- ;
-
-
-
-paramConstDecl: paramConstScalarDecl | paramConstVector;
-paramConstUse: paramConstScalarUse | paramConstVector;
-
-paramConstScalarDecl: signedFloatConstant
- {
- $$.count = 4;
- $$.data[0] = $1;
- $$.data[1] = $1;
- $$.data[2] = $1;
- $$.data[3] = $1;
- }
- ;
-
-paramConstScalarUse: REAL
- {
- $$.count = 1;
- $$.data[0] = $1;
- $$.data[1] = $1;
- $$.data[2] = $1;
- $$.data[3] = $1;
- }
- | INTEGER
- {
- $$.count = 1;
- $$.data[0] = (float) $1;
- $$.data[1] = (float) $1;
- $$.data[2] = (float) $1;
- $$.data[3] = (float) $1;
- }
- ;
-
-paramConstVector: '{' signedFloatConstant '}'
- {
- $$.count = 4;
- $$.data[0] = $2;
- $$.data[1] = 0.0f;
- $$.data[2] = 0.0f;
- $$.data[3] = 1.0f;
- }
- | '{' signedFloatConstant ',' signedFloatConstant '}'
- {
- $$.count = 4;
- $$.data[0] = $2;
- $$.data[1] = $4;
- $$.data[2] = 0.0f;
- $$.data[3] = 1.0f;
- }
- | '{' signedFloatConstant ',' signedFloatConstant ','
- signedFloatConstant '}'
- {
- $$.count = 4;
- $$.data[0] = $2;
- $$.data[1] = $4;
- $$.data[2] = $6;
- $$.data[3] = 1.0f;
- }
- | '{' signedFloatConstant ',' signedFloatConstant ','
- signedFloatConstant ',' signedFloatConstant '}'
- {
- $$.count = 4;
- $$.data[0] = $2;
- $$.data[1] = $4;
- $$.data[2] = $6;
- $$.data[3] = $8;
- }
- ;
-
-signedFloatConstant: optionalSign REAL
- {
- $$ = ($1) ? -$2 : $2;
- }
- | optionalSign INTEGER
- {
- $$ = (float)(($1) ? -$2 : $2);
- }
- ;
-
-optionalSign: '+' { $$ = FALSE; }
- | '-' { $$ = TRUE; }
- | { $$ = FALSE; }
- ;
-
-TEMP_statement: optVarSize TEMP { $<integer>$ = $2; } varNameList
- ;
-
-optVarSize: string
- {
- /* NV_fragment_program_option defines the size qualifiers in a
- * fairly broken way. "SHORT" or "LONG" can optionally be used
- * before TEMP or OUTPUT. However, neither is a reserved word!
- * This means that we have to parse it as an identifier, then check
- * to make sure it's one of the valid values. *sigh*
- *
- * In addition, the grammar in the extension spec does *not* allow
- * the size specifier to be optional, but all known implementations
- * do.
- */
- if (!state->option.NV_fragment) {
- yyerror(& @1, state, "unexpected IDENTIFIER");
- YYERROR;
- }
-
- if (strcmp("SHORT", $1) == 0) {
- } else if (strcmp("LONG", $1) == 0) {
- } else {
- char *const err_str =
- make_error_string("invalid storage size specifier \"%s\"",
- $1);
-
- yyerror(& @1, state, (err_str != NULL)
- ? err_str : "invalid storage size specifier");
-
- if (err_str != NULL) {
- free(err_str);
- }
-
- YYERROR;
- }
- }
- |
- {
- }
- ;
-
-ADDRESS_statement: ADDRESS { $<integer>$ = $1; } varNameList
- ;
-
-varNameList: varNameList ',' IDENTIFIER
- {
- if (!declare_variable(state, $3, $<integer>0, & @3)) {
- free($3);
- YYERROR;
- }
- }
- | IDENTIFIER
- {
- if (!declare_variable(state, $1, $<integer>0, & @1)) {
- free($1);
- YYERROR;
- }
- }
- ;
-
-OUTPUT_statement: optVarSize OUTPUT IDENTIFIER '=' resultBinding
- {
- struct asm_symbol *const s =
- declare_variable(state, $3, at_output, & @3);
-
- if (s == NULL) {
- free($3);
- YYERROR;
- } else {
- s->output_binding = $5;
- }
- }
- ;
-
-resultBinding: RESULT POSITION
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_HPOS;
- } else {
- yyerror(& @2, state, "invalid program result name");
- YYERROR;
- }
- }
- | RESULT FOGCOORD
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_FOGC;
- } else {
- yyerror(& @2, state, "invalid program result name");
- YYERROR;
- }
- }
- | RESULT resultColBinding
- {
- $$ = $2;
- }
- | RESULT POINTSIZE
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_PSIZ;
- } else {
- yyerror(& @2, state, "invalid program result name");
- YYERROR;
- }
- }
- | RESULT TEXCOORD optTexCoordUnitNum
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_TEX0 + $3;
- } else {
- yyerror(& @2, state, "invalid program result name");
- YYERROR;
- }
- }
- | RESULT DEPTH
- {
- if (state->mode == ARB_fragment) {
- $$ = FRAG_RESULT_DEPTH;
- } else {
- yyerror(& @2, state, "invalid program result name");
- YYERROR;
- }
- }
- ;
-
-resultColBinding: COLOR optResultFaceType optResultColorType
- {
- $$ = $2 + $3;
- }
- ;
-
-optResultFaceType:
- {
- $$ = (state->mode == ARB_vertex)
- ? VERT_RESULT_COL0
- : FRAG_RESULT_COLOR;
- }
- | FRONT
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_COL0;
- } else {
- yyerror(& @1, state, "invalid program result name");
- YYERROR;
- }
- }
- | BACK
- {
- if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_BFC0;
- } else {
- yyerror(& @1, state, "invalid program result name");
- YYERROR;
- }
- }
- ;
-
-optResultColorType:
- {
- $$ = 0;
- }
- | PRIMARY
- {
- if (state->mode == ARB_vertex) {
- $$ = 0;
- } else {
- yyerror(& @1, state, "invalid program result name");
- YYERROR;
- }
- }
- | SECONDARY
- {
- if (state->mode == ARB_vertex) {
- $$ = 1;
- } else {
- yyerror(& @1, state, "invalid program result name");
- YYERROR;
- }
- }
- ;
-
-optFaceType: { $$ = 0; }
- | FRONT { $$ = 0; }
- | BACK { $$ = 1; }
- ;
-
-optColorType: { $$ = 0; }
- | PRIMARY { $$ = 0; }
- | SECONDARY { $$ = 1; }
- ;
-
-optTexCoordUnitNum: { $$ = 0; }
- | '[' texCoordUnitNum ']' { $$ = $2; }
- ;
-
-optTexImageUnitNum: { $$ = 0; }
- | '[' texImageUnitNum ']' { $$ = $2; }
- ;
-
-optLegacyTexUnitNum: { $$ = 0; }
- | '[' legacyTexUnitNum ']' { $$ = $2; }
- ;
-
-texCoordUnitNum: INTEGER
- {
- if ((unsigned) $1 >= state->MaxTextureCoordUnits) {
- yyerror(& @1, state, "invalid texture coordinate unit selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-texImageUnitNum: INTEGER
- {
- if ((unsigned) $1 >= state->MaxTextureImageUnits) {
- yyerror(& @1, state, "invalid texture image unit selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-legacyTexUnitNum: INTEGER
- {
- if ((unsigned) $1 >= state->MaxTextureUnits) {
- yyerror(& @1, state, "invalid texture unit selector");
- YYERROR;
- }
-
- $$ = $1;
- }
- ;
-
-ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER
- {
- struct asm_symbol *exist = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $2);
- struct asm_symbol *target = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, $4);
-
- free($4);
-
- if (exist != NULL) {
- char m[1000];
- _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", $2);
- free($2);
- yyerror(& @2, state, m);
- YYERROR;
- } else if (target == NULL) {
- free($2);
- yyerror(& @4, state,
- "undefined variable binding in ALIAS statement");
- YYERROR;
- } else {
- _mesa_symbol_table_add_symbol(state->st, 0, $2, target);
- }
- }
- ;
-
-string: IDENTIFIER
- | USED_IDENTIFIER
- ;
-
-%%
-
-void
-asm_instruction_set_operands(struct asm_instruction *inst,
- const struct prog_dst_register *dst,
- const struct asm_src_register *src0,
- const struct asm_src_register *src1,
- const struct asm_src_register *src2)
-{
- /* In the core ARB extensions only the KIL instruction doesn't have a
- * destination register.
- */
- if (dst == NULL) {
- init_dst_reg(& inst->Base.DstReg);
- } else {
- inst->Base.DstReg = *dst;
- }
-
- /* The only instruction that doesn't have any source registers is the
- * condition-code based KIL instruction added by NV_fragment_program_option.
- */
- if (src0 != NULL) {
- inst->Base.SrcReg[0] = src0->Base;
- inst->SrcReg[0] = *src0;
- } else {
- init_src_reg(& inst->SrcReg[0]);
- }
-
- if (src1 != NULL) {
- inst->Base.SrcReg[1] = src1->Base;
- inst->SrcReg[1] = *src1;
- } else {
- init_src_reg(& inst->SrcReg[1]);
- }
-
- if (src2 != NULL) {
- inst->Base.SrcReg[2] = src2->Base;
- inst->SrcReg[2] = *src2;
- } else {
- init_src_reg(& inst->SrcReg[2]);
- }
-}
-
-
-struct asm_instruction *
-asm_instruction_ctor(gl_inst_opcode op,
- const struct prog_dst_register *dst,
- const struct asm_src_register *src0,
- const struct asm_src_register *src1,
- const struct asm_src_register *src2)
-{
- struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
-
- if (inst) {
- _mesa_init_instructions(& inst->Base, 1);
- inst->Base.Opcode = op;
-
- asm_instruction_set_operands(inst, dst, src0, src1, src2);
- }
-
- return inst;
-}
-
-
-struct asm_instruction *
-asm_instruction_copy_ctor(const struct prog_instruction *base,
- const struct prog_dst_register *dst,
- const struct asm_src_register *src0,
- const struct asm_src_register *src1,
- const struct asm_src_register *src2)
-{
- struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
-
- if (inst) {
- _mesa_init_instructions(& inst->Base, 1);
- inst->Base.Opcode = base->Opcode;
- inst->Base.CondUpdate = base->CondUpdate;
- inst->Base.CondDst = base->CondDst;
- inst->Base.SaturateMode = base->SaturateMode;
- inst->Base.Precision = base->Precision;
-
- asm_instruction_set_operands(inst, dst, src0, src1, src2);
- }
-
- return inst;
-}
-
-
-void
-init_dst_reg(struct prog_dst_register *r)
-{
- memset(r, 0, sizeof(*r));
- r->File = PROGRAM_UNDEFINED;
- r->WriteMask = WRITEMASK_XYZW;
- r->CondMask = COND_TR;
- r->CondSwizzle = SWIZZLE_NOOP;
-}
-
-
-/** Like init_dst_reg() but set the File and Index fields. */
-void
-set_dst_reg(struct prog_dst_register *r, gl_register_file file, GLint index)
-{
- const GLint maxIndex = 1 << INST_INDEX_BITS;
- const GLint minIndex = 0;
- ASSERT(index >= minIndex);
- (void) minIndex;
- ASSERT(index <= maxIndex);
- (void) maxIndex;
- ASSERT(file == PROGRAM_TEMPORARY ||
- file == PROGRAM_ADDRESS ||
- file == PROGRAM_OUTPUT);
- memset(r, 0, sizeof(*r));
- r->File = file;
- r->Index = index;
- r->WriteMask = WRITEMASK_XYZW;
- r->CondMask = COND_TR;
- r->CondSwizzle = SWIZZLE_NOOP;
-}
-
-
-void
-init_src_reg(struct asm_src_register *r)
-{
- memset(r, 0, sizeof(*r));
- r->Base.File = PROGRAM_UNDEFINED;
- r->Base.Swizzle = SWIZZLE_NOOP;
- r->Symbol = NULL;
-}
-
-
-/** Like init_src_reg() but set the File and Index fields.
- * \return GL_TRUE if a valid src register, GL_FALSE otherwise
- */
-void
-set_src_reg(struct asm_src_register *r, gl_register_file file, GLint index)
-{
- set_src_reg_swz(r, file, index, SWIZZLE_XYZW);
-}
-
-
-void
-set_src_reg_swz(struct asm_src_register *r, gl_register_file file, GLint index,
- GLuint swizzle)
-{
- const GLint maxIndex = (1 << INST_INDEX_BITS) - 1;
- const GLint minIndex = -(1 << INST_INDEX_BITS);
- ASSERT(file < PROGRAM_FILE_MAX);
- ASSERT(index >= minIndex);
- (void) minIndex;
- ASSERT(index <= maxIndex);
- (void) maxIndex;
- memset(r, 0, sizeof(*r));
- r->Base.File = file;
- r->Base.Index = index;
- r->Base.Swizzle = swizzle;
- r->Symbol = NULL;
-}
-
-
-/**
- * Validate the set of inputs used by a program
- *
- * Validates that legal sets of inputs are used by the program. In this case
- * "used" included both reading the input or binding the input to a name using
- * the \c ATTRIB command.
- *
- * \return
- * \c TRUE if the combination of inputs used is valid, \c FALSE otherwise.
- */
-int
-validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state)
-{
- const int inputs = state->prog->InputsRead | state->InputsBound;
-
- if (((inputs & 0x0ffff) & (inputs >> 16)) != 0) {
- yyerror(locp, state, "illegal use of generic attribute and name attribute");
- return 0;
- }
-
- return 1;
-}
-
-
-struct asm_symbol *
-declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
- struct YYLTYPE *locp)
-{
- struct asm_symbol *s = NULL;
- struct asm_symbol *exist = (struct asm_symbol *)
- _mesa_symbol_table_find_symbol(state->st, 0, name);
-
-
- if (exist != NULL) {
- yyerror(locp, state, "redeclared identifier");
- } else {
- s = calloc(1, sizeof(struct asm_symbol));
- s->name = name;
- s->type = t;
-
- switch (t) {
- case at_temp:
- if (state->prog->NumTemporaries >= state->limits->MaxTemps) {
- yyerror(locp, state, "too many temporaries declared");
- free(s);
- return NULL;
- }
-
- s->temp_binding = state->prog->NumTemporaries;
- state->prog->NumTemporaries++;
- break;
-
- case at_address:
- if (state->prog->NumAddressRegs >= state->limits->MaxAddressRegs) {
- yyerror(locp, state, "too many address registers declared");
- free(s);
- return NULL;
- }
-
- /* FINISHME: Add support for multiple address registers.
- */
- state->prog->NumAddressRegs++;
- break;
-
- default:
- break;
- }
-
- _mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
- s->next = state->sym;
- state->sym = s;
- }
-
- return s;
-}
-
-
-int add_state_reference(struct gl_program_parameter_list *param_list,
- const gl_state_index tokens[STATE_LENGTH])
-{
- const GLuint size = 4; /* XXX fix */
- char *name;
- GLint index;
-
- name = _mesa_program_state_string(tokens);
- index = _mesa_add_parameter(param_list, PROGRAM_STATE_VAR, name,
- size, GL_NONE, NULL, tokens, 0x0);
- param_list->StateFlags |= _mesa_program_state_flags(tokens);
-
- /* free name string here since we duplicated it in add_parameter() */
- free(name);
-
- return index;
-}
-
-
-int
-initialize_symbol_from_state(struct gl_program *prog,
- struct asm_symbol *param_var,
- const gl_state_index tokens[STATE_LENGTH])
-{
- int idx = -1;
- gl_state_index state_tokens[STATE_LENGTH];
-
-
- memcpy(state_tokens, tokens, sizeof(state_tokens));
-
- param_var->type = at_param;
- param_var->param_binding_type = PROGRAM_STATE_VAR;
-
- /* If we are adding a STATE_MATRIX that has multiple rows, we need to
- * unroll it and call add_state_reference() for each row
- */
- if ((state_tokens[0] == STATE_MODELVIEW_MATRIX ||
- state_tokens[0] == STATE_PROJECTION_MATRIX ||
- state_tokens[0] == STATE_MVP_MATRIX ||
- state_tokens[0] == STATE_TEXTURE_MATRIX ||
- state_tokens[0] == STATE_PROGRAM_MATRIX)
- && (state_tokens[2] != state_tokens[3])) {
- int row;
- const int first_row = state_tokens[2];
- const int last_row = state_tokens[3];
-
- for (row = first_row; row <= last_row; row++) {
- state_tokens[2] = state_tokens[3] = row;
-
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
-
- param_var->param_binding_length++;
- }
- }
- else {
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
- }
-
- return idx;
-}
-
-
-int
-initialize_symbol_from_param(struct gl_program *prog,
- struct asm_symbol *param_var,
- const gl_state_index tokens[STATE_LENGTH])
-{
- int idx = -1;
- gl_state_index state_tokens[STATE_LENGTH];
-
-
- memcpy(state_tokens, tokens, sizeof(state_tokens));
-
- assert((state_tokens[0] == STATE_VERTEX_PROGRAM)
- || (state_tokens[0] == STATE_FRAGMENT_PROGRAM));
- assert((state_tokens[1] == STATE_ENV)
- || (state_tokens[1] == STATE_LOCAL));
-
- /*
- * The param type is STATE_VAR. The program parameter entry will
- * effectively be a pointer into the LOCAL or ENV parameter array.
- */
- param_var->type = at_param;
- param_var->param_binding_type = PROGRAM_STATE_VAR;
-
- /* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
- * we need to unroll it and call add_state_reference() for each row
- */
- if (state_tokens[2] != state_tokens[3]) {
- int row;
- const int first_row = state_tokens[2];
- const int last_row = state_tokens[3];
-
- for (row = first_row; row <= last_row; row++) {
- state_tokens[2] = state_tokens[3] = row;
-
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
- }
- }
- else {
- idx = add_state_reference(prog->Parameters, state_tokens);
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
- }
-
- return idx;
-}
-
-
-/**
- * Put a float/vector constant/literal into the parameter list.
- * \param param_var returns info about the parameter/constant's location,
- * binding, type, etc.
- * \param vec the vector/constant to add
- * \param allowSwizzle if true, try to consolidate constants which only differ
- * by a swizzle. We don't want to do this when building
- * arrays of constants that may be indexed indirectly.
- * \return index of the constant in the parameter list.
- */
-int
-initialize_symbol_from_const(struct gl_program *prog,
- struct asm_symbol *param_var,
- const struct asm_vector *vec,
- GLboolean allowSwizzle)
-{
- unsigned swizzle;
- const int idx = _mesa_add_unnamed_constant(prog->Parameters,
- vec->data, vec->count,
- allowSwizzle ? &swizzle : NULL);
-
- param_var->type = at_param;
- param_var->param_binding_type = PROGRAM_CONSTANT;
-
- if (param_var->param_binding_begin == ~0U) {
- param_var->param_binding_begin = idx;
- param_var->param_binding_swizzle = allowSwizzle ? swizzle : SWIZZLE_XYZW;
- }
- param_var->param_binding_length++;
-
- return idx;
-}
-
-
-char *
-make_error_string(const char *fmt, ...)
-{
- int length;
- char *str;
- va_list args;
-
-
- /* Call vsnprintf once to determine how large the final string is. Call it
- * 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);
- }
-
- return str;
-}
-
-
-void
-yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
-{
- char *err_str;
-
-
- err_str = make_error_string("glProgramStringARB(%s)\n", s);
- if (err_str) {
- _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str);
- free(err_str);
- }
-
- err_str = make_error_string("line %u, char %u: error: %s\n",
- locp->first_line, locp->first_column, s);
- _mesa_set_program_error(state->ctx, locp->position, err_str);
-
- if (err_str) {
- free(err_str);
- }
-}
-
-
-GLboolean
-_mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *str,
- GLsizei len, struct asm_parser_state *state)
-{
- struct asm_instruction *inst;
- unsigned i;
- GLubyte *strz;
- GLboolean result = GL_FALSE;
- void *temp;
- struct asm_symbol *sym;
-
- state->ctx = ctx;
- state->prog->Target = target;
- state->prog->Parameters = _mesa_new_parameter_list();
-
- /* Make a copy of the program string and force it to be NUL-terminated.
- */
- strz = (GLubyte *) malloc(len + 1);
- if (strz == NULL) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
- return GL_FALSE;
- }
- memcpy (strz, str, len);
- strz[len] = '\0';
-
- state->prog->String = strz;
-
- state->st = _mesa_symbol_table_ctor();
-
- state->limits = (target == GL_VERTEX_PROGRAM_ARB)
- ? & ctx->Const.VertexProgram
- : & ctx->Const.FragmentProgram;
-
- state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
- state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
- state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
- state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
- state->MaxLights = ctx->Const.MaxLights;
- state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
-
- state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
- ? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
-
- _mesa_set_program_error(ctx, -1, NULL);
-
- _mesa_program_lexer_ctor(& state->scanner, state, (const char *) str, len);
- yyparse(state);
- _mesa_program_lexer_dtor(state->scanner);
-
-
- if (ctx->Program.ErrorPos != -1) {
- goto error;
- }
-
- if (! _mesa_layout_parameters(state)) {
- struct YYLTYPE loc;
-
- loc.first_line = 0;
- loc.first_column = 0;
- loc.position = len;
-
- yyerror(& loc, state, "invalid PARAM usage");
- goto error;
- }
-
-
-
- /* Add one instruction to store the "END" instruction.
- */
- state->prog->Instructions =
- _mesa_alloc_instructions(state->prog->NumInstructions + 1);
- inst = state->inst_head;
- for (i = 0; i < state->prog->NumInstructions; i++) {
- struct asm_instruction *const temp = inst->next;
-
- state->prog->Instructions[i] = inst->Base;
- inst = temp;
- }
-
- /* Finally, tag on an OPCODE_END instruction */
- {
- const GLuint numInst = state->prog->NumInstructions;
- _mesa_init_instructions(state->prog->Instructions + numInst, 1);
- state->prog->Instructions[numInst].Opcode = OPCODE_END;
- }
- state->prog->NumInstructions++;
-
- state->prog->NumParameters = state->prog->Parameters->NumParameters;
- state->prog->NumAttributes = _mesa_bitcount(state->prog->InputsRead);
-
- /*
- * Initialize native counts to logical counts. The device driver may
- * change them if program is translated into a hardware program.
- */
- state->prog->NumNativeInstructions = state->prog->NumInstructions;
- state->prog->NumNativeTemporaries = state->prog->NumTemporaries;
- state->prog->NumNativeParameters = state->prog->NumParameters;
- state->prog->NumNativeAttributes = state->prog->NumAttributes;
- state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs;
-
- result = GL_TRUE;
-
-error:
- for (inst = state->inst_head; inst != NULL; inst = temp) {
- temp = inst->next;
- free(inst);
- }
-
- state->inst_head = NULL;
- state->inst_tail = NULL;
-
- for (sym = state->sym; sym != NULL; sym = temp) {
- temp = sym->next;
-
- free((void *) sym->name);
- free(sym);
- }
- state->sym = NULL;
-
- _mesa_symbol_table_dtor(state->st);
- state->st = NULL;
-
- return result;
-}
diff --git a/src/mesa/program/program_parse_extra.c b/src/mesa/program/program_parse_extra.c
deleted file mode 100644
index ae98b78..0000000
--- a/src/mesa/program/program_parse_extra.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * 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 <string.h>
-#include "main/mtypes.h"
-#include "prog_instruction.h"
-#include "program_parser.h"
-
-
-/**
- * Extra assembly-level parser routines
- *
- * \author Ian Romanick <ian.d.romanick@intel.com>
- */
-
-int
-_mesa_parse_instruction_suffix(const struct asm_parser_state *state,
- const char *suffix,
- struct prog_instruction *inst)
-{
- inst->CondUpdate = 0;
- inst->CondDst = 0;
- inst->SaturateMode = SATURATE_OFF;
- inst->Precision = FLOAT32;
-
-
- /* The first possible suffix element is the precision specifier from
- * NV_fragment_program_option.
- */
- if (state->option.NV_fragment) {
- switch (suffix[0]) {
- case 'H':
- inst->Precision = FLOAT16;
- suffix++;
- break;
- case 'R':
- inst->Precision = FLOAT32;
- suffix++;
- break;
- case 'X':
- inst->Precision = FIXED12;
- suffix++;
- break;
- default:
- break;
- }
- }
-
- /* The next possible suffix element is the condition code modifier selection
- * from NV_fragment_program_option.
- */
- if (state->option.NV_fragment) {
- if (suffix[0] == 'C') {
- inst->CondUpdate = 1;
- suffix++;
- }
- }
-
-
- /* The final possible suffix element is the saturation selector from
- * ARB_fragment_program.
- */
- if (state->mode == ARB_fragment) {
- if (strcmp(suffix, "_SAT") == 0) {
- inst->SaturateMode = SATURATE_ZERO_ONE;
- suffix += 4;
- }
- }
-
-
- /* It is an error for all of the suffix string not to be consumed.
- */
- return suffix[0] == '\0';
-}
-
-
-int
-_mesa_parse_cc(const char *s)
-{
- int cond = 0;
-
- switch (s[0]) {
- case 'E':
- if (s[1] == 'Q') {
- cond = COND_EQ;
- }
- break;
-
- case 'F':
- if (s[1] == 'L') {
- cond = COND_FL;
- }
- break;
-
- case 'G':
- if (s[1] == 'E') {
- cond = COND_GE;
- } else if (s[1] == 'T') {
- cond = COND_GT;
- }
- break;
-
- case 'L':
- if (s[1] == 'E') {
- cond = COND_LE;
- } else if (s[1] == 'T') {
- cond = COND_LT;
- }
- break;
-
- case 'N':
- if (s[1] == 'E') {
- cond = COND_NE;
- }
- break;
-
- case 'T':
- if (s[1] == 'R') {
- cond = COND_TR;
- }
- break;
-
- default:
- break;
- }
-
- return ((cond == 0) || (s[2] != '\0')) ? 0 : cond;
-}
-
-
-int
-_mesa_ARBvp_parse_option(struct asm_parser_state *state, const char *option)
-{
- if (strcmp(option, "ARB_position_invariant") == 0) {
- state->option.PositionInvariant = 1;
- return 1;
- }
-
- return 0;
-}
-
-
-int
-_mesa_ARBfp_parse_option(struct asm_parser_state *state, const char *option)
-{
- /* All of the options currently supported start with "ARB_". The code is
- * currently structured with nested if-statements because eventually options
- * that start with "NV_" will be supported. This structure will result in
- * less churn when those options are added.
- */
- if (strncmp(option, "ARB_", 4) == 0) {
- /* Advance the pointer past the "ARB_" prefix.
- */
- option += 4;
-
-
- if (strncmp(option, "fog_", 4) == 0) {
- option += 4;
-
- if (state->option.Fog == OPTION_NONE) {
- if (strcmp(option, "exp") == 0) {
- state->option.Fog = OPTION_FOG_EXP;
- return 1;
- } else if (strcmp(option, "exp2") == 0) {
- state->option.Fog = OPTION_FOG_EXP2;
- return 1;
- } else if (strcmp(option, "linear") == 0) {
- state->option.Fog = OPTION_FOG_LINEAR;
- return 1;
- }
- }
-
- return 0;
- } else if (strncmp(option, "precision_hint_", 15) == 0) {
- option += 15;
-
- if (state->option.PrecisionHint == OPTION_NONE) {
- if (strcmp(option, "nicest") == 0) {
- state->option.PrecisionHint = OPTION_NICEST;
- return 1;
- } else if (strcmp(option, "fastest") == 0) {
- state->option.PrecisionHint = OPTION_FASTEST;
- return 1;
- }
- }
-
- return 0;
- } else if (strcmp(option, "draw_buffers") == 0) {
- /* Don't need to check extension availability because all Mesa-based
- * drivers support GL_ARB_draw_buffers.
- */
- state->option.DrawBuffers = 1;
- return 1;
- } else if (strcmp(option, "fragment_program_shadow") == 0) {
- if (state->ctx->Extensions.ARB_fragment_program_shadow) {
- state->option.Shadow = 1;
- return 1;
- }
- } else if (strncmp(option, "fragment_coord_", 15) == 0) {
- option += 15;
- if (state->ctx->Extensions.ARB_fragment_coord_conventions) {
- if (strcmp(option, "origin_upper_left") == 0) {
- state->option.OriginUpperLeft = 1;
- return 1;
- }
- else if (strcmp(option, "pixel_center_integer") == 0) {
- state->option.PixelCenterInteger = 1;
- return 1;
- }
- }
- }
- } else if (strncmp(option, "NV_fragment_program", 19) == 0) {
- option += 19;
-
- /* Other NV_fragment_program strings may be supported later.
- */
- if (option[0] == '\0') {
- if (state->ctx->Extensions.NV_fragment_program_option) {
- state->option.NV_fragment = 1;
- return 1;
- }
- }
- } else if (strncmp(option, "MESA_", 5) == 0) {
- option += 5;
-
- if (strcmp(option, "texture_array") == 0) {
- if (state->ctx->Extensions.MESA_texture_array) {
- state->option.TexArray = 1;
- return 1;
- }
- }
- }
-
- return 0;
-}
diff --git a/src/mesa/program/program_parser.h b/src/mesa/program/program_parser.h
deleted file mode 100644
index d689eef..0000000
--- a/src/mesa/program/program_parser.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * 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
-
-#include "main/config.h"
-
-struct gl_context;
-
-enum asm_type {
- at_none,
- at_address,
- at_attrib,
- at_param,
- at_temp,
- at_output
-};
-
-struct asm_symbol {
- struct asm_symbol *next; /**< List linkage for freeing. */
- const char *name;
- enum asm_type type;
- unsigned attrib_binding;
- unsigned output_binding; /**< Output / result register number. */
-
- /**
- * One of PROGRAM_STATE_VAR, PROGRAM_LOCAL_PARAM, or PROGRAM_ENV_PARAM.
- */
- unsigned param_binding_type;
-
- /**
- * Offset into the program_parameter_list where the tokens representing our
- * bound state (or constants) start.
- */
- unsigned param_binding_begin;
-
- /**
- * Constants put into the parameter list may be swizzled. This
- * field contain's the symbol's swizzle. (SWIZZLE_X/Y/Z/W)
- */
- unsigned param_binding_swizzle;
-
- /* This is how many entries in the program_parameter_list we take up
- * with our state tokens or constants. Note that this is _not_ the same as
- * the number of param registers we eventually use.
- */
- unsigned param_binding_length;
-
- /**
- * Index of the temp register assigned to this variable.
- */
- unsigned temp_binding;
-
- /**
- * Flag whether or not a PARAM is an array
- */
- unsigned param_is_array:1;
-
-
- /**
- * Flag whether or not a PARAM array is accessed indirectly
- */
- unsigned param_accessed_indirectly:1;
-
-
- /**
- * \brief Is first pass of parameter layout done with this variable?
- *
- * The parameter layout routine operates in two passes. This flag tracks
- * whether or not the first pass has handled this variable.
- *
- * \sa _mesa_layout_parameters
- */
- unsigned pass1_done:1;
-};
-
-
-struct asm_vector {
- unsigned count;
- float data[4];
-};
-
-
-struct asm_swizzle_mask {
- unsigned swizzle:12;
- unsigned mask:4;
-};
-
-
-struct asm_src_register {
- struct prog_src_register Base;
-
- /**
- * Symbol associated with indirect access to parameter arrays.
- *
- * If \c Base::RelAddr is 1, this will point to the symbol for the parameter
- * that is being dereferenced. Further, \c Base::Index will be the offset
- * from the address register being used.
- */
- struct asm_symbol *Symbol;
-};
-
-
-struct asm_instruction {
- struct prog_instruction Base;
- struct asm_instruction *next;
- struct asm_src_register SrcReg[3];
-};
-
-
-struct asm_parser_state {
- struct gl_context *ctx;
- struct gl_program *prog;
-
- /**
- * Per-program target limits
- */
- struct gl_program_constants *limits;
-
- struct _mesa_symbol_table *st;
-
- /**
- * Linked list of symbols
- *
- * This list is \b only used when cleaning up compiler state and freeing
- * memory.
- */
- struct asm_symbol *sym;
-
- /**
- * State for the lexer.
- */
- void *scanner;
-
- /**
- * Linked list of instructions generated during parsing.
- */
- /*@{*/
- struct asm_instruction *inst_head;
- struct asm_instruction *inst_tail;
- /*@}*/
-
-
- /**
- * Selected limits copied from gl_constants
- *
- * These are limits from the GL context, but various bits in the program
- * must be validated against these values.
- */
- /*@{*/
- unsigned MaxTextureCoordUnits;
- unsigned MaxTextureImageUnits;
- unsigned MaxTextureUnits;
- unsigned MaxClipPlanes;
- unsigned MaxLights;
- unsigned MaxProgramMatrices;
- /*@}*/
-
- /**
- * Value to use in state vector accessors for environment and local
- * parameters
- */
- unsigned state_param_enum;
-
-
- /**
- * Input attributes bound to specific names
- *
- * This is only needed so that errors can be properly produced when
- * multiple ATTRIB statements bind illegal combinations of vertex
- * attributes.
- */
- unsigned InputsBound;
-
- enum {
- invalid_mode = 0,
- ARB_vertex,
- ARB_fragment
- } mode;
-
- struct {
- unsigned PositionInvariant:1;
- unsigned Fog:2;
- unsigned PrecisionHint:2;
- unsigned DrawBuffers:1;
- unsigned Shadow:1;
- unsigned TexRect:1;
- unsigned TexArray:1;
- unsigned NV_fragment:1;
- unsigned OriginUpperLeft:1;
- unsigned PixelCenterInteger:1;
- } option;
-
- struct {
- unsigned UsesKill:1;
- } fragment;
-};
-
-#define OPTION_NONE 0
-#define OPTION_FOG_EXP 1
-#define OPTION_FOG_EXP2 2
-#define OPTION_FOG_LINEAR 3
-#define OPTION_NICEST 1
-#define OPTION_FASTEST 2
-
-typedef struct YYLTYPE {
- int first_line;
- int first_column;
- int last_line;
- int last_column;
- int position;
-} YYLTYPE;
-
-#define YYLTYPE_IS_DECLARED 1
-#define YYLTYPE_IS_TRIVIAL 1
-
-
-extern GLboolean _mesa_parse_arb_program(struct gl_context *ctx, GLenum target,
- const GLubyte *str, GLsizei len, struct asm_parser_state *state);
-
-
-
-/* From program_lexer.l. */
-extern void _mesa_program_lexer_dtor(void *scanner);
-
-extern void _mesa_program_lexer_ctor(void **scanner,
- struct asm_parser_state *state, const char *string, size_t len);
-
-
-/**
- *\name From program_parse_extra.c
- */
-/*@{*/
-
-/**
- * Parses and processes an option string to an ARB vertex program
- *
- * \return
- * Non-zero on success, zero on failure.
- */
-extern int _mesa_ARBvp_parse_option(struct asm_parser_state *state,
- const char *option);
-
-/**
- * Parses and processes an option string to an ARB fragment program
- *
- * \return
- * Non-zero on success, zero on failure.
- */
-extern int _mesa_ARBfp_parse_option(struct asm_parser_state *state,
- const char *option);
-
-/**
- * Parses and processes instruction suffixes
- *
- * Instruction suffixes, such as \c _SAT, are processed. The relevant bits
- * are set in \c inst. If suffixes are encountered that are either not known
- * or not supported by the modes and options set in \c state, zero will be
- * returned.
- *
- * \return
- * Non-zero on success, zero on failure.
- */
-extern int _mesa_parse_instruction_suffix(const struct asm_parser_state *state,
- const char *suffix, struct prog_instruction *inst);
-
-/**
- * Parses a condition code name
- *
- * The condition code names (e.g., \c LT, \c GT, \c NE) were added to assembly
- * shaders with the \c GL_NV_fragment_program_option extension. This function
- * converts a string representation into one of the \c COND_ macros.
- *
- * \return
- * One of the \c COND_ macros defined in prog_instruction.h on success or zero
- * on failure.
- */
-extern int _mesa_parse_cc(const char *s);
-
-/*@}*/
diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c
deleted file mode 100644
index f92881f..0000000
--- a/src/mesa/program/programopt.c
+++ /dev/null
@@ -1,669 +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.
- */
-
-/**
- * \file programopt.c
- * Vertex/Fragment program optimizations and transformations for program
- * options, etc.
- *
- * \author Brian Paul
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "prog_parameter.h"
-#include "prog_statevars.h"
-#include "program.h"
-#include "programopt.h"
-#include "prog_instruction.h"
-
-
-/**
- * This function inserts instructions for coordinate modelview * projection
- * into a vertex program.
- * May be used to implement the position_invariant option.
- */
-static void
-_mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
-{
- struct prog_instruction *newInst;
- const GLuint origLen = vprog->Base.NumInstructions;
- const GLuint newLen = origLen + 4;
- GLuint i;
-
- /*
- * Setup state references for the modelview/projection matrix.
- * XXX we should check if these state vars are already declared.
- */
- static const gl_state_index mvpState[4][STATE_LENGTH] = {
- { STATE_MVP_MATRIX, 0, 0, 0, 0 }, /* state.matrix.mvp.row[0] */
- { STATE_MVP_MATRIX, 0, 1, 1, 0 }, /* state.matrix.mvp.row[1] */
- { STATE_MVP_MATRIX, 0, 2, 2, 0 }, /* state.matrix.mvp.row[2] */
- { STATE_MVP_MATRIX, 0, 3, 3, 0 }, /* state.matrix.mvp.row[3] */
- };
- GLint mvpRef[4];
-
- for (i = 0; i < 4; i++) {
- mvpRef[i] = _mesa_add_state_reference(vprog->Base.Parameters,
- mvpState[i]);
- }
-
- /* Alloc storage for new instructions */
- newInst = _mesa_alloc_instructions(newLen);
- if (!newInst) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glProgramString(inserting position_invariant code)");
- return;
- }
-
- /*
- * Generated instructions:
- * newInst[0] = DP4 result.position.x, mvp.row[0], vertex.position;
- * newInst[1] = DP4 result.position.y, mvp.row[1], vertex.position;
- * newInst[2] = DP4 result.position.z, mvp.row[2], vertex.position;
- * newInst[3] = DP4 result.position.w, mvp.row[3], vertex.position;
- */
- _mesa_init_instructions(newInst, 4);
- for (i = 0; i < 4; i++) {
- newInst[i].Opcode = OPCODE_DP4;
- newInst[i].DstReg.File = PROGRAM_OUTPUT;
- newInst[i].DstReg.Index = VERT_RESULT_HPOS;
- newInst[i].DstReg.WriteMask = (WRITEMASK_X << i);
- newInst[i].SrcReg[0].File = PROGRAM_STATE_VAR;
- newInst[i].SrcReg[0].Index = mvpRef[i];
- newInst[i].SrcReg[0].Swizzle = SWIZZLE_NOOP;
- newInst[i].SrcReg[1].File = PROGRAM_INPUT;
- newInst[i].SrcReg[1].Index = VERT_ATTRIB_POS;
- newInst[i].SrcReg[1].Swizzle = SWIZZLE_NOOP;
- }
-
- /* Append original instructions after new instructions */
- _mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen);
-
- /* free old instructions */
- _mesa_free_instructions(vprog->Base.Instructions, origLen);
-
- /* install new instructions */
- vprog->Base.Instructions = newInst;
- vprog->Base.NumInstructions = newLen;
- vprog->Base.InputsRead |= VERT_BIT_POS;
- vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS);
-}
-
-
-static void
-_mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
-{
- struct prog_instruction *newInst;
- const GLuint origLen = vprog->Base.NumInstructions;
- const GLuint newLen = origLen + 4;
- GLuint hposTemp;
- GLuint i;
-
- /*
- * Setup state references for the modelview/projection matrix.
- * XXX we should check if these state vars are already declared.
- */
- static const gl_state_index mvpState[4][STATE_LENGTH] = {
- { STATE_MVP_MATRIX, 0, 0, 0, STATE_MATRIX_TRANSPOSE },
- { STATE_MVP_MATRIX, 0, 1, 1, STATE_MATRIX_TRANSPOSE },
- { STATE_MVP_MATRIX, 0, 2, 2, STATE_MATRIX_TRANSPOSE },
- { STATE_MVP_MATRIX, 0, 3, 3, STATE_MATRIX_TRANSPOSE },
- };
- GLint mvpRef[4];
-
- for (i = 0; i < 4; i++) {
- mvpRef[i] = _mesa_add_state_reference(vprog->Base.Parameters,
- mvpState[i]);
- }
-
- /* Alloc storage for new instructions */
- newInst = _mesa_alloc_instructions(newLen);
- if (!newInst) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glProgramString(inserting position_invariant code)");
- return;
- }
-
- /* TEMP hposTemp; */
- hposTemp = vprog->Base.NumTemporaries++;
-
- /*
- * Generated instructions:
- * emit_op2(p, OPCODE_MUL, tmp, 0, swizzle1(src,X), mat[0]);
- * emit_op3(p, OPCODE_MAD, tmp, 0, swizzle1(src,Y), mat[1], tmp);
- * emit_op3(p, OPCODE_MAD, tmp, 0, swizzle1(src,Z), mat[2], tmp);
- * emit_op3(p, OPCODE_MAD, dest, 0, swizzle1(src,W), mat[3], tmp);
- */
- _mesa_init_instructions(newInst, 4);
-
- newInst[0].Opcode = OPCODE_MUL;
- newInst[0].DstReg.File = PROGRAM_TEMPORARY;
- newInst[0].DstReg.Index = hposTemp;
- newInst[0].DstReg.WriteMask = WRITEMASK_XYZW;
- newInst[0].SrcReg[0].File = PROGRAM_INPUT;
- newInst[0].SrcReg[0].Index = VERT_ATTRIB_POS;
- newInst[0].SrcReg[0].Swizzle = SWIZZLE_XXXX;
- newInst[0].SrcReg[1].File = PROGRAM_STATE_VAR;
- newInst[0].SrcReg[1].Index = mvpRef[0];
- newInst[0].SrcReg[1].Swizzle = SWIZZLE_NOOP;
-
- for (i = 1; i <= 2; i++) {
- newInst[i].Opcode = OPCODE_MAD;
- newInst[i].DstReg.File = PROGRAM_TEMPORARY;
- newInst[i].DstReg.Index = hposTemp;
- newInst[i].DstReg.WriteMask = WRITEMASK_XYZW;
- newInst[i].SrcReg[0].File = PROGRAM_INPUT;
- newInst[i].SrcReg[0].Index = VERT_ATTRIB_POS;
- newInst[i].SrcReg[0].Swizzle = MAKE_SWIZZLE4(i,i,i,i);
- newInst[i].SrcReg[1].File = PROGRAM_STATE_VAR;
- newInst[i].SrcReg[1].Index = mvpRef[i];
- newInst[i].SrcReg[1].Swizzle = SWIZZLE_NOOP;
- newInst[i].SrcReg[2].File = PROGRAM_TEMPORARY;
- newInst[i].SrcReg[2].Index = hposTemp;
- newInst[1].SrcReg[2].Swizzle = SWIZZLE_NOOP;
- }
-
- newInst[3].Opcode = OPCODE_MAD;
- newInst[3].DstReg.File = PROGRAM_OUTPUT;
- newInst[3].DstReg.Index = VERT_RESULT_HPOS;
- newInst[3].DstReg.WriteMask = WRITEMASK_XYZW;
- newInst[3].SrcReg[0].File = PROGRAM_INPUT;
- newInst[3].SrcReg[0].Index = VERT_ATTRIB_POS;
- newInst[3].SrcReg[0].Swizzle = SWIZZLE_WWWW;
- newInst[3].SrcReg[1].File = PROGRAM_STATE_VAR;
- newInst[3].SrcReg[1].Index = mvpRef[3];
- newInst[3].SrcReg[1].Swizzle = SWIZZLE_NOOP;
- newInst[3].SrcReg[2].File = PROGRAM_TEMPORARY;
- newInst[3].SrcReg[2].Index = hposTemp;
- newInst[3].SrcReg[2].Swizzle = SWIZZLE_NOOP;
-
-
- /* Append original instructions after new instructions */
- _mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen);
-
- /* free old instructions */
- _mesa_free_instructions(vprog->Base.Instructions, origLen);
-
- /* install new instructions */
- vprog->Base.Instructions = newInst;
- vprog->Base.NumInstructions = newLen;
- vprog->Base.InputsRead |= VERT_BIT_POS;
- vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS);
-}
-
-
-void
-_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
-{
- if (ctx->mvp_with_dp4)
- _mesa_insert_mvp_dp4_code( ctx, vprog );
- else
- _mesa_insert_mvp_mad_code( ctx, vprog );
-}
-
-
-
-
-
-
-/**
- * Append extra instructions onto the given fragment program to implement
- * the fog mode specified by fprog->FogOption.
- * The fragment.fogcoord input is used to compute the fog blend factor.
- *
- * XXX with a little work, this function could be adapted to add fog code
- * to vertex programs too.
- */
-void
-_mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog)
-{
- static const gl_state_index fogPStateOpt[STATE_LENGTH]
- = { STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0 };
- static const gl_state_index fogColorState[STATE_LENGTH]
- = { STATE_FOG_COLOR, 0, 0, 0, 0};
- struct prog_instruction *newInst, *inst;
- const GLuint origLen = fprog->Base.NumInstructions;
- const GLuint newLen = origLen + 5;
- GLuint i;
- GLint fogPRefOpt, fogColorRef; /* state references */
- GLuint colorTemp, fogFactorTemp; /* temporary registerss */
-
- if (fprog->FogOption == GL_NONE) {
- _mesa_problem(ctx, "_mesa_append_fog_code() called for fragment program"
- " with FogOption == GL_NONE");
- return;
- }
-
- /* Alloc storage for new instructions */
- newInst = _mesa_alloc_instructions(newLen);
- if (!newInst) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glProgramString(inserting fog_option code)");
- return;
- }
-
- /* Copy orig instructions into new instruction buffer */
- _mesa_copy_instructions(newInst, fprog->Base.Instructions, origLen);
-
- /* PARAM fogParamsRefOpt = internal optimized fog params; */
- fogPRefOpt
- = _mesa_add_state_reference(fprog->Base.Parameters, fogPStateOpt);
- /* PARAM fogColorRef = state.fog.color; */
- fogColorRef
- = _mesa_add_state_reference(fprog->Base.Parameters, fogColorState);
-
- /* TEMP colorTemp; */
- colorTemp = fprog->Base.NumTemporaries++;
- /* TEMP fogFactorTemp; */
- fogFactorTemp = fprog->Base.NumTemporaries++;
-
- /* Scan program to find where result.color is written */
- inst = newInst;
- for (i = 0; i < fprog->Base.NumInstructions; i++) {
- if (inst->Opcode == OPCODE_END)
- break;
- if (inst->DstReg.File == PROGRAM_OUTPUT &&
- inst->DstReg.Index == FRAG_RESULT_COLOR) {
- /* change the instruction to write to colorTemp w/ clamping */
- inst->DstReg.File = PROGRAM_TEMPORARY;
- inst->DstReg.Index = colorTemp;
- inst->SaturateMode = SATURATE_ZERO_ONE;
- /* don't break (may be several writes to result.color) */
- }
- inst++;
- }
- assert(inst->Opcode == OPCODE_END); /* we'll overwrite this inst */
-
- _mesa_init_instructions(inst, 5);
-
- /* emit instructions to compute fog blending factor */
- if (fprog->FogOption == GL_LINEAR) {
- /* MAD fogFactorTemp.x, fragment.fogcoord.x, fogPRefOpt.x, fogPRefOpt.y; */
- inst->Opcode = OPCODE_MAD;
- inst->DstReg.File = PROGRAM_TEMPORARY;
- inst->DstReg.Index = fogFactorTemp;
- inst->DstReg.WriteMask = WRITEMASK_X;
- inst->SrcReg[0].File = PROGRAM_INPUT;
- inst->SrcReg[0].Index = FRAG_ATTRIB_FOGC;
- inst->SrcReg[0].Swizzle = SWIZZLE_XXXX;
- inst->SrcReg[1].File = PROGRAM_STATE_VAR;
- inst->SrcReg[1].Index = fogPRefOpt;
- inst->SrcReg[1].Swizzle = SWIZZLE_XXXX;
- inst->SrcReg[2].File = PROGRAM_STATE_VAR;
- inst->SrcReg[2].Index = fogPRefOpt;
- inst->SrcReg[2].Swizzle = SWIZZLE_YYYY;
- inst->SaturateMode = SATURATE_ZERO_ONE;
- inst++;
- }
- else {
- ASSERT(fprog->FogOption == GL_EXP || fprog->FogOption == GL_EXP2);
- /* fogPRefOpt.z = d/ln(2), fogPRefOpt.w = d/sqrt(ln(2) */
- /* EXP: MUL fogFactorTemp.x, fogPRefOpt.z, fragment.fogcoord.x; */
- /* EXP2: MUL fogFactorTemp.x, fogPRefOpt.w, fragment.fogcoord.x; */
- inst->Opcode = OPCODE_MUL;
- inst->DstReg.File = PROGRAM_TEMPORARY;
- inst->DstReg.Index = fogFactorTemp;
- inst->DstReg.WriteMask = WRITEMASK_X;
- inst->SrcReg[0].File = PROGRAM_STATE_VAR;
- inst->SrcReg[0].Index = fogPRefOpt;
- inst->SrcReg[0].Swizzle
- = (fprog->FogOption == GL_EXP) ? SWIZZLE_ZZZZ : SWIZZLE_WWWW;
- inst->SrcReg[1].File = PROGRAM_INPUT;
- inst->SrcReg[1].Index = FRAG_ATTRIB_FOGC;
- inst->SrcReg[1].Swizzle = SWIZZLE_XXXX;
- inst++;
- if (fprog->FogOption == GL_EXP2) {
- /* MUL fogFactorTemp.x, fogFactorTemp.x, fogFactorTemp.x; */
- inst->Opcode = OPCODE_MUL;
- inst->DstReg.File = PROGRAM_TEMPORARY;
- inst->DstReg.Index = fogFactorTemp;
- inst->DstReg.WriteMask = WRITEMASK_X;
- inst->SrcReg[0].File = PROGRAM_TEMPORARY;
- inst->SrcReg[0].Index = fogFactorTemp;
- inst->SrcReg[0].Swizzle = SWIZZLE_XXXX;
- inst->SrcReg[1].File = PROGRAM_TEMPORARY;
- inst->SrcReg[1].Index = fogFactorTemp;
- inst->SrcReg[1].Swizzle = SWIZZLE_XXXX;
- inst++;
- }
- /* EX2_SAT fogFactorTemp.x, -fogFactorTemp.x; */
- inst->Opcode = OPCODE_EX2;
- inst->DstReg.File = PROGRAM_TEMPORARY;
- inst->DstReg.Index = fogFactorTemp;
- inst->DstReg.WriteMask = WRITEMASK_X;
- inst->SrcReg[0].File = PROGRAM_TEMPORARY;
- inst->SrcReg[0].Index = fogFactorTemp;
- inst->SrcReg[0].Negate = NEGATE_XYZW;
- inst->SrcReg[0].Swizzle = SWIZZLE_XXXX;
- inst->SaturateMode = SATURATE_ZERO_ONE;
- inst++;
- }
- /* LRP result.color.xyz, fogFactorTemp.xxxx, colorTemp, fogColorRef; */
- inst->Opcode = OPCODE_LRP;
- inst->DstReg.File = PROGRAM_OUTPUT;
- inst->DstReg.Index = FRAG_RESULT_COLOR;
- inst->DstReg.WriteMask = WRITEMASK_XYZ;
- inst->SrcReg[0].File = PROGRAM_TEMPORARY;
- inst->SrcReg[0].Index = fogFactorTemp;
- inst->SrcReg[0].Swizzle = SWIZZLE_XXXX;
- inst->SrcReg[1].File = PROGRAM_TEMPORARY;
- inst->SrcReg[1].Index = colorTemp;
- inst->SrcReg[1].Swizzle = SWIZZLE_NOOP;
- inst->SrcReg[2].File = PROGRAM_STATE_VAR;
- inst->SrcReg[2].Index = fogColorRef;
- inst->SrcReg[2].Swizzle = SWIZZLE_NOOP;
- inst++;
- /* MOV result.color.w, colorTemp.x; # copy alpha */
- inst->Opcode = OPCODE_MOV;
- inst->DstReg.File = PROGRAM_OUTPUT;
- inst->DstReg.Index = FRAG_RESULT_COLOR;
- inst->DstReg.WriteMask = WRITEMASK_W;
- inst->SrcReg[0].File = PROGRAM_TEMPORARY;
- inst->SrcReg[0].Index = colorTemp;
- inst->SrcReg[0].Swizzle = SWIZZLE_NOOP;
- inst++;
- /* END; */
- inst->Opcode = OPCODE_END;
- inst++;
-
- /* free old instructions */
- _mesa_free_instructions(fprog->Base.Instructions, origLen);
-
- /* install new instructions */
- fprog->Base.Instructions = newInst;
- fprog->Base.NumInstructions = inst - newInst;
- fprog->Base.InputsRead |= FRAG_BIT_FOGC;
- /* XXX do this? fprog->FogOption = GL_NONE; */
-}
-
-
-
-static GLboolean
-is_texture_instruction(const struct prog_instruction *inst)
-{
- switch (inst->Opcode) {
- case OPCODE_TEX:
- case OPCODE_TXB:
- case OPCODE_TXD:
- case OPCODE_TXL:
- case OPCODE_TXP:
- case OPCODE_TXP_NV:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
-/**
- * Count the number of texure indirections in the given program.
- * The program's NumTexIndirections field will be updated.
- * See the GL_ARB_fragment_program spec (issue 24) for details.
- * XXX we count texture indirections in texenvprogram.c (maybe use this code
- * instead and elsewhere).
- */
-void
-_mesa_count_texture_indirections(struct gl_program *prog)
-{
- GLuint indirections = 1;
- GLbitfield tempsOutput = 0x0;
- GLbitfield aluTemps = 0x0;
- GLuint i;
-
- for (i = 0; i < prog->NumInstructions; i++) {
- const struct prog_instruction *inst = prog->Instructions + i;
-
- if (is_texture_instruction(inst)) {
- if (((inst->SrcReg[0].File == PROGRAM_TEMPORARY) &&
- (tempsOutput & (1 << inst->SrcReg[0].Index))) ||
- ((inst->Opcode != OPCODE_KIL) &&
- (inst->DstReg.File == PROGRAM_TEMPORARY) &&
- (aluTemps & (1 << inst->DstReg.Index))))
- {
- indirections++;
- tempsOutput = 0x0;
- aluTemps = 0x0;
- }
- }
- else {
- GLuint j;
- for (j = 0; j < 3; j++) {
- if (inst->SrcReg[j].File == PROGRAM_TEMPORARY)
- aluTemps |= (1 << inst->SrcReg[j].Index);
- }
- if (inst->DstReg.File == PROGRAM_TEMPORARY)
- aluTemps |= (1 << inst->DstReg.Index);
- }
-
- if ((inst->Opcode != OPCODE_KIL) && (inst->DstReg.File == PROGRAM_TEMPORARY))
- tempsOutput |= (1 << inst->DstReg.Index);
- }
-
- prog->NumTexIndirections = indirections;
-}
-
-
-/**
- * Count number of texture instructions in given program and update the
- * program's NumTexInstructions field.
- */
-void
-_mesa_count_texture_instructions(struct gl_program *prog)
-{
- GLuint i;
- prog->NumTexInstructions = 0;
- for (i = 0; i < prog->NumInstructions; i++) {
- prog->NumTexInstructions += is_texture_instruction(prog->Instructions + i);
- }
-}
-
-
-/**
- * Scan/rewrite program to remove reads of custom (output) registers.
- * The passed type has to be either PROGRAM_OUTPUT or PROGRAM_VARYING
- * (for vertex shaders).
- * In GLSL shaders, varying vars can be read and written.
- * On some hardware, trying to read an output register causes trouble.
- * So, rewrite the program to use a temporary register in this case.
- */
-void
-_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
-{
- GLuint i;
- GLint outputMap[VERT_RESULT_MAX];
- GLuint numVaryingReads = 0;
- GLboolean usedTemps[MAX_PROGRAM_TEMPS];
- GLuint firstTemp = 0;
-
- _mesa_find_used_registers(prog, PROGRAM_TEMPORARY,
- usedTemps, MAX_PROGRAM_TEMPS);
-
- assert(type == PROGRAM_VARYING || type == PROGRAM_OUTPUT);
- assert(prog->Target == GL_VERTEX_PROGRAM_ARB || type != PROGRAM_VARYING);
-
- for (i = 0; i < VERT_RESULT_MAX; i++)
- outputMap[i] = -1;
-
- /* look for instructions which read from varying vars */
- for (i = 0; i < prog->NumInstructions; i++) {
- 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 == type) {
- /* replace the read with a temp reg */
- const GLuint var = inst->SrcReg[j].Index;
- if (outputMap[var] == -1) {
- numVaryingReads++;
- outputMap[var] = _mesa_find_free_register(usedTemps,
- MAX_PROGRAM_TEMPS,
- firstTemp);
- firstTemp = outputMap[var] + 1;
- }
- inst->SrcReg[j].File = PROGRAM_TEMPORARY;
- inst->SrcReg[j].Index = outputMap[var];
- }
- }
- }
-
- if (numVaryingReads == 0)
- return; /* nothing to be done */
-
- /* look for instructions which write to the varying vars identified above */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
- if (inst->DstReg.File == type &&
- outputMap[inst->DstReg.Index] >= 0) {
- /* change inst to write to the temp reg, instead of the varying */
- inst->DstReg.File = PROGRAM_TEMPORARY;
- inst->DstReg.Index = outputMap[inst->DstReg.Index];
- }
- }
-
- /* insert new instructions to copy the temp vars to the varying vars */
- {
- struct prog_instruction *inst;
- GLint endPos, var;
-
- /* Look for END instruction and insert the new varying writes */
- endPos = -1;
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
- if (inst->Opcode == OPCODE_END) {
- endPos = i;
- _mesa_insert_instructions(prog, i, numVaryingReads);
- break;
- }
- }
-
- assert(endPos >= 0);
-
- /* insert new MOV instructions here */
- inst = prog->Instructions + endPos;
- for (var = 0; var < VERT_RESULT_MAX; var++) {
- if (outputMap[var] >= 0) {
- /* MOV VAR[var], TEMP[tmp]; */
- inst->Opcode = OPCODE_MOV;
- inst->DstReg.File = type;
- inst->DstReg.Index = var;
- inst->SrcReg[0].File = PROGRAM_TEMPORARY;
- inst->SrcReg[0].Index = outputMap[var];
- inst++;
- }
- }
- }
-}
-
-
-/**
- * Make the given fragment program into a "no-op" shader.
- * Actually, just copy the incoming fragment color (or texcoord)
- * to the output color.
- * This is for debug/test purposes.
- */
-void
-_mesa_nop_fragment_program(struct gl_context *ctx, struct gl_fragment_program *prog)
-{
- struct prog_instruction *inst;
- GLuint inputAttr;
-
- inst = _mesa_alloc_instructions(2);
- if (!inst) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "_mesa_nop_fragment_program");
- return;
- }
-
- _mesa_init_instructions(inst, 2);
-
- inst[0].Opcode = OPCODE_MOV;
- inst[0].DstReg.File = PROGRAM_OUTPUT;
- inst[0].DstReg.Index = FRAG_RESULT_COLOR;
- inst[0].SrcReg[0].File = PROGRAM_INPUT;
- if (prog->Base.InputsRead & FRAG_BIT_COL0)
- inputAttr = FRAG_ATTRIB_COL0;
- else
- inputAttr = FRAG_ATTRIB_TEX0;
- inst[0].SrcReg[0].Index = inputAttr;
-
- inst[1].Opcode = OPCODE_END;
-
- _mesa_free_instructions(prog->Base.Instructions,
- prog->Base.NumInstructions);
-
- prog->Base.Instructions = inst;
- prog->Base.NumInstructions = 2;
- prog->Base.InputsRead = 1 << inputAttr;
- prog->Base.OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR);
-}
-
-
-/**
- * \sa _mesa_nop_fragment_program
- * Replace the given vertex program with a "no-op" program that just
- * transforms vertex position and emits color.
- */
-void
-_mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog)
-{
- struct prog_instruction *inst;
- GLuint inputAttr;
-
- /*
- * Start with a simple vertex program that emits color.
- */
- inst = _mesa_alloc_instructions(2);
- if (!inst) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "_mesa_nop_vertex_program");
- return;
- }
-
- _mesa_init_instructions(inst, 2);
-
- inst[0].Opcode = OPCODE_MOV;
- inst[0].DstReg.File = PROGRAM_OUTPUT;
- inst[0].DstReg.Index = VERT_RESULT_COL0;
- inst[0].SrcReg[0].File = PROGRAM_INPUT;
- if (prog->Base.InputsRead & VERT_BIT_COLOR0)
- inputAttr = VERT_ATTRIB_COLOR0;
- else
- inputAttr = VERT_ATTRIB_TEX0;
- inst[0].SrcReg[0].Index = inputAttr;
-
- inst[1].Opcode = OPCODE_END;
-
- _mesa_free_instructions(prog->Base.Instructions,
- prog->Base.NumInstructions);
-
- prog->Base.Instructions = inst;
- prog->Base.NumInstructions = 2;
- prog->Base.InputsRead = 1 << inputAttr;
- prog->Base.OutputsWritten = BITFIELD64_BIT(VERT_RESULT_COL0);
-
- /*
- * Now insert code to do standard modelview/projection transformation.
- */
- _mesa_insert_mvp_code(ctx, prog);
-}
diff --git a/src/mesa/program/programopt.h b/src/mesa/program/programopt.h
deleted file mode 100644
index ef6f1bd..0000000
--- a/src/mesa/program/programopt.h
+++ /dev/null
@@ -1,53 +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.
- */
-
-
-#ifndef PROGRAMOPT_H
-#define PROGRAMOPT_H 1
-
-#include "main/mtypes.h"
-
-extern void
-_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog);
-
-extern void
-_mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog);
-
-extern void
-_mesa_count_texture_indirections(struct gl_program *prog);
-
-extern void
-_mesa_count_texture_instructions(struct gl_program *prog);
-
-extern void
-_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type);
-
-extern void
-_mesa_nop_fragment_program(struct gl_context *ctx, struct gl_fragment_program *prog);
-
-extern void
-_mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog);
-
-
-#endif /* PROGRAMOPT_H */
diff --git a/src/mesa/program/register_allocate.c b/src/mesa/program/register_allocate.c
deleted file mode 100644
index ada6e35..0000000
--- a/src/mesa/program/register_allocate.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * 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.
- *
- * Authors:
- * Eric Anholt <eric@anholt.net>
- *
- */
-
-/** @file register_allocate.c
- *
- * Graph-coloring register allocator.
- */
-
-#include <talloc.h>
-
-#include "main/imports.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "register_allocate.h"
-
-struct ra_reg {
- char *name;
- GLboolean *conflicts;
-};
-
-struct ra_regs {
- struct ra_reg *regs;
- unsigned int count;
-
- struct ra_class **classes;
- unsigned int class_count;
-};
-
-struct ra_class {
- GLboolean *regs;
-
- /**
- * p_B in Runeson/Nyström paper.
- *
- * This is "how many regs are in the set."
- */
- unsigned int p;
-
- /**
- * q_B,C in Runeson/Nyström paper.
- */
- unsigned int *q;
-};
-
-struct ra_node {
- GLboolean *adjacency;
- unsigned int class;
- unsigned int adjacency_count;
- unsigned int reg;
- GLboolean in_stack;
- float spill_cost;
-};
-
-struct ra_graph {
- struct ra_regs *regs;
- /**
- * the variables that need register allocation.
- */
- struct ra_node *nodes;
- unsigned int count; /**< count of nodes. */
-
- unsigned int *stack;
- unsigned int stack_count;
-};
-
-struct ra_regs *
-ra_alloc_reg_set(unsigned int count)
-{
- unsigned int i;
- struct ra_regs *regs;
-
- regs = talloc_zero(NULL, struct ra_regs);
- regs->count = count;
- regs->regs = talloc_zero_array(regs, struct ra_reg, count);
-
- for (i = 0; i < count; i++) {
- regs->regs[i].conflicts = talloc_zero_array(regs->regs, GLboolean, count);
- regs->regs[i].conflicts[i] = GL_TRUE;
- }
-
- return regs;
-}
-
-void
-ra_add_reg_conflict(struct ra_regs *regs, unsigned int r1, unsigned int r2)
-{
- regs->regs[r1].conflicts[r2] = GL_TRUE;
- regs->regs[r2].conflicts[r1] = GL_TRUE;
-}
-
-unsigned int
-ra_alloc_reg_class(struct ra_regs *regs)
-{
- struct ra_class *class;
-
- regs->classes = talloc_realloc(regs, regs->classes,
- struct ra_class *,
- regs->class_count + 1);
-
- class = talloc_zero(regs, struct ra_class);
- regs->classes[regs->class_count] = class;
-
- class->regs = talloc_zero_array(class, GLboolean, regs->count);
-
- return regs->class_count++;
-}
-
-void
-ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int r)
-{
- struct ra_class *class = regs->classes[c];
-
- class->regs[r] = GL_TRUE;
- class->p++;
-}
-
-/**
- * Must be called after all conflicts and register classes have been
- * set up and before the register set is used for allocation.
- */
-void
-ra_set_finalize(struct ra_regs *regs)
-{
- unsigned int b, c;
-
- for (b = 0; b < regs->class_count; b++) {
- regs->classes[b]->q = talloc_array(regs, unsigned int, regs->class_count);
- }
-
- /* Compute, for each class B and C, how many regs of B an
- * allocation to C could conflict with.
- */
- for (b = 0; b < regs->class_count; b++) {
- for (c = 0; c < regs->class_count; c++) {
- unsigned int rc;
- int max_conflicts = 0;
-
- for (rc = 0; rc < regs->count; rc++) {
- unsigned int rb;
- int conflicts = 0;
-
- if (!regs->classes[c]->regs[rc])
- continue;
-
- for (rb = 0; rb < regs->count; rb++) {
- if (regs->classes[b]->regs[rb] &&
- regs->regs[rb].conflicts[rc])
- conflicts++;
- }
- max_conflicts = MAX2(max_conflicts, conflicts);
- }
- regs->classes[b]->q[c] = max_conflicts;
- }
- }
-}
-
-struct ra_graph *
-ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count)
-{
- struct ra_graph *g;
- unsigned int i;
-
- g = talloc_zero(regs, struct ra_graph);
- g->regs = regs;
- g->nodes = talloc_zero_array(g, struct ra_node, count);
- g->count = count;
-
- g->stack = talloc_zero_array(g, unsigned int, count);
-
- for (i = 0; i < count; i++) {
- g->nodes[i].adjacency = talloc_zero_array(g, GLboolean, count);
- g->nodes[i].adjacency[i] = GL_TRUE;
- g->nodes[i].reg = ~0;
- }
-
- return g;
-}
-
-void
-ra_set_node_class(struct ra_graph *g,
- unsigned int n, unsigned int class)
-{
- g->nodes[n].class = class;
-}
-
-void
-ra_add_node_interference(struct ra_graph *g,
- unsigned int n1, unsigned int n2)
-{
- if (g->nodes[n1].adjacency[n2])
- return;
-
- g->nodes[n1].adjacency[n2] = GL_TRUE;
- g->nodes[n2].adjacency_count++;
- g->nodes[n2].adjacency[n1] = GL_TRUE;
- g->nodes[n2].adjacency_count++;
-}
-
-static GLboolean pq_test(struct ra_graph *g, unsigned int n)
-{
- unsigned int j;
- unsigned int q = 0;
- int n_class = g->nodes[n].class;
-
- for (j = 0; j < g->count; j++) {
- if (j == n || g->nodes[j].in_stack)
- continue;
-
- if (g->nodes[n].adjacency[j]) {
- unsigned int j_class = g->nodes[j].class;
- q += g->regs->classes[n_class]->q[j_class];
- }
- }
-
- return q < g->regs->classes[n_class]->p;
-}
-
-/**
- * Simplifies the interference graph by pushing all
- * trivially-colorable nodes into a stack of nodes to be colored,
- * removing them from the graph, and rinsing and repeating.
- *
- * Returns GL_TRUE if all nodes were removed from the graph. GL_FALSE
- * means that either spilling will be required, or optimistic coloring
- * should be applied.
- */
-GLboolean
-ra_simplify(struct ra_graph *g)
-{
- GLboolean progress = GL_TRUE;
- int i;
-
- while (progress) {
- progress = GL_FALSE;
-
- for (i = g->count - 1; i >= 0; i--) {
- if (g->nodes[i].in_stack)
- continue;
-
- if (pq_test(g, i)) {
- g->stack[g->stack_count] = i;
- g->stack_count++;
- g->nodes[i].in_stack = GL_TRUE;
- progress = GL_TRUE;
- }
- }
- }
-
- for (i = 0; i < g->count; i++) {
- if (!g->nodes[i].in_stack)
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-/**
- * Pops nodes from the stack back into the graph, coloring them with
- * registers as they go.
- *
- * If all nodes were trivially colorable, then this must succeed. If
- * not (optimistic coloring), then it may return GL_FALSE;
- */
-GLboolean
-ra_select(struct ra_graph *g)
-{
- int i;
-
- while (g->stack_count != 0) {
- unsigned int r;
- int n = g->stack[g->stack_count - 1];
- struct ra_class *c = g->regs->classes[g->nodes[n].class];
-
- /* Find the lowest-numbered reg which is not used by a member
- * of the graph adjacent to us.
- */
- for (r = 0; r < g->regs->count; r++) {
- if (!c->regs[r])
- continue;
-
- /* Check if any of our neighbors conflict with this register choice. */
- for (i = 0; i < g->count; i++) {
- if (g->nodes[n].adjacency[i] &&
- !g->nodes[i].in_stack &&
- g->regs->regs[r].conflicts[g->nodes[i].reg]) {
- break;
- }
- }
- if (i == g->count)
- break;
- }
- if (r == g->regs->count)
- return GL_FALSE;
-
- g->nodes[n].reg = r;
- g->nodes[n].in_stack = GL_FALSE;
- g->stack_count--;
- }
-
- return GL_TRUE;
-}
-
-/**
- * Optimistic register coloring: Just push the remaining nodes
- * on the stack. They'll be colored first in ra_select(), and
- * if they succeed then the locally-colorable nodes are still
- * locally-colorable and the rest of the register allocation
- * will succeed.
- */
-void
-ra_optimistic_color(struct ra_graph *g)
-{
- unsigned int i;
-
- for (i = 0; i < g->count; i++) {
- if (g->nodes[i].in_stack)
- continue;
-
- g->stack[g->stack_count] = i;
- g->stack_count++;
- g->nodes[i].in_stack = GL_TRUE;
- }
-}
-
-GLboolean
-ra_allocate_no_spills(struct ra_graph *g)
-{
- if (!ra_simplify(g)) {
- ra_optimistic_color(g);
- }
- return ra_select(g);
-}
-
-unsigned int
-ra_get_node_reg(struct ra_graph *g, unsigned int n)
-{
- return g->nodes[n].reg;
-}
-
-static float
-ra_get_spill_benefit(struct ra_graph *g, unsigned int n)
-{
- int j;
- float benefit = 0;
- int n_class = g->nodes[n].class;
-
- /* Define the benefit of eliminating an interference between n, j
- * through spilling as q(C, B) / p(C). This is similar to the
- * "count number of edges" approach of traditional graph coloring,
- * but takes classes into account.
- */
- for (j = 0; j < g->count; j++) {
- if (j != n && g->nodes[n].adjacency[j]) {
- unsigned int j_class = g->nodes[j].class;
- benefit += ((float)g->regs->classes[n_class]->q[j_class] /
- g->regs->classes[n_class]->p);
- break;
- }
- }
-
- return benefit;
-}
-
-/**
- * Returns a node number to be spilled according to the cost/benefit using
- * the pq test, or -1 if there are no spillable nodes.
- */
-int
-ra_get_best_spill_node(struct ra_graph *g)
-{
- unsigned int best_node = -1;
- unsigned int best_benefit = 0.0;
- unsigned int n;
-
- for (n = 0; n < g->count; n++) {
- float cost = g->nodes[n].spill_cost;
- float benefit;
-
- if (cost <= 0.0)
- continue;
-
- benefit = ra_get_spill_benefit(g, n);
-
- if (benefit / cost > best_benefit) {
- best_benefit = benefit / cost;
- best_node = n;
- }
- }
-
- return best_node;
-}
-
-/**
- * Only nodes with a spill cost set (cost != 0.0) will be considered
- * for register spilling.
- */
-void
-ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost)
-{
- g->nodes[n].spill_cost = cost;
-}
diff --git a/src/mesa/program/register_allocate.h b/src/mesa/program/register_allocate.h
deleted file mode 100644
index 198b89f..0000000
--- a/src/mesa/program/register_allocate.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.
- *
- * Authors:
- * Eric Anholt <eric@anholt.net>
- *
- */
-
-struct ra_class;
-struct ra_regs;
-
-/* @{
- * Register set setup.
- *
- * This should be done once at backend initializaion, as
- * ra_set_finalize is O(r^2*c^2). The registers may be virtual
- * registers, such as aligned register pairs that conflict with the
- * two real registers from which they are composed.
- */
-struct ra_regs *ra_alloc_reg_set(unsigned int count);
-unsigned int ra_alloc_reg_class(struct ra_regs *regs);
-void ra_add_reg_conflict(struct ra_regs *regs,
- unsigned int r1, unsigned int r2);
-void ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int reg);
-void ra_set_finalize(struct ra_regs *regs);
-/** @} */
-
-/** @{ Interference graph setup.
- *
- * Each interference graph node is a virtual variable in the IL. It
- * is up to the user to ra_set_node_class() for the virtual variable,
- * and compute live ranges and ra_node_interfere() between conflicting
- * live ranges.
- */
-struct ra_graph *ra_alloc_interference_graph(struct ra_regs *regs,
- unsigned int count);
-void ra_set_node_class(struct ra_graph *g, unsigned int n, unsigned int c);
-void ra_add_node_interference(struct ra_graph *g,
- unsigned int n1, unsigned int n2);
-/** @} */
-
-/** @{ Graph-coloring register allocation */
-GLboolean ra_simplify(struct ra_graph *g);
-void ra_optimistic_color(struct ra_graph *g);
-GLboolean ra_select(struct ra_graph *g);
-GLboolean ra_allocate_no_spills(struct ra_graph *g);
-
-unsigned int ra_get_node_reg(struct ra_graph *g, unsigned int n);
-void ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost);
-int ra_get_best_spill_node(struct ra_graph *g);
-/** @} */
-
diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp
deleted file mode 100644
index 9a813c8..0000000
--- a/src/mesa/program/sampler.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.
- */
-
-#include <cstdio>
-#include "ir.h"
-#include "glsl_types.h"
-#include "ir_visitor.h"
-
-extern "C" {
-#include "main/compiler.h"
-#include "main/mtypes.h"
-#include "program/prog_parameter.h"
-}
-
-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;
-}
-
-class get_sampler_name : public ir_hierarchical_visitor
-{
-public:
- get_sampler_name(ir_dereference *last,
- struct gl_shader_program *shader_program)
- {
- this->mem_ctx = talloc_new(NULL);
- this->shader_program = shader_program;
- this->name = NULL;
- this->offset = 0;
- this->last = last;
- }
-
- ~get_sampler_name()
- {
- talloc_free(this->mem_ctx);
- }
-
- 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.
- */
- shader_program->InfoLog =
- talloc_asprintf_append(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;
- }
-
- struct gl_shader_program *shader_program;
- const char *name;
- void *mem_ctx;
- int offset;
- ir_dereference *last;
-};
-
-extern "C" {
-int
-_mesa_get_sampler_uniform_value(class ir_dereference *sampler,
- struct gl_shader_program *shader_program,
- const struct gl_program *prog)
-{
- get_sampler_name getname(sampler, shader_program);
-
- sampler->accept(&getname);
-
- GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1,
- getname.name);
-
- if (index < 0) {
- fail_link(shader_program,
- "failed to find sampler named %s.\n", getname.name);
- return 0;
- }
-
- index += getname.offset;
-
- return prog->Parameters->ParameterValues[index][0];
-}
-}
diff --git a/src/mesa/program/sampler.h b/src/mesa/program/sampler.h
deleted file mode 100644
index 22467e9..0000000
--- a/src/mesa/program/sampler.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-int
-_mesa_get_sampler_uniform_value(class ir_dereference *sampler,
- struct gl_shader_program *shader_program,
- const struct gl_program *prog);